lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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 the callbacks.

    Lua runs..
-> sdl_mixer C side callback -> glua_callback_post -> continue.. (no access of Lua here)
    SDL_PollEvent
        -> 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 each other.

Thanks for the ideas!
-ak

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 table-of-floats.

i looked at threads / events etc. for scheduling, but didn't want to mod the core.

it's (fairly) easy to do "hard-sound" apps in lua :

while (true) do
  check status (maybe sleep / wait event)
  update buffer
  update display
end
(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 ?

congrats.

ps my new phone supports brew apps ... the nights are just too short :)

Adrian