aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/sound.cpp8
-rw-r--r--simon/sound.cpp2
-rw-r--r--sound/mixer.cpp32
-rw-r--r--sound/mixer.h6
4 files changed, 27 insertions, 21 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 1baa2f84b2..e720f081f2 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -917,7 +917,7 @@ void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle)
playSfxSound_Vorbis(data, file_size, handle);
} else {
#ifdef USE_MAD
- _scumm->_mixer->playMP3(handle, file, file_size);
+ _scumm->_mixer->playMP3(handle, file, file_size, 255, 0);
#endif
}
return;
@@ -1473,7 +1473,7 @@ void Sound::playSfxSound_Vorbis(void *sound, uint32 size, PlayingSoundHandle *ha
delete f;
free(sound);
} else
- _scumm->_mixer->playVorbis(handle, ov_file, 0, false);
+ _scumm->_mixer->playVorbis(handle, ov_file, 0, false, 255, 0);
#endif
}
@@ -1750,7 +1750,7 @@ int MP3TrackInfo::play(SoundMixer *mixer, PlayingSoundHandle *handle, int startF
}
// Play it
- return mixer->playMP3CDTrack(handle, _file, durationTime);
+ return mixer->playMP3CDTrack(handle, _file, durationTime, 255, 0);
}
MP3TrackInfo::~MP3TrackInfo() {
@@ -1854,7 +1854,7 @@ int VorbisTrackInfo::play(SoundMixer *mixer, PlayingSoundHandle *handle, int sta
#endif
return mixer->playVorbis(handle, &_ov_file,
duration * ov_info(&_ov_file, -1)->rate / 75,
- true);
+ true, 255, 0);
}
VorbisTrackInfo::~VorbisTrackInfo() {
diff --git a/simon/sound.cpp b/simon/sound.cpp
index 98a0cbd05e..4651157458 100644
--- a/simon/sound.cpp
+++ b/simon/sound.cpp
@@ -245,7 +245,7 @@ int MP3Sound::playSound(uint sound, PlayingSoundHandle *handle, byte flags)
uint32 size = _offsets[sound+1] - _offsets[sound];
- return _mixer->playMP3(handle, _file, size);
+ return _mixer->playMP3(handle, _file, size, 255, 0);
}
#endif
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index b6b3a5d665..a032060eef 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -52,7 +52,7 @@ public:
int _id;
Channel(SoundMixer *mixer, PlayingSoundHandle *handle)
- : _mixer(mixer), _handle(handle), _converter(0), _input(0), _paused(false), _id(-1) {
+ : _mixer(mixer), _handle(handle), _converter(0), _input(0), _volume(0), _pan(0), _paused(false), _id(-1) {
assert(mixer);
}
virtual ~Channel();
@@ -97,13 +97,13 @@ public:
#ifdef USE_MAD
class ChannelMP3 : public Channel {
public:
- ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size);
+ ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size, byte volume, int8 pan);
bool isMusicChannel() const { return false; }
};
class ChannelMP3CDMusic : public Channel {
public:
- ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration);
+ ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan);
bool isMusicChannel() const { return true; }
};
#endif // USE_MAD
@@ -112,7 +112,7 @@ public:
class ChannelVorbis : public Channel {
bool _is_cd_track;
public:
- ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track);
+ ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track, byte volume, int8 pan);
bool isMusicChannel() const { return _is_cd_track; }
};
#endif // USE_VORBIS
@@ -243,20 +243,20 @@ int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, ui
}
#ifdef USE_MAD
-int SoundMixer::playMP3(PlayingSoundHandle *handle, File *file, uint32 size) {
+int SoundMixer::playMP3(PlayingSoundHandle *handle, File *file, uint32 size, byte volume, int8 pan) {
StackLock lock(_mutex);
- return insertChannel(handle, new ChannelMP3(this, handle, file, size));
+ return insertChannel(handle, new ChannelMP3(this, handle, file, size, volume, pan));
}
-int SoundMixer::playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration) {
+int SoundMixer::playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan) {
StackLock lock(_mutex);
- return insertChannel(handle, new ChannelMP3CDMusic(this, handle, file, duration));
+ return insertChannel(handle, new ChannelMP3CDMusic(this, handle, file, duration, volume, pan));
}
#endif
#ifdef USE_VORBIS
-int SoundMixer::playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track) {
+int SoundMixer::playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track, byte volume, int8 pan) {
StackLock lock(_mutex);
- return insertChannel(handle, new ChannelVorbis(this, handle, ov_file, duration, is_cd_track));
+ return insertChannel(handle, new ChannelVorbis(this, handle, ov_file, duration, is_cd_track, volume, pan));
}
#endif
@@ -578,8 +578,10 @@ void ChannelStream::mix(int16 *data, uint len) {
}
#ifdef USE_MAD
-ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size)
+ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size, byte volume, int8 pan)
: Channel(mixer, handle) {
+ _volume = volume;
+ _pan = pan;
// Create the input stream
_input = makeMP3Stream(file, mad_timer_zero, size);
@@ -587,8 +589,10 @@ ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file
_converter = makeRateConverter(_input->getRate(), mixer->getOutputRate(), _input->isStereo());
}
-ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration)
+ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan)
: Channel(mixer, handle) {
+ _volume = volume;
+ _pan = pan;
// Create the input stream
_input = makeMP3Stream(file, duration, 0);
@@ -598,8 +602,10 @@ ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *hand
#endif // USE_MAD
#ifdef USE_VORBIS
-ChannelVorbis::ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track)
+ChannelVorbis::ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track, byte volume, int8 pan)
: Channel(mixer, handle) {
+ _volume = volume;
+ _pan = pan;
// Create the input stream
_input = makeVorbisStream(ov_file, duration);
diff --git a/sound/mixer.h b/sound/mixer.h
index d139a2fcef..fba5917fd0 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -85,11 +85,11 @@ public:
int playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags,
byte volume, int8 pan, int id = -1, uint32 loopStart = 0, uint32 loopEnd = 0);
#ifdef USE_MAD
- int playMP3(PlayingSoundHandle *handle, File *file, uint32 size);
- int playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration);
+ int playMP3(PlayingSoundHandle *handle, File *file, uint32 size, byte volume, int8 pan);
+ int playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan);
#endif
#ifdef USE_VORBIS
- int playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track);
+ int playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track, byte volume, int8 pan);
#endif
/** Premix procedure, useful when using fmopl adlib */