Re: A Basic Question: A list player
Status: Alpha
Brought to you by:
cwalther
From: chikitin <cs...@gm...> - 2009-03-19 12:15:12
|
> > function n_permuter(tbl, n) > for i = 1, n do > local a,b = math.random(#tbl),math.random(#tbl) > tbl[a], tbl[b] = tbl[b], tbl[a] > end > end Yes. I couldn't do pass by reference in pipmak:) So, I use local a,b = math.random(tbl),math.random(tbl) instead. > I'm having some trouble understanding that code. Your scheduled function only ever returns nil or nothing, and therefore is only run once, is that what you want? What's the point of assigning .05 to n when that value is never used (the only place where n is used is in "return n", and there you set it to nil just before)? (Is the return statement placed where you meant to place it? Your indentation is a bit odd so it's easy to miss.) Your repeat loop spins a large number of times while sounds are playing, using 100% CPU and blocking all other Pipmak activity, is that what you want? >> you raised a great point here. The schdeude function checks every .05 >> second if the current music a[i] is still playing! as you see if the >> current music it is not playing then next music a[i+1] will immidiately >> play ( having the schedule function with interval nil). Is there any >> other way to ask pipmak to do some action as soon as a sound is stopped >> playing? Here's how I would clean it up into something that does approximately what you want (untested): function list_playerXL(a,m,bl) if bl == 0 then n_permuter(a, 30) end a[1]:play() local ii=1 pipmak.schedule(.05, function() if ii == m then return nil end if not a[ii]:playing() then ii=ii+1 a[ii]:play() end return .05 end ) end Thanks for cleaning that up:) It is much more understandable now:) > I tried list_playerXL(a,6,0). but it plays different number of > sounds each > time! I'm not sure why it would do that, at a glance, but I don't have time to test it or analyze it in detail right now. I'll have a closer look tomorrow if you can't figure it out until then. > I couldn't Attach the file ( 5MB) it was saying that the file is too > large > when i tried to upload it. Yes, we'd rather not spam all list subscribers with 5MB files. Why is it so big, anyway? I'd imagine that you should be able to strip down an example project for this to a few dozen KB. If it must be that big, then you're better off putting it on some web server or file hosting service and posting a link than sending it directly through the list. -Christian Hey Christian! now it works. You can try it yourself at: http://faculty.uncfsu.edu/csarami/files/storage/Demo.pipmak - Random.zip Thansk a lot. cs ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Pipmak-Users mailing list Pip...@li... news://news.gmane.org/gmane.games.devel.pipmak.user https://lists.sourceforge.net/lists/listinfo/pipmak-users -- View this message in context: http://www.nabble.com/A-Basic-Question%3A-A-list-player-tp22579146p22598945.html Sent from the pipmak-users mailing list archive at Nabble.com. |