22 #ifndef DIRECTOR_SOUND_H 23 #define DIRECTOR_SOUND_H 25 #include "audio/mixer.h" 31 class RewindableAudioStream;
32 class LoopableAudioStream;
51 FadeParams(
int sv,
int tv,
int tt,
int st,
bool f) :
52 startVol(sv), targetVol(tv), totalTicks(tt), startTicks(st), lapsedTicks(0), fadeIn(f) {}
55 const uint16 kMinSampledMenu = 10;
56 const uint16 kMaxSampledMenu = 15;
57 const uint16 kNumSampledMenus = kMaxSampledMenu - kMinSampledMenu + 1;
65 : menu(menuID), submenu(submenuID) {}
68 return menu == b.menu && submenu == b.submenu;
98 SoundID(SoundIDType type_,
int a,
int b) {
107 u.external.submenu = b;
112 u.cast.member = memberID.member;
113 u.cast.castLib = memberID.castLib;
116 bool operator==(
const SoundID &b) {
122 return u.cast.member == b.u.cast.member && u.cast.castLib == b.u.cast.castLib;
124 return u.external.menu == b.u.external.menu && u.external.submenu == b.u.external.submenu;
129 bool operator!=(
const SoundID &b) {
130 return !(*
this == b);
153 SoundChannel(): handle(), lastPlayedSound(
SoundID()), stopOnZero(
true), volume(255), fade(
nullptr), puppet(
SoundID()), newPuppet(
false), movieChanged(
false), loopPtr(
nullptr) {}
183 void playSound(
SoundID soundId, uint8 soundChannel,
bool forPuppet =
false);
184 void playCastMember(
CastMemberID memberID, uint8 soundChannel,
bool forPuppet =
false);
185 void playExternalSound(uint16 menu, uint16 submenu, uint8 soundChannel);
187 void playFPlaySound();
188 void setSoundEnabled(
bool enabled);
190 void changingMovie();
192 void loadSampleSounds(uint type);
193 void unloadSampleSounds();
195 bool isChannelPuppet(uint8 soundChannel);
196 void setPuppetSound(
SoundID soundId, uint8 soundChannel);
197 void playPuppetSound(uint8 soundChannel);
199 bool getSoundEnabled() {
return _enable; }
203 void registerFade(uint8 soundChannel,
bool fadeIn,
int ticks);
206 bool isChannelActive(uint8 soundChannel);
207 uint8 getChannelVolume(uint8 soundChannel);
208 void setChannelVolume(
int channel, uint8 volume);
209 void stopSound(uint8 soundChannel);
211 void setChannelDefaultVolume(
int soundChannel);
214 void setLastPlayedSound(uint8 soundChannel,
SoundID soundId,
bool stopOnZero =
true);
215 bool isLastPlayedSound(uint8 soundChannel,
const SoundID &soundId);
216 bool shouldStopOnZero(uint8 soundChannel);
218 void setChannelVolumeInternal(uint8 soundChannel, uint8 volume);
219 bool assertChannel(
int soundChannel);
220 void cancelFade(uint8 soundChannel);
228 virtual Audio::AudioStream *getAudioStream(
bool looping =
false,
bool forPuppet =
false, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES) {
return nullptr; }
240 Audio::AudioStream *getAudioStream(
bool looping =
false,
bool forPuppet =
false, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES)
override;
241 bool hasLoopBounds();
242 void resetLoopBounds();
243 bool hasValidLoopBounds();
262 Audio::AudioStream *getAudioStream(
bool looping =
false,
bool forPuppet =
false, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES)
override;
Definition: audiostream.h:123
Definition: macresman.h:125
Definition: algorithm.h:29
Definition: audiostream.h:50