private Sub midiDeltaFromDez (ticks As Long) As Long
private Sub midiDeltaFromDez (ticks As Long) As Long
Dim long1, long2, long3 As Long
Dim tickStr As String = ticks
Dim bitstr As String = getBitStr(ticks)
Dim bitbyte() As Byte = bitstr.GetBytes("utf8")
Dim bitbyte2(bitbyte.Length) As Byte
For i = 0 To bitbyte.Length - 1
bitbyte2(i) = bitbyte(bitbyte.Length - i - 1)
Next
'If Bit.
'bc.
If ticks < 128 Then
For i = 0 To 6
If bitbyte2(i)= 49 Then
long1 = long1 + Power( 2,i)
End If
Next
' 1 byte
else If ticks < 16384 Then
' 2 byte
For i = 0 To 6
If bitbyte2(i)= 49 Then
long1 = long1 + Power( 2,i)
End If
Next
For i = 7 To bitbyte.Length - 1
If bitbyte2(i)= 49 Then
long2 = long2 + Power( 2,i)
End If
Next
'long2 = long2 + 128
Else If ticks < 2097152 Then
' 3 byte
'int1 =
For i = 0 To 6
If bitbyte2(i)= 49 Then
long1 = long1 + Power( 2,i)
End If
Next
For i = 7 To 13
If bitbyte2(i)= 49 Then
long2 = long2 + Power( 2,i)
End If
Next
Else
For i = 0 To 6
If bitbyte2(i)= 49 Then
long1 =long1+ Power( 2,i)
End If
Next
For i = 7 To 13
If bitbyte2(i)= 49 Then
long2 = long2 + Power( 2,i)
End If
Next
For i = 7 To 13
If bitbyte2(i)= 49 Then
long3 = long3 + Power( 2,i)
End If
Next
End If
End Sub
End Sub