22 #ifndef DIRECTOR_SOUND_H 23 #define DIRECTOR_SOUND_H 25 #include "audio/mixer.h" 31 class RewindableAudioStream;
32 class LoopableAudioStream;
52 FadeParams(
int sv,
int tv,
int tt,
int st,
bool f,
bool as) :
53 startVol(sv), targetVol(tv), totalTicks(tt), startTicks(st), lapsedTicks(0), fadeIn(f), autoStop(as) {}
56 const uint16 kMinSampledMenu = 10;
57 const uint16 kMaxSampledMenu = 15;
58 const uint16 kNumSampledMenus = kMaxSampledMenu - kMinSampledMenu + 1;
66 : menu(menuID), submenu(submenuID) {}
69 return menu == b.menu && submenu == b.submenu;
99 SoundID(SoundIDType type_,
int a,
int b) {
108 u.external.submenu = b;
113 u.cast.member = memberID.member;
114 u.cast.castLib = memberID.castLib;
117 bool operator==(
const SoundID &b) {
123 return u.cast.member == b.u.cast.member && u.cast.castLib == b.u.cast.castLib;
125 return u.external.menu == b.u.external.menu && u.external.submenu == b.u.external.submenu;
130 bool operator!=(
const SoundID &b) {
131 return !(*
this == b);
134 if (type == kSoundCast)
135 return u.cast.member == 0;
145 int pitchShiftPercent;
161 SoundChannel(): handle(), lastPlayedSound(
SoundID()), stopOnZero(
true), volume(255), originalRate(-1), pitchShiftPercent(100), fade(
nullptr), puppet(
SoundID()), newPuppet(
false), movieChanged(
false), loopPtr(
nullptr) {}
190 void playSound(
SoundID soundId,
int soundChannel,
bool forPuppet =
false);
191 void playCastMember(
CastMemberID memberID,
int soundChannel,
bool forPuppet =
false);
192 void playExternalSound(uint16 menu, uint16 submenu,
int soundChannel);
194 void playFPlaySound();
195 void setSoundEnabled(
bool enabled);
197 void changingMovie();
199 void loadSampleSounds(uint type);
200 void unloadSampleSounds();
202 bool isChannelPuppet(
int soundChannel);
203 void setPuppetSound(
SoundID soundId,
int soundChannel);
204 void disablePuppetSound(
int soundChannel);
205 void playPuppetSound(
int soundChannel);
207 bool getSoundEnabled() {
return _enable; }
211 void registerFade(
int soundChannel,
int startVol,
int targetVol,
int ticks,
bool autoStop =
false);
212 void registerFade(
int soundChannel,
bool fadeIn,
int ticks,
bool autoStop =
false);
215 bool isChannelActive(
int soundChannel);
216 uint8 getChannelVolume(
int soundChannel);
217 void setChannelVolume(
int channel, uint8 volume);
218 int8 getChannelBalance(
int soundChannel);
219 void setChannelBalance(
int soundChannel, int8 balance);
220 uint8 getChannelFaderL(
int soundChannel);
221 void setChannelFaderL(
int soundChannel, uint8 faderL);
222 uint8 getChannelFaderR(
int soundChannel);
223 void setChannelFaderR(
int soundChannel, uint8 faderR);
224 void stopSound(
int soundChannel);
226 void setChannelDefaultVolume(
int soundChannel);
227 void setChannelPitchShift(
int soundChannel,
int pitchShiftPercent);
230 void setLastPlayedSound(
int soundChannel,
SoundID soundId,
bool stopOnZero =
true);
231 bool isLastPlayedSound(
int soundChannel,
const SoundID &soundId);
232 bool shouldStopOnZero(
int soundChannel);
234 void setChannelVolumeInternal(
int soundChannel, uint8 volume);
235 bool assertChannel(
int soundChannel);
236 void cancelFade(
int soundChannel);
244 virtual Audio::AudioStream *getAudioStream(
bool looping =
false,
bool forPuppet =
false, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES) {
return nullptr; }
245 virtual int getChannelCount() {
return 0; }
246 virtual int getSampleRate() {
return 0; }
247 virtual int getSampleSize() {
return 0; }
259 Audio::AudioStream *getAudioStream(
bool looping =
false,
bool forPuppet =
false, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES)
override;
260 bool hasLoopBounds();
261 void resetLoopBounds();
262 bool hasValidLoopBounds();
263 int getChannelCount()
override {
return _channels; }
264 int getSampleRate()
override {
return _rate; }
265 int getSampleSize()
override {
return _bits; }
285 Audio::AudioStream *getAudioStream(
bool looping =
false,
bool forPuppet =
false, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES)
override;
Definition: audiostream.h:123
Definition: macresman.h:126
Definition: algorithm.h:29
Definition: audiostream.h:50