~ubuntu-branches/ubuntu/raring/scummvm/raring

« back to all changes in this revision

Viewing changes to engines/queen/sound.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Moritz Muehlenhoff
  • Date: 2011-05-25 19:02:23 UTC
  • mto: (21.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: james.westby@ubuntu.com-20110525190223-fiqm0oaec714xk31
Tags: upstream-1.3.0
ImportĀ upstreamĀ versionĀ 1.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * along with this program; if not, write to the Free Software
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
20
 *
21
 
 * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/tags/release-1-2-1/engines/queen/sound.cpp $
22
 
 * $Id: sound.cpp 53025 2010-10-04 23:12:35Z agent-q $
 
21
 * $URL$
 
22
 * $Id$
23
23
 *
24
24
 */
25
25
 
26
26
 
27
27
#include "common/config-manager.h"
28
28
#include "common/endian.h"
29
 
#include "common/stream.h"
 
29
#include "common/memstream.h"
 
30
#include "common/textconsole.h"
30
31
 
31
32
#include "queen/sound.h"
32
33
#include "queen/input.h"
35
36
#include "queen/queen.h"
36
37
#include "queen/resource.h"
37
38
 
38
 
#include "sound/audiostream.h"
39
 
#include "sound/decoders/flac.h"
40
 
#include "sound/mididrv.h"
41
 
#include "sound/decoders/mp3.h"
42
 
#include "sound/decoders/raw.h"
43
 
#include "sound/decoders/vorbis.h"
 
39
#include "audio/audiostream.h"
 
40
#include "audio/decoders/flac.h"
 
41
#include "audio/mididrv.h"
 
42
#include "audio/decoders/mp3.h"
 
43
#include "audio/decoders/raw.h"
 
44
#include "audio/decoders/vorbis.h"
44
45
 
45
46
#define SB_HEADER_SIZE_V104 110
46
47
#define SB_HEADER_SIZE_V110 122
89
90
        bool endOfData() const {
90
91
                return _stream->endOfData();
91
92
        }
92
 
        bool endOfStream() {
 
93
        bool endOfStream() const {
93
94
                return _stream->endOfStream();
94
95
        }
95
96
        int getRate() const {
119
120
        MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
120
121
protected:
121
122
        void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
122
 
                Common::MemoryReadStream *tmp = f->readStream(size);
 
123
                Common::SeekableReadStream *tmp = f->readStream(size);
123
124
                assert(tmp);
124
125
                _mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeMP3Stream(tmp, DisposeAfterUse::YES)));
125
126
        }
132
133
        OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
133
134
protected:
134
135
        void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
135
 
                Common::MemoryReadStream *tmp = f->readStream(size);
 
136
                Common::SeekableReadStream *tmp = f->readStream(size);
136
137
                assert(tmp);
137
138
                _mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeVorbisStream(tmp, DisposeAfterUse::YES)));
138
139
        }
145
146
        FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
146
147
protected:
147
148
        void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
148
 
                Common::MemoryReadStream *tmp = f->readStream(size);
 
149
                Common::SeekableReadStream *tmp = f->readStream(size);
149
150
                assert(tmp);
150
151
                _mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeFLACStream(tmp, DisposeAfterUse::YES)));
151
152
        }
192
193
}
193
194
 
194
195
void Sound::setVolume(int vol) {
195
 
        _musicVolume = vol;
 
196
        if (ConfMan.hasKey("mute") && ConfMan.getBool("mute"))
 
197
                _musicVolume = 0;
 
198
        else
 
199
                _musicVolume = vol;
 
200
 
196
201
        _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _musicVolume);
197
 
        _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
198
 
        _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
199
202
}
200
203
 
201
204
void Sound::saveState(byte *&ptr) {