37 enum VoiceCallbackStatus
39 CALLBACK_STATUS_FINISH_WAVE,
40 CALLBACK_STATUS_CANCEL,
41 CALLBACK_STATUS_DROP_VOICE,
42 CALLBACK_STATUS_DROP_DSP,
46 SYNC_AX_SRC_INITIAL = (1 << 0),
47 SYNC_AX_VOICE = (1 << 1),
48 SYNC_AX_SRC = (1 << 2),
49 SYNC_AX_VE = (1 << 3),
50 SYNC_AX_MIX = (1 << 4),
51 SYNC_AX_LPF = (1 << 5),
52 SYNC_AX_REMOTE = (1 << 7),
53 SYNC_AX_BIQUAD = (1 << 8),
60 typedef void Callback(Voice *dropVoice, VoiceCallbackStatus status,
71 virtual void InvalidateData(
void const *,
void const *) {}
72 virtual void InvalidateWaveData(
void const *start,
void const *end);
75 void Setup(
WaveInfo const &waveParam, ulong startOffset);
77 int GetPriority()
const {
return mPriority; }
79 void SetVoiceOutParam(
int voiceOutIndex,
81 void SetVoiceOutParamPitchDisableFlag(
bool flag)
83 mVoiceOutParamPitchDisableFlag = flag;
85 void SetRemoteFilter(
int filter);
86 void SetBiquadFilter(
int type, f32 value);
87 void SetPriority(
int priority);
89 void SetSurroundPan(f32 surroundPan);
90 void SetLpfFreq(f32 lpfFreq);
91 void SetOutputLine(
int flag);
92 void SetMainOutVolume(f32 volume);
93 void SetMainSend(f32 send);
94 void SetFxSend(AuxBus bus, f32 send);
95 void SetRemoteOutVolume(
int remote, f32 volume);
96 void SetPitch(f32 pitch);
97 void SetVolume(f32 volume);
98 void SetVeVolume(f32 targetVolume, f32 initVolume);
99 void SetPanMode(PanMode panMode);
100 void SetPanCurve(PanCurve panCurve);
102 bool IsActive()
const {
return mAxVoice[0][0] !=
nullptr; }
103 bool IsPlayFinished()
const
105 return IsActive() && mAxVoice[0][0]->IsPlayFinished();
109 return IsActive() && mAxVoice[0][0]->IsRun();
111 SampleFormat GetFormat()
const;
112 ulong GetCurrentPlayingSample()
const;
113 int GetPhysicalVoiceCount()
const
115 return mChannelCount * mVoiceOutCount;
118 void SetVoiceType(AxVoice::VoiceType type);
119 void SetLoopFlag(
bool loopFlag);
120 void SetLoopStart(
int channelIndex,
void const *baseAddress,
122 void SetLoopEnd(
int channelIndex,
void const *baseAddress, ulong samples);
125 bool Acquire(
int channelCount,
int voiceOutCount,
int priority,
126 Callback *callback,
void *callbackData);
129 void InitParam(
int channelCount,
int voiceOutCount, Callback *callback,
133 void Pause(
bool flag);
135 void StopAtPoint(
int channelIndex,
void const *baseAddress,
139 void RunAllAxVoice();
140 void StopAllAxVoice();
145 void CalcAxSrc(
bool initialUpdate);
149 void CalcAxBiquadFilter();
150 void CalcAxRemoteFilter();
152 void CalcMixParam(
int channelIndex,
int voiceOutIndex,
157 void UpdateVoicesPriority();
161 void TransformDpl2Pan(f32 *outPan, f32 *outSurroundPan, f32 inPan,
164 static void AxVoiceCallbackFunc(
AxVoice *dropVoice,
165 AxVoice::AxVoiceCallbackStatus status,
170 static f32
const SURROUND_ATTENUATED_DB;
171 static ulong
const VOICE_PRIORITY_RELEASE;
172 static ulong
const VOICE_PRIORITY_ALLOC;
173 static ulong
const VOICE_PRIORITY_USE;
174 static int const VOICE_PRIORITY_FREE;
175 static ulong
const VOICE_PRIORITY_NODROP;
176 static ulong
const VOICE_PRIORITY_MAX = 31;
177 static int const PRIORITY_RELEASE;
178 static int const PRIORITY_NODROP;
179 static int const PRIORITY_MIN = 0;
180 static int const PRIORITY_MAX = 255;
181 static int const REMOTE_FILTER_MAX = 127;
182 static int const REMOTE_FILTER_MIN = 0;
183 static f32
const SEND_MAX;
184 static f32
const SEND_MIN;
185 static f32
const BIQUAD_VALUE_MAX;
186 static f32
const BIQUAD_VALUE_MIN;
187 static f32
const CUTOFF_FREQ_MAX;
188 static f32
const CUTOFF_FREQ_MIN;
189 static f32
const SPAN_CENTER;
190 static f32
const SPAN_REAR;
191 static f32
const SPAN_FRONT;
192 static f32
const PAN_CENTER;
193 static f32
const PAN_RIGHT;
194 static f32
const PAN_LEFT;
195 static f32
const VOLUME_MAX;
196 static f32
const VOLUME_MIN;
197 static int const CHANNEL_MAX = 2;
198 static int const UPDATE_BIQUAD = 1 << 8;
199 static int const UPDATE_REMOTE_FILTER = 1 << 7;
201 static int const UPDATE_LPF = 1 << 5;
202 static int const UPDATE_MIX = 1 << 4;
203 static int const UPDATE_VE = 1 << 3;
204 static int const UPDATE_SRC = 1 << 2;
205 static int const UPDATE_PAUSE = 1 << 1;
206 static int const UPDATE_START = 1 << 0;
211 AxVoice *mAxVoice[CHANNEL_MAX][4];
222 bool mVoiceOutParamPitchDisableFlag;
235 f32 mFxSend[AUX_BUS_NUM];
236 f32 mRemoteOutVolume[4];
248 friend class VoiceManager;