diff options
author | Tim Angus <tim@ngus.net> | 2009-10-03 15:17:16 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:38 +0000 |
commit | 6d2ffb4c637a49983bc6ce22b68ccec0ed09e0f4 (patch) | |
tree | ff15343e4a2ae5a2512c1c21e05a3821a46f10da /src/client/snd_dma.c | |
parent | e9e52d0b7ec9bae071534df7581126d69d3e9bf8 (diff) |
* Merge ioq3-r1637
Diffstat (limited to 'src/client/snd_dma.c')
-rw-r--r-- | src/client/snd_dma.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/client/snd_dma.c b/src/client/snd_dma.c index a418733a..c8df2daf 100644 --- a/src/client/snd_dma.c +++ b/src/client/snd_dma.c @@ -1369,17 +1369,13 @@ void S_UpdateBackgroundTrack( void ) { byte raw[30000]; // just enough to fit in a mac stack frame int fileBytes; int r; - static float musicVolume = 0.5f; if(!s_backgroundStream) { return; } - // graeme see if this is OK - musicVolume = (musicVolume + (s_musicVolume->value * 2))/4.0f; - // don't bother playing anything if musicvolume is 0 - if ( musicVolume <= 0 ) { + if ( s_musicVolume->value <= 0 ) { return; } @@ -1394,6 +1390,9 @@ void S_UpdateBackgroundTrack( void ) { // decide how much data needs to be read from the file fileSamples = bufferSamples * s_backgroundStream->info.rate / dma.speed; + if (!fileSamples) + return; + // our max buffer size fileBytes = fileSamples * (s_backgroundStream->info.width * s_backgroundStream->info.channels); if ( fileBytes > sizeof(raw) ) { @@ -1413,7 +1412,7 @@ void S_UpdateBackgroundTrack( void ) { { // add to raw buffer S_Base_RawSamples( 0, fileSamples, s_backgroundStream->info.rate, - s_backgroundStream->info.width, s_backgroundStream->info.channels, raw, musicVolume ); + s_backgroundStream->info.width, s_backgroundStream->info.channels, raw, s_musicVolume->value ); } else { |