fix sound bug caused by recent sound commit
This commit is contained in:
parent
8c022f2e00
commit
2ef1e983c0
1 changed files with 14 additions and 20 deletions
|
@ -216,10 +216,6 @@ static int MixSampleToStereo32(Sample* sample,int index,unsigned char volume,
|
|||
* sample->Channels);
|
||||
|
||||
local_volume = (int)volume * GlobalVolume / MaxVolume;
|
||||
if (local_volume < 32) {
|
||||
// minimum volume
|
||||
local_volume = 32;
|
||||
}
|
||||
|
||||
if (stereo < 0) {
|
||||
left = 128;
|
||||
|
@ -231,8 +227,6 @@ static int MixSampleToStereo32(Sample* sample,int index,unsigned char volume,
|
|||
|
||||
Assert(!(index & 1));
|
||||
|
||||
memset(buffer, 0, size * 4);
|
||||
|
||||
if (size >= (sample->Len - index) * div / 2) {
|
||||
size = (sample->Len - index) * div / 2;
|
||||
}
|
||||
|
@ -526,20 +520,19 @@ static int FillOneChannel(SoundRequest* sr)
|
|||
int old_free;
|
||||
|
||||
old_free = NextFreeChannel;
|
||||
if (NextFreeChannel < MaxChannels) {
|
||||
next_free = Channels[NextFreeChannel].Point;
|
||||
Channels[NextFreeChannel].Source = sr->Source;
|
||||
Channels[NextFreeChannel].Point = 0;
|
||||
Channels[NextFreeChannel].Volume = ComputeVolume(sr);
|
||||
Channels[NextFreeChannel].Command = ChannelPlay;
|
||||
Channels[NextFreeChannel].Sound = sr->Sound;
|
||||
Channels[NextFreeChannel].Sample = ChooseSample(sr);
|
||||
Channels[NextFreeChannel].Stereo = sr->Stereo;
|
||||
NextFreeChannel = next_free;
|
||||
} else {
|
||||
// should not happen
|
||||
DebugPrint("***** NO FREE CHANNEL *****\n");
|
||||
}
|
||||
|
||||
Assert(NextFreeChannel < MaxChannels);
|
||||
|
||||
next_free = Channels[NextFreeChannel].Point;
|
||||
Channels[NextFreeChannel].Source = sr->Source;
|
||||
Channels[NextFreeChannel].Point = 0;
|
||||
Channels[NextFreeChannel].Volume = ComputeVolume(sr);
|
||||
Channels[NextFreeChannel].Command = ChannelPlay;
|
||||
Channels[NextFreeChannel].Sound = sr->Sound;
|
||||
Channels[NextFreeChannel].Sample = ChooseSample(sr);
|
||||
Channels[NextFreeChannel].Stereo = sr->Stereo;
|
||||
NextFreeChannel = next_free;
|
||||
|
||||
return old_free;
|
||||
}
|
||||
|
||||
|
@ -574,6 +567,7 @@ static void FillChannels(int free_channels,int* discarded,int* started)
|
|||
(*discarded)++;
|
||||
}
|
||||
if(NextSoundRequestOut >= MAX_SOUND_REQUESTS) {
|
||||
Assert(1);
|
||||
NextSoundRequestOut = 0;
|
||||
}
|
||||
sr = SoundRequests + NextSoundRequestOut;
|
||||
|
|
Loading…
Add table
Reference in a new issue