diff options
author | Yves Combe <ycombe@src.gnome.org> | 2006-12-18 23:42:31 (GMT) |
---|---|---|
committer | Yves Combe <ycombe@src.gnome.org> | 2006-12-18 23:42:31 (GMT) |
commit | f106d808e51077cb5428dd7657da4c9beca7baa8 (patch) | |
tree | 2a71dce23cd3c503abde54d4428fb6651eec6e68 /src/gc_sound/src/gc-sound-mixer-SDL.c | |
parent | 140dc546466033a2ca7b96dd2384bc19b59e99f6 (diff) |
GC_SOUND: Add a property for policy. Fix bug if played item is destroyedEXPERIMENTAL
GC_SOUND:
Add a property for policy.
Fix bug if played item is destroyed at end before it's
"play_end" callback.
TODO: fix bug if item is destroyed when it's playing.
GCOMPRIS
fix memory and bar.c
TODO: python binding for gc_sound_from_gc_filename
Diffstat (limited to 'src/gc_sound/src/gc-sound-mixer-SDL.c')
-rw-r--r-- | src/gc_sound/src/gc-sound-mixer-SDL.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gc_sound/src/gc-sound-mixer-SDL.c b/src/gc_sound/src/gc-sound-mixer-SDL.c index 6c06c06..ba641a6 100644 --- a/src/gc_sound/src/gc-sound-mixer-SDL.c +++ b/src/gc_sound/src/gc-sound-mixer-SDL.c @@ -229,7 +229,9 @@ gc_sound_mixer_sdl_halt (GcSoundMixer * mixer) self = GC_SOUND_MIXER_SDL(mixer); - Mix_HaltChannel(-1); + //Mix_HaltChannel(-1); + // use Expire channel to let another threaded stop them. + Mix_ExpireChannel( -1, 1); return TRUE; } @@ -262,7 +264,9 @@ gc_sound_mixer_sdl_halt_channel (GcSoundMixer * mixer, GcSoundChannel * cha g_return_val_if_fail(GC_IS_SOUND_MIXER_SDL(mixer), FALSE); g_return_val_if_fail(GC_IS_SOUND_CHANNEL(channel), FALSE); - Mix_HaltChannel (channel->channel_number); + //Mix_HaltChannel (channel->channel_number); + // use Expire channel to let another threaded stop them. + Mix_ExpireChannel( channel->channel_number, 1); return TRUE; } @@ -298,18 +302,19 @@ gc_sound_mixer_sdl_play_item (GcSoundMixer * mixer, GcSoundChannel * channel, G if ((item->volume == -1.0) || (item->volume > channel->volume)) Mix_VolumeChunk(sample, (int ) channel->volume * MIX_MAX_VOLUME); - else + else { Mix_VolumeChunk(sample, (int) item->volume * MIX_MAX_VOLUME); + } - if (Mix_PlayChannel(channel->channel_number, sample, 0)==-1) { - g_warning("Channel cannot play music %s", item->filename); - Mix_FreeChunk (sample); - return FALSE; - } + if (Mix_PlayChannel(channel->channel_number, sample, 0)==-1) { + g_warning("Channel cannot play music %s", item->filename); + Mix_FreeChunk (sample); + return FALSE; + } g_hash_table_insert( self->samples, channel, sample); - g_warning("Playing %s on channel #%d", item->filename, channel->channel_number); + g_warning("Playing %s volume on channel #%d", item->filename, channel->channel_number); return TRUE; } @@ -324,6 +329,8 @@ void channel_finished_cb (int channel_number) g_return_if_fail(GC_IS_SOUND_MIXER_SDL(self)); g_return_if_fail(GC_IS_SOUND_CHANNEL(channel)); + g_warning("Oh My Goodness, an error : %s", Mix_GetError()); + g_signal_emit(self, gc_sound_mixer_sdl_signals[CHANNEL_FINISHED], 0, channel, NULL); } |