aboutsummaryrefslogtreecommitdiff
path: root/sword2/sound.h
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-02-08 08:32:50 +0000
committerTorbjörn Andersson2005-02-08 08:32:50 +0000
commitfe3e01a11044ded5079412680c0e0b921c1e6b80 (patch)
tree28473536236c51084c1a9869e10c5a0ddb9204ef /sword2/sound.h
parentd6be4f03a7491530f5a2e944aa96c49855002b90 (diff)
downloadscummvm-rg350-fe3e01a11044ded5079412680c0e0b921c1e6b80.tar.gz
scummvm-rg350-fe3e01a11044ded5079412680c0e0b921c1e6b80.tar.bz2
scummvm-rg350-fe3e01a11044ded5079412680c0e0b921c1e6b80.zip
Now there are two file handles for the music: one for each CD. This is not
the same thing as one for each music stream. If both music streams are playing music from the same CD, they will both take turns at using the same file handle. The only case where both file handles are used is when music from one CD is fading in while music from the other CD is fading out. Which of course can only happen if you play the game from hard disk. If the game has to ask for the other CD, it kills the music immediately. The reason for doing this is that there was some concern about whether having two file handles open to the same file was portable or not. I don't think that question was ever fully answered, so I avoid the situation. svn-id: r16753
Diffstat (limited to 'sword2/sound.h')
-rw-r--r--sword2/sound.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/sword2/sound.h b/sword2/sound.h
index f38c106d8d..0d5c2371b5 100644
--- a/sword2/sound.h
+++ b/sword2/sound.h
@@ -31,6 +31,7 @@
#ifndef SOUND_H
#define SOUND_H
+#include "common/file.h"
#include "sound/audiostream.h"
#include "sound/mixer.h"
@@ -95,6 +96,7 @@ public:
class MusicInputStream : public AudioStream {
private:
int _cd;
+ File *_file;
uint32 _musicId;
AudioStream *_decoder;
int16 _buffer[BUFFER_SIZE];
@@ -117,7 +119,7 @@ private:
}
public:
- MusicInputStream(int cd, uint32 musicId, bool looping);
+ MusicInputStream(int cd, File *fp, uint32 musicId, bool looping);
~MusicInputStream();
int readBuffer(int16 *buffer, const int numSamples);
@@ -172,8 +174,10 @@ private:
int32 _loopingMusicId;
PlayingSoundHandle _soundHandleSpeech;
-
+
MusicInputStream *_music[MAXMUS];
+ File _musicFile[MAXMUS];
+
int16 *_mixBuffer;
int _mixBufferLen;
@@ -184,9 +188,9 @@ public:
// AudioStream API
int readBuffer(int16 *buffer, const int numSamples);
- bool isStereo() const;
+ bool isStereo() const { return false; }
bool endOfData() const;
- int getRate() const;
+ int getRate() const { return 22050; }
// End of AudioStream API
@@ -233,7 +237,7 @@ public:
int32 stopSpeech();
int32 streamCompMusic(uint32 musicId, bool loop);
- void stopMusic();
+ void stopMusic(bool immediately);
int32 musicTimeRemaining();
};