From 38ba88f6cc66cc5acdfa756224712e9d5a8c7b98 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Thu, 20 Mar 2003 03:57:29 +0000 Subject: [PATCH] more looping stuff --- ChangeLog | 2 +- arch/sdl/digi.c | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5afb1a04..a63ed4df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ 2003-03-19 Bradley Bell * arch/sdl/digi.c, main/kludge.c: implemented - digi_link_sound_to_object3 for looping sounds + digi_link_sound_to_object3 for looping sounds, other looping stuff * arch/sdl/gr.c: removing dependencies on stuff in main/ diff --git a/arch/sdl/digi.c b/arch/sdl/digi.c index e5fd02d0..62fd5af4 100644 --- a/arch/sdl/digi.c +++ b/arch/sdl/digi.c @@ -1,4 +1,4 @@ -/* $Id: digi.c,v 1.8 2003-03-20 03:21:11 btb Exp $ */ +/* $Id: digi.c,v 1.9 2003-03-20 03:57:29 btb Exp $ */ /* * * SDL digital audio support @@ -380,6 +380,11 @@ int digi_start_sound_object(int obj) if (slot<0) return -1; +#if 0 + // only use up to half the sound channels for "permanant" sounts + if ((SoundObjects[i].flags & SOF_PERMANANT) && (N_active_sound_objects >= max(1,digi_get_max_channels()/4)) ) + return -1; +#endif SoundSlots[slot].soundno = SoundObjects[obj].soundnum; SoundSlots[slot].samples = GameSounds[SoundObjects[obj].soundnum].data; @@ -642,7 +647,17 @@ int digi_link_sound_to_pos2( int org_soundnum, short segnum, short sidenum, vms_ SoundObjects[i].max_distance = max_distance; SoundObjects[i].volume = 0; SoundObjects[i].pan = 0; - digi_get_sound_loc( &Viewer->orient, &Viewer->pos, Viewer->segnum, + SoundObjects[i].loop_start = SoundObjects[i].loop_end = -1; + + if (Dont_start_sound_objects) { //started at level start + + SoundObjects[i].flags |= SOF_PERMANANT; + + SoundObjects[i].handle = -1; + } + else { + + digi_get_sound_loc( &Viewer->orient, &Viewer->pos, Viewer->segnum, &SoundObjects[i].lp_position, SoundObjects[i].lp_segnum, SoundObjects[i].max_volume, &SoundObjects[i].volume, &SoundObjects[i].pan, SoundObjects[i].max_distance ); @@ -650,6 +665,14 @@ int digi_link_sound_to_pos2( int org_soundnum, short segnum, short sidenum, vms_ if (!forever || SoundObjects[i].volume >= MIN_VOLUME) digi_start_sound_object(i); + // If it's a one-shot sound effect, and it can't start right away, then + // just cancel it and be done with it. + if ( (SoundObjects[i].handle < 0) && (!(SoundObjects[i].flags & SOF_PLAY_FOREVER)) ) { + SoundObjects[i].flags = 0; + return -1; + } + } + return SoundObjects[i].signature; } -- 2.39.2