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 "common/str.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);
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 Common::String &barked,
int shapenum, ObjId objId,
112 uint32 pitchShift = PITCH_SHIFT_NONE, uint16 volume = 255);
113 void stopSpeech(
const Common::String &barked,
int shapenum, ObjId objId);
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;
Definition: audio_process.h:35
void stopSFX(int sfxNum, ObjId objId)
stop sfx on object. set sfxNum = -1 to stop all for object.
uint32 getSpeechLength(const Common::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)
void saveData(Common::WriteStream *ws) override
save Process data
static AudioProcess * get_instance()
Get the current instance of the Audio Processes.
Definition: audio_process.h:75
void unpauseAllSamples()
unpause all currently playing samples
void stopAllExceptSpeech()
stop all samples except speech
void pauseAllSamples()
pause all currently playing samples
Definition: audio_sample.h:34
Definition: audio_process.h:40