Update effect API to include sample count info

This commit is contained in:
Jack Andersen 2016-05-09 16:29:51 -10:00
parent 08a4c5d7a8
commit f86b9706d4
2 changed files with 9 additions and 6 deletions

View File

@ -39,9 +39,12 @@ struct IAudioSubmixCallback
virtual bool canApplyEffect() const=0; virtual bool canApplyEffect() const=0;
/** Client-provided effect solution for interleaved, master sample-rate audio */ /** Client-provided effect solution for interleaved, master sample-rate audio */
virtual void applyEffect(int16_t* audio, const ChannelMap& chanMap, double sampleRate) const=0; virtual void applyEffect(int16_t* audio, size_t frameCount,
virtual void applyEffect(int32_t* audio, const ChannelMap& chanMap, double sampleRate) const=0; const ChannelMap& chanMap, double sampleRate) const=0;
virtual void applyEffect(float* audio, const ChannelMap& chanMap, double sampleRate) const=0; virtual void applyEffect(int32_t* audio, size_t frameCount,
const ChannelMap& chanMap, double sampleRate) const=0;
virtual void applyEffect(float* audio, size_t frameCount,
const ChannelMap& chanMap, double sampleRate) const=0;
}; };
} }

View File

@ -39,7 +39,7 @@ void AudioSubmix::_pumpAndMixVoices(size_t frames, int16_t* dataOut)
/* Apply submix effect (if available) */ /* Apply submix effect (if available) */
if (m_cb && m_cb->canApplyEffect()) if (m_cb && m_cb->canApplyEffect())
m_cb->applyEffect(m_scratch16.data(), info.m_channelMap, info.m_sampleRate); m_cb->applyEffect(m_scratch16.data(), frames, info.m_channelMap, info.m_sampleRate);
/* Merge into output mix */ /* Merge into output mix */
auto it = m_scratch16.begin(); auto it = m_scratch16.begin();
@ -72,7 +72,7 @@ void AudioSubmix::_pumpAndMixVoices(size_t frames, int32_t* dataOut)
/* Apply submix effect (if available) */ /* Apply submix effect (if available) */
if (m_cb && m_cb->canApplyEffect()) if (m_cb && m_cb->canApplyEffect())
m_cb->applyEffect(m_scratch32.data(), info.m_channelMap, info.m_sampleRate); m_cb->applyEffect(m_scratch32.data(), frames, info.m_channelMap, info.m_sampleRate);
/* Merge into output mix */ /* Merge into output mix */
auto it = m_scratch32.begin(); auto it = m_scratch32.begin();
@ -105,7 +105,7 @@ void AudioSubmix::_pumpAndMixVoices(size_t frames, float* dataOut)
/* Apply submix effect (if available) */ /* Apply submix effect (if available) */
if (m_cb && m_cb->canApplyEffect()) if (m_cb && m_cb->canApplyEffect())
m_cb->applyEffect(m_scratchFlt.data(), info.m_channelMap, info.m_sampleRate); m_cb->applyEffect(m_scratchFlt.data(), frames, info.m_channelMap, info.m_sampleRate);
/* Merge into output mix */ /* Merge into output mix */
auto it = m_scratchFlt.begin(); auto it = m_scratchFlt.begin();