Stringifying for Gareth

Here is my MP3 playing routine. It shows an int coming in, gettting converted to a string, and then assembled into a longer string which is then sent to the mp3 unit via serial. The only object you should need to make this work is "Numbers" with is sorta "Parallax standard".

 

 

PUB Playmp3 (number)    | b

   SetString( @mp3str, String("VPF"))    'this is the "play" command
   SetString( @mp3str3, String(".mp3"))
   
   if firsttime==true      ' this is the "start up" routine only done once
     firsttime:=false
     mp3.str(string("IPA"))
     mp3.tx(13)
     waitcnt(clkfreq/10 + cnt)
     mp3.str(string("ECS"))
     mp3.tx(13)
     waitcnt(clkfreq/4  + cnt)
     mp3.str(string("VSV 10"))    'volume 50 is pretty low 0 is wicked loud
     mp3.tx(13)


    
   b:=Numbers.ToStr(number,%1010)  'requested song number is now a string
   SetString(@mp3str2, (b))    'set the string as "we are going to work with it now"
   AddString ( @mp3str4,@mp3str2,@mp3str3) 'adds ".mp3" to song number (which is now a string)
   Addstring (@mp3str5,@mp3str,@mp3str4)  'adds "song.mp3" to "VPF" which is the play command
   'if 17 comes in we end up with "VPF17.mp3"
   mp3.str(@mp3str5)    'serial out to the mp3 player
   mp3.tx(13)

  
PRI AddString( dstStrPtr, srcStrPtr1, srcStrPtr2 ) | len
  len := StrSize(srcStrPtr1)
  ByteMove(dstStrPtr, srcStrPtr1, len)
  ByteMove(dstStrPtr += len, srcStrPtr2, StrSize(srcStrPtr2))   '+1 for zero termination
 
PRI SetString( dstStrPtr, srcStrPtr )
  ByteMove(dstStrPtr, srcStrPtr, StrSize(srcStrPtr))  '+1 for zero termination