Writes the integer i in the MIDI file using the variable length quantity representation:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(MIDI_file), | intent(inout) | :: | self | |||
integer(kind=int32), | intent(in) | :: | i |
subroutine write_variable_length_quantity(self, i) class(MIDI_file), intent(inout) :: self integer(int32), intent(in) :: i integer(int32) :: j integer(int8), allocatable, dimension(:) :: array ! The maximum possible MIDI value: if (i > int(z'0FFFFFFF', int32)) then write(error_unit, *) "ERROR 2: delay > 0x0FFFFFFF ! ", i error stop 2 end if array = variable_length_quantity(i) ! The bytes are now written in the file: do j = 1, size(array) write(self%unit, iostat=self%status) array(j) end do end subroutine write_variable_length_quantity