I think I solved the problem. The issue comes from starting a player in the playStopped handler.

I set up a group with the number of players needed to play all the sounds and use the handlers as below (but since I had enough players, they didn't need to load any new files) and it still hung up. That indicated the start player in the playStopped was the culprit.

I change the playStopped to send "StartPlayer" && ("Player" && tNextPlayer) to me in 10 milliseconds, and I haven't been able to get it to hang.

I reduced the number of players to try interleaving them again, but setting up the next file in the playStopped handler would delay the message to play the next one, dragging out the sequence.

What I wound up with was doing a send "QueueNext" to sPlayerToSetup in 10 milliseconds in a startPlaying handler, so I could start the next sound quickly, and then load the next sound safely while the current one is playing. If I didn't send in 10 milliseconds in the startPlaying, it would still hang, but not as often.

The (QuickTime) player on Windows seems to be very timing sensitive.

At 11:31 AM 3/9/2006, you wrote:
I am trying to play a sequence of MP3s. I am using 3 interleaved players to speed up the transition between the sounds. I set up the first 3 sounds on Player 1 - Player 3. I then start Player 1 and when I get a playStopped message, I start Player 2 and set the filename for Player 1 to the next sound file for that player (if there is one). Is there any memory management issues I need to be aware of? My stack freezes eventually on XP, both as a standalone, and in the IDE. I have a group setup to contain the players. I originally had the code attached to each player and had the same result. I have generalized my code and moved it to the group script. My group script is the following (perhaps someone can see a problem):

function NextPlayerNumber pName
  put word 2 of pName into tPlayerNumber
  put tPlayerNumber + 1 into tPlayerNumber
if tPlayerNumber > the number of players of me then put 1 into tPlayerNumber
  return tPlayerNumber
end NextPlayerNumber

on playStopped
  put NextPlayerNumber(the short name of the target) into tNextPlayer
  if the cpDone of player ("Player" && tNextPlayer) of me is not true then
    start player ("Player" && tNextPlayer) of me
    QueueNext
  else
    StoppedReading
  end if
end playStopped

on QueueNext
  put the cpSoundList of the target into tCurrentSoundList
  if tCurrentSoundList is not empty then
    if there is no file the first item of tCurrentSoundList then
ReportError "Cannot find file:" && the first item of tCurrentSoundList, "Missing Sound File"
      set the cpDone of the target to true
    else
      lock messages
      set the filename of the target to the first item of tCurrentSoundList
      unlock messages
      delete item 1 of tCurrentSoundList
      set the cpSoundList of the target to tCurrentSoundList
    end if
  else
    set the cpDone of the target to true
  end if
end QueueNext

on SetSoundFiles pSoundFileList
  put the number of players in me into tNumPlayers

  -- split up the list among the players, interleaving the sounds
  repeat with i = 1 to the number of items in pSoundFileList
    put (i - 1) mod tNumPlayers + 1 into tPlayerNumber
put tPlayerList[tPlayerNumber] & item i of pSoundFileList & "," into tPlayerList[tPlayerNumber]
  end repeat

  -- queue up the first sound file for each
  lock messages
  repeat with i = 1 to tNumPlayers
    if there is no file the first item of tPlayerList[i] then
ReportError "Cannot find file:" && the first item of tPlayerList[i], "Missing Sound File"
      set the cpDone of player ("Player" && i) to true
    else
set the filename of player ("Player" && i) to the first item of tPlayerList[i]
      delete the first item of tPlayerList[i]
      set the cpSoundList of player ("Player" && i) to tPlayerList[i]
      set the cpDone of player ("Player" && i) to false
    end if
  end repeat
  unlock messages
end SetSoundFiles

on StartPlaying
  start player "Player 1" of me
end StartPlaying



Peter T. Evensen
http://www.PetersRoadToHealth.com
314-629-5248 or 888-628-4588
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Peter T. Evensen
http://www.PetersRoadToHealth.com
314-629-5248 or 888-628-4588
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to