--- deliantra/Deliantra-Client/Client.xs 2006/04/30 09:21:47 1.70 +++ deliantra/Deliantra-Client/Client.xs 2006/05/05 19:10:16 1.72 @@ -272,6 +272,19 @@ SDL_PushEvent ((SDL_Event *)&ev); } +static void +channel_finished (int channel) +{ + SDL_UserEvent ev; + + ev.type = SDL_USEREVENT; + ev.code = 1; + ev.data1 = (void *)channel; + ev.data2 = 0; + + SDL_PushEvent ((SDL_Event *)&ev); +} + MODULE = CFClient PACKAGE = CFClient PROTOTYPES: ENABLE @@ -490,6 +503,12 @@ hv_store (hv, "x", 1, newSViv (ev.button.x), 0); hv_store (hv, "y", 1, newSViv (ev.button.y), 0); break; + + case SDL_USEREVENT: + hv_store (hv, "code", 4, newSViv (ev.user.code), 0); + hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); + hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); + break; } XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); @@ -500,6 +519,7 @@ Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512) POSTCALL: Mix_HookMusicFinished (music_finished); + Mix_ChannelFinished (channel_finished); void Mix_CloseAudio ()