Shop OBEX P1 Docs P2 Docs Learn Events
VS1002 problems again, only with the program this time — Parallax Forums

VS1002 problems again, only with the program this time

science_geekscience_geek Posts: 247
edited 2009-10-14 21:04 in Propeller 1
ok, so i have the vs1002 up and working just like its supposed to...sorta. i can make it play one song, but when that song is done i cant get it to play a different song below is my code, i think the problem lies with the dataout method but i just cant figure it out for sure, if anyone has one of these working with multiple songs please help.

PUB Start | Bytes, Read, Count, Poss
  MP3.start (11,8,10,9,12)         ' Start mp3 object  
  debug.start(31, 30, 0, 115200)
   
  dira[noparse][[/noparse]13]~
  dira[noparse][[/noparse]14]~~
       
  sdfat.mount(16)
  sdfat.popen(String("wordup.mp3"), "r")
  
  hello := 1 
  outa[noparse][[/noparse]14] := 1
  mp3.SetBassBoost(180)
  
  mp3.SetBassBoost(180)
  MP3.WriteReg(3,33000)
  MP3.SetVolume(220,0)
   
          ' <<-- Change mp3 file name here.
                              ' <<-- Set clock devider. This is verry improtant, if you do not it will play very slowly
  
                                                           ' Volume defalts to zero on startup, so it must be set.
DataOut
PUB DataOut | Bytes, Read, Count, Poss         
  repeat
    if ina[noparse][[/noparse]13] == 1
      Poss += sdfat.pread(@SDBuffer,32)
                                                        
      Count~
      if Bytes <  32
        repeat Bytes
          MP3.WriteDataByte(SDBuffer[noparse][[/noparse]Read++])
        sdfat.pclose
        quit        
      MP3.WriteDataBuffer(@SDBuffer)
  
  debug.str(string("next Songssssssssss"))
  sdfat.popen(String("crusade0.mp3"), "r")
  mp3.SetBassBoost(180)
  MP3.WriteReg(3,33000)
  MP3.SetVolume(220,0)     
  repeat
    if ina[noparse][[/noparse]13] == 1
      Poss += sdfat.pread(@SDBuffer,32)
                                                        
      Count~
      if Bytes <  32
        repeat Bytes
          MP3.WriteDataByte(SDBuffer[noparse][[/noparse]Read++])
        quit        
      MP3.WriteDataBuffer(@SDBuffer)

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2009-10-14 21:04
    Can it be that you have to 'close' the MP3 device as well? I'd expect that the VS1002 does not know how big the MP3 stream is that you send. But the MP3 file has some header information at the beginning. So, if you start sending an additional file it simply thinks that the stream continues instead of reading the first bytes as the next header.

    Just a guess.
Sign In or Register to comment.