Skip to content

Commit

Permalink
Fix SE volume always being 100
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Aug 31, 2021
1 parent e5b4004 commit 67e5d8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/audio_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ bool GenericAudio::PlayOnChannel(SeChannel& chan, Filesystem_Stream::InputStream
chan.decoder = cache->CreateSeDecoder();
chan.decoder->SetPitch(pitch);
chan.decoder->SetFormat(output_format.frequency, output_format.format, output_format.channels);
chan.volume = volume;
chan.decoder->SetVolume(volume);
chan.paused = false; // Unpause channel -> Play it.
return true;
} else {
Expand Down Expand Up @@ -338,7 +338,7 @@ void GenericAudio::Decode(uint8_t* output_buffer, int buffer_length) {
if (currently_mixed_channel.stopped) {
currently_mixed_channel.decoder.reset();
} else {
volume = current_master_volume * (currently_mixed_channel.volume / 100.0);
volume = current_master_volume * (currently_mixed_channel.decoder->GetVolume() / 100.0);
currently_mixed_channel.decoder->GetFormat(frequency, sampleformat, channels);
samplesize = AudioDecoder::GetSamplesizeForFormat(sampleformat);

Expand Down
1 change: 0 additions & 1 deletion src/audio_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class GenericAudio : public AudioInterface {
struct SeChannel {
int id;
std::unique_ptr<AudioDecoderBase> decoder;
int volume;
bool paused;
bool stopped;
};
Expand Down

0 comments on commit 67e5d8f

Please sign in to comment.