lua-users home
lua-l archive

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


I have encountered this issue in a completely different application. The 
solution for me was rather simple. Sync. your callbacks.
 If this does not fit  your sound app requirements, I know Adrian has
solved this problem with Lua sound on WIn32 with a rather cool ring
buffer.

DB

On Apr 5, 2005 9:28 PM, Asko Kauppi <asko.kauppi@sci.fi> wrote:
> 
> The Lua/SDL_mixer integration is having the following problem:
> 
>    Lua runs happily, starts to play a tune  ..dam-dam..
>    Attaches a callback to get to the rhytm
> 
>    Lua continues running..
>         --> sdl_mixer gives a C callback -> sdl_mixer module -> Lua call
> 
> Now, the callback probably happens in another thread, or otherwise
> asynchronously to the main loop, running the Lua stack.  How do we deal
> with this?
> 
> Should the Lua core be patched to include a "incoming callbacks" queue,
> or something, which other threads could write and the main Lua
> execution thread would read (thus, needing no other synchronization).
> Or do coroutines provide a solution (I think not).
> 
> If the "incoming callbacks queue" solution is suitable, has anyone done
> such already?
> 
> -ak
> 
>