Hi All, In a thread I just posted I asked about queuing up sound files and a poster said that it is not possible. I put it in the events queue and they will play immediately upon startup. If I use setTimeout() the delay seems to work fine. What is the best way to do this. I have a hard time believing it is not possible to queue up sound. Thanks to all in advance! -- Leonard Burton, N9URK http://www.jiffyslides.com service-CbOvBfcOUrWrJCssh9Shfg@public.gmane.org leonardburton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org "The prolonged evacuation would have dramatically affected the survivability of the occupants." --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Leonard Burton a écrit :> I put it in the events queue and they will play immediately upon startup.Well yeah, cuz playing the file is asynchronous, so your events are going to trigger in rapid-fire mode, and launch their respective files this way. There''s nothing for it: if you want to queue files, you''d need to use, say, an effect queue of Effect.Event with an afterFinish, *and* a proper *duration* option (so the queued-up events after that use a proper start offset). -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
HI Christopher, > There''s nothing for it: if you want to queue files, you''d need to use, > say, an effect queue of Effect.Event with an afterFinish, *and* a proper > *duration* option (so the queued-up events after that use a proper start > offset). Thanks for the reply. Would you please give me an code snippet example of what you are meaning? Cheers, -- Leonard Burton, N9URK http://www.jiffyslides.com service-CbOvBfcOUrWrJCssh9Shfg@public.gmane.org leonardburton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org "The prolonged evacuation would have dramatically affected the survivability of the occupants." -- Leonard Burton, N9URK http://www.jiffyslides.com service-CbOvBfcOUrWrJCssh9Shfg@public.gmane.org leonardburton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org "The prolonged evacuation would have dramatically affected the survivability of the occupants." --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Leonard Burton a écrit :> HI Christopher,Lose the ''r'' ;-)> Thanks for the reply. Would you please give me an code snippet > example of what you are meaning?Actually, thinking about it, this is heavier than manual timeouts, and for no purpose. Here''s a non-queue-, timeout-based solution. Untested, but something along the lines of this: function playSoundsInQueue(sounds) { var delay = 0; sounds.each(function(info) { setTimeout(Sound.play.curry(info.uri), delay * 1000); delay += (info.duration || 0); }); } var soundFiles = [ { uri: ''blah.mp3'', duration: 12 }, { uri: ''blip.wav'', duration: 3 }, { uri: ''blob.mp3'', duration: 13 } ]; playSoundsInQueue(soundFiles); This will probably cause tiny blanks between files, depending on the browser''s performance, but should work well enough. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
HI Chrstophe, I lost it that time :)> > Thanks for the reply. Would you please give me an code snippet > > example of what you are meaning? > > Actually, thinking about it, this is heavier than manual timeouts, and > for no purpose. Here''s a non-queue-, timeout-based solution. > > Untested, but something along the lines of this: > > function playSoundsInQueue(sounds) {} > > var soundFiles = [ ]; > > playSoundsInQueue(soundFiles);Sorry if I seem a little dense here, but, How will this relate to the queue of the images? I need to be able to have image n and sound n to correspond. Thanks :) -- Leonard Burton, N9URK http://www.jiffyslides.com service-CbOvBfcOUrWrJCssh9Shfg@public.gmane.org leonardburton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org "The prolonged evacuation would have dramatically affected the survivability of the occupants." --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Leonard Burton a écrit :> Sorry if I seem a little dense here, but, How will this relate to the > queue of the images? I need to be able to have image n and sound n to > correspond.Ouch! Hadn''t groked that. OK, so if you''re playing with images as well, like fades and stuff, what you can do is add Effect.Event instances to your queue with the sound-triggering code in their afterFinish callback, using the proper Event duration so your sound can have time to play. You''d add the sound playing like this: new Effect.Event({ queue: ''end'', // or whatever queue defs… afterFinish: function() { Sound.play(…); }); And if you want the sound to play BEFORE the rest of the queue goes on, just give your effect a proper duration option. I think that should cut it. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---