Sub Astream_NewData (Buffer() As Byte)
Private st As String
Log(st)
If Buffer(0) = 0x76 Then ' "v"
Private buf(2) As Byte
bc.ArrayCopy2(Buffer,1,buf,0,2)
st = bc.StringFromBytes(buf)
Log(st)
Volume = st
RunNative("Mp3_set_volume", Null)
Else
st = bc.StringFromBytes(Buffer)
Log(st)
Select st
Case "Cont"
State = False
RunNative("Mp3_single_loop", Null)
continuous = True
Log("cont = ",continuous)
Case "Next"
RunNative("Mp3_next", Null)
play = True
Case "Prev"
RunNative("Mp3_prev", Null)
play = True
Case "Vol0"
Volume = 0
RunNative("Mp3_set_volume", Null)
Case "Loop"
State = True
RunNative("Mp3_single_loop", Null)
continuous = False
Case "Playpause"
If play Then
RunNative("Mp3_pause", Null)
play = False
Else
RunNative("Mp3_play", Null)
play = True
End If
Case "Random"
State = False
RunNative("Mp3_single_loop", Null)
Delay(1000)
RunNative("Mp3_random_play", Null)
play = True
continuous = False
Case "Stop"
RunNative("Mp3_stop", Null)
play = False
continuous = False
Delay(1000)
State = False
RunNative("Mp3_single_loop", Null)
Case "watch"
Case Else ' song number
Arg = st
Log("song ",Arg)
Cmd = 0x03
RunNative("Mp3_send_cmd2", Null)
play = True
Delay(1000)
State = False
RunNative("Mp3_single_loop", Null)
End Select
watchtmr.Enabled = False
watchtmr.Enabled = True
End If
End Sub