ScummVM API documentation
rebel_audio.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef SCUMM_INSANE_REBEL_AUDIO_H
23#define SCUMM_INSANE_REBEL_AUDIO_H
24
25#include "audio/mixer.h"
26#include "common/scummsys.h"
27#include "scumm/smush/saud.h"
28
29namespace Audio {
30class QueuingAudioStream;
31}
32
33namespace Scumm {
34
35class ScummEngine_v7;
36class SmushPlayer;
37
39public:
40 RebelAudio();
41
42 void init(ScummEngine_v7 *vm, int sampleRate);
43 void reset();
44 void terminate();
45 int sampleRate() const { return _sampleRate; }
46
47 void queueData(int trackIdx, const uint8 *data, int32 size, int volume, int pan, int sampleRate = 0);
48 void processFrame(SmushPlayer *player, int16 feedSize);
49 void setGroupVolume(SmushPlayer *player, int groupId, int volume);
50 void setGroupPan(SmushPlayer *player, int groupId, int pan);
51
52private:
53 static const int kMaxTracks = 4;
54
55 bool processAudioCodes(SmushPlayer *player, int idx, int32 &tmpFeedSize, int &mixVolume);
56 int computeMixVolume(SmushPlayer *player, int idx) const;
57 Audio::Mixer::SoundType getSoundType(int flags) const;
58 int getTrackPan(SmushPlayer *player, int idx) const;
59 void updateTrackMixerState(SmushPlayer *player, int idx);
60 void stopStream(int trackIdx);
61 void stopFadeStream(int trackIdx);
62 void queueData(int trackIdx, const uint8 *data, int32 size, int volume, int pan, int sampleRate, Audio::Mixer::SoundType soundType);
63 void queueFadeData(int trackIdx, const uint8 *data, int32 size, int volume, int pan, int sampleRate, Audio::Mixer::SoundType soundType);
64
65 ScummEngine_v7 *_vm;
66 Audio::QueuingAudioStream *_streams[kMaxTracks];
67 Audio::QueuingAudioStream *_fadeStreams[kMaxTracks];
68 Audio::SoundHandle _handles[kMaxTracks];
69 Audio::SoundHandle _fadeHandles[kMaxTracks];
70 bool _trackActive[kMaxTracks];
71 bool _fadeTrackActive[kMaxTracks];
72 Audio::Mixer::SoundType _streamTypes[kMaxTracks];
73 Audio::Mixer::SoundType _fadeStreamTypes[kMaxTracks];
74 SaudScript _scripts[kMaxTracks];
75 int _sampleRate;
76};
77
78} // End of namespace Scumm
79
80#endif
SoundType
Definition: mixer.h:73
Definition: audiostream.h:370
Definition: mixer.h:49
Definition: rebel_audio.h:38
Definition: saud.h:74
Definition: system.h:39
Definition: actor.h:30