22 #ifndef ULTIMA8_AUDIO_AUDIOPROCESS_H 23 #define ULTIMA8_AUDIO_AUDIOPROCESS_H 25 #include "ultima/ultima8/kernel/process.h" 26 #include "ultima/ultima8/usecode/intrinsics.h" 27 #include "ultima/shared/std/string.h" 28 #include "ultima/ultima8/misc/classtype.h" 38 static const uint32 PITCH_SHIFT_NONE;
47 uint32 _curSpeechStart, _curSpeechEnd;
55 SampleInfo(int32 s, int32 p, ObjId o, int32 l, int32 c, uint32 ps, uint16 v, int16 cv, int8 bal,
bool ambient) :
56 _sfxNum(s), _priority(p), _objId(o), _loops(l), _channel(c),
57 _pitchShift(ps), _volume(v), _calcVol(cv), _balance(bal),
58 _curSpeechStart(0), _curSpeechEnd(0), _ambient(ambient) { }
60 uint32 s, uint32 e, uint32 ps, uint16 v, int16 cv, int8 bal,
bool ambient) :
61 _sfxNum(-1), _priority(shpnum), _objId(o), _loops(0), _channel(c), _barked(b),
62 _curSpeechStart(s), _curSpeechEnd(e), _pitchShift(ps), _volume(v),
63 _calcVol(cv), _balance(bal), _ambient(ambient) { }
69 ENABLE_RUNTIME_CLASSTYPE()
76 return _theAudioProcess;
80 INTRINSIC(I_playAmbientSFX);
81 INTRINSIC(I_playSFXCru);
82 INTRINSIC(I_playAmbientSFXCru);
83 INTRINSIC(I_isSFXPlaying);
84 INTRINSIC(I_isSFXPlayingForObject);
85 INTRINSIC(I_setVolumeSFX);
86 INTRINSIC(I_setVolumeForObjectSFX);
88 INTRINSIC(I_stopSFXCru);
89 INTRINSIC(I_stopAllSFX);
93 void playSFX(
int sfxNum,
int priority, ObjId objId,
int loops,
94 bool no_duplicates, uint32 pitchShift,
95 uint16 volume, int16 calcVol, int8 balance,
98 void playSFX(
int sfxNum,
int priority, ObjId objId,
int loops,
99 bool no_duplicates =
false, uint32 pitchShift = PITCH_SHIFT_NONE,
100 uint16 volume = 0x80,
bool ambient =
false) {
101 playSFX(sfxNum, priority, objId, loops, no_duplicates, pitchShift, volume, -1, 0, ambient);
105 void stopSFX(
int sfxNum, ObjId objId);
106 bool isSFXPlaying(
int sfxNum);
107 bool isSFXPlayingForObject(
int sfxNum, ObjId objId);
108 void setVolumeSFX(
int sfxNum, uint8 volume);
109 void setVolumeForObjectSFX(ObjId objId,
int sfxNum, uint8 volume);
111 bool playSpeech(
const Std::string &barked,
int shapenum, ObjId objId,
112 uint32 pitchShift = PITCH_SHIFT_NONE, uint16 volume = 255);
113 void stopSpeech(
const Std::string &barked,
int shapenum, ObjId objId);
114 bool isSpeechPlaying(
const Std::string &barked,
int shapenum);
122 uint32 pitchShift = PITCH_SHIFT_NONE, int16 volume = 255,
123 int8 balance = 0,
bool ambient =
false);
144 bool calculateSoundVolume(ObjId objId, int16 &volume, int8 &balance)
const;
void saveData(Common::WriteStream *ws) override
save Process data
Definition: audio_process.h:35
uint32 getSpeechLength(const Std::string &barked, int shapenum) const
get length (in milliseconds) of speech
int playSample(AudioSample *sample, int priority, int loops, bool isSpeech=false, uint32 pitchShift=PITCH_SHIFT_NONE, int16 volume=255, int8 balance=0, bool ambient=false)
Definition: detection.h:27
void pauseAllSamples()
pause all currently playing samples
Definition: containers.h:200
void unpauseAllSamples()
unpause all currently playing samples
void stopSFX(int sfxNum, ObjId objId)
stop sfx on object. set sfxNum = -1 to stop all for object.
Definition: audio_sample.h:32
static AudioProcess * get_instance()
Get the current instance of the Audio Processes.
Definition: audio_process.h:75
void stopAllExceptSpeech()
stop all samples except speech
Definition: audio_process.h:40