[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: stability issue (how to deal with asynchronous callbacks?)
- From: Adrian Sietsma <adrian_groups@...>
- Date: Wed, 06 Apr 2005 04:29:00 +1000
Asko Kauppi wrote:
My current plans go approximately like this:
Since any Lua script utilizing SDL_Mixer also needs to have an SDL event
loop, I'll make SDL_PollEvent responsible for the "lua side" fetching of
-> sdl_mixer C side callback -> glua_callback_post ->
continue.. (no access of Lua here)
-> glua_callback_fetch -> Lua callback
(looping until no callbacks left in queue)
That's fairly simple, and does not need Lua core mods (good so).
There's a lot more details, sure, but this should work, be simple, and
modular. Also, the dispatcher and fetcher don't need to intimitely know
Thanks for the ideas!
my PortAudio port uses (brutal i know) a line debug hook (in one
implementation). this is set to check the audio buffer status every 1e6
instructions or so, and top-up if required.
audio data is transferred via a userdata with accessors for
i looked at threads / events etc. for scheduling, but didn't want to mod
it's (fairly) easy to do "hard-sound" apps in lua :
while (true) do
check status (maybe sleep / wait event)
(better yet do with coroutines, or as a filter chain)
it's that background refresh / save audio data while the app is away
with the pixies somewhere that i have problems with.
by the way - i looked at SDL, but it didn't record, as i remember. is
this still the case ?
ps my new phone supports brew apps ... the nights are just too short :)