From 07a2da40f17aecbfa48e8ed49977e9adfcd979a6 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 1 Feb 2009 04:10:36 +0000 Subject: [PATCH] - Changed FMOD init() to allocate some virtual channels. SVN r1387 (trunk) --- docs/rh-log.txt | 1 + src/s_sound.cpp | 13 +++++++++---- src/sound/fmodsound.cpp | 5 +++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 59c60847a..3766ae7ed 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ January 31, 2009 +- Changed FMOD init() to allocate some virtual channels. - Fixed clipping in D3DFB::DrawTextureV() for good by using a scissor test. January 30, 2009 diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 07b1cb8c8..a978e5163 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -163,7 +163,8 @@ void S_NoiseDebug (void) screen->DrawText (SmallFont, CR_GOLD, 220, y, "vol", TAG_DONE); screen->DrawText (SmallFont, CR_GOLD, 260, y, "dist", TAG_DONE); screen->DrawText (SmallFont, CR_GOLD, 300, y, "chan", TAG_DONE); - screen->DrawText (SmallFont, CR_GOLD, 340, y, "flags", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 340, y, "pri", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 380, y, "flags", TAG_DONE); y += 8; if (Channels == NULL) @@ -231,6 +232,10 @@ void S_NoiseDebug (void) mysnprintf(temp, countof(temp), "%d", chan->EntChannel); screen->DrawText(SmallFont, color, 300, y, temp, TAG_DONE); + // Priority + mysnprintf(temp, countof(temp), "%d", chan->Priority); + screen->DrawText(SmallFont, color, 340, y, temp, TAG_DONE); + // Flags mysnprintf(temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE", (chan->ChanFlags & CHAN_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, @@ -241,7 +246,7 @@ void S_NoiseDebug (void) (chan->ChanFlags & CHAN_AREA) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK); - screen->DrawText(SmallFont, color, 340, y, temp, TAG_DONE); + screen->DrawText(SmallFont, color, 380, y, temp, TAG_DONE); y += 8; if (chan->PrevChan == &Channels) @@ -940,7 +945,7 @@ static FSoundChan *S_StartSound(AActor *actor, const sector_t *sec, const FPolyO // Select priority. if (type == SOURCE_None || actor == players[consoleplayer].camera) { - basepriority = 40; + basepriority = 80; } else { @@ -1664,7 +1669,7 @@ void S_EvictAllChannels() { S_StopChannel(chan); } - assert(chan->NextChan == next); +// assert(chan->NextChan == next); } } } diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 3bcc37144..0d1c5389b 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -805,7 +805,7 @@ bool FMODSoundRenderer::Init() } for (;;) { - result = Sys->init(snd_channels + NUM_EXTRA_SOFTWARE_CHANNELS, initflags, 0); + result = Sys->init(MAX(*snd_channels, MAX_CHANNELS), initflags, 0); if (result == FMOD_ERR_OUTPUT_CREATEBUFFER) { // Possible causes of a buffer creation failure: @@ -1435,7 +1435,7 @@ FISoundChannel *FMODSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener * GDistScale = distscale; // Experiments indicate that playSound will ignore priorities and always succeed - // as long as the paremeters are set properly. It will first try to kick out sounds + // as long as the parameters are set properly. It will first try to kick out sounds // with the same priority level but has no problem with kicking out sounds at // higher priority levels if it needs to. result = Sys->playSound(FMOD_CHANNEL_FREE, (FMOD::Sound *)sfx.data, true, &chan); @@ -1488,6 +1488,7 @@ FISoundChannel *FMODSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener * return NULL; } chan->setPaused(false); + chan->getPriority(&def_priority); FISoundChannel *schan = CommonChannelSetup(chan, reuse_chan); schan->Rolloff = *rolloff; return schan;