fluidXtra :  schmittMachine support schmittMachine Support Home
Questions related to the fluidXtra Xtra 
pollcallbacks and s.p.o.d.
Posted by: Peter Hesterman ()
Date: May 03, 2008 01:11PM

Antoine,

Is there a way to avoid having MacOS show the "spinning pizza of death" while calling pollcallbacks in a loop? Here's how I have it set up:


property synth, playing

on PlayIt
-- send midi data to synth here
-- schedule the callback to PlayDone here
playing = true
end

on PlayDone
playing = false
end

on WaitUntilDone
repeat while playing
synth.PollCallbacks()
end repeat
end


PlayDone is the callback handler. WaitUntilDone delays program execution until the synth is done playing a musical example. It all works fine, but that annoying, spinning thing always appears! I know that this is probably a Director/MacOS problem, but if there's a way to fix it in the fluidxtra, or you can give me some advice about how to code this to avoid it, I'd sure appreciate it.

Thanks again, and thanks also for making the xtra free, open-source, and supported, too!

Peter

Options: ReplyQuote
Re: pollcallbacks and s.p.o.d.
Posted by: Peter Hesterman ()
Date: May 03, 2008 01:21PM

oops. Fixed a mistake in my sample code from the last message.

property synth, playing

on PlayIt
-- send midi data to synth here
-- schedule the callback to PlayDone here
playing = true
WaitUntilDone <--left this out before
end

on PlayDone
playing = false
end

on WaitUntilDone
repeat while playing
synth.PollCallbacks()
end repeat
end

Peter

Options: ReplyQuote
Re: pollcallbacks and s.p.o.d.
Posted by: antoine schmitt ()
Date: May 03, 2008 06:11PM

Actually, the reason for the spinning cursor is not fluid here. If you play the same code without the fluid calls (and call PlayDone after a while like 30 secs for example), you will also get the spinning cursor. The reason is that you wait in a repeat loop, which blocks director.

You should wait in a frame loop:

-- in a frame script:

on exitFrame
go to the frame
end

You do not need to call PollCallbacks in this case, as the callbacks are executed in idle events by the Xtra. Only call PollCallbacks when in a repeat loop (during which idle events never happen). But also : "never do long repeat loops" ! ;-)

For example, in a frame script :

property synth

on beginSprite me
-- send midi data to synth here
-- schedule the callback to PlayDone here
end

on PlayDone
go to the frame + 1 -- for example
end

on exitFrame me
go to the frame
end

Options: ReplyQuote
Re: pollcallbacks and s.p.o.d.
Posted by: Peter Hesterman ()
Date: May 03, 2008 07:49PM

Thanks, Antoine. That's what I figured, but I had to ask because, for some reason, the spinning cursor didn't appear when I was using the seqxtra in a similar way.

Peter

Options: ReplyQuote


Sorry, only registered users may post in this forum.
This forum powered by Phorum.