mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-19 18:05:26 +00:00
Object tracker list refactor; add object tracker to audio system
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "AudioVoice.hpp"
|
||||
#include "AudioSubmix.hpp"
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
|
||||
namespace boo
|
||||
{
|
||||
@@ -21,8 +22,9 @@ protected:
|
||||
friend class AudioVoiceStereo;
|
||||
float m_totalVol = 1.f;
|
||||
AudioVoiceEngineMixInfo m_mixInfo;
|
||||
std::list<AudioVoice*> m_activeVoices;
|
||||
std::list<AudioSubmix*> m_activeSubmixes;
|
||||
std::recursive_mutex m_dataMutex;
|
||||
AudioVoice* m_voiceHead = nullptr;
|
||||
AudioSubmix* m_submixHead = nullptr;
|
||||
size_t m_5msFrames = 0;
|
||||
IAudioVoiceEngineCallback* m_engineCallback = nullptr;
|
||||
|
||||
@@ -31,29 +33,28 @@ protected:
|
||||
std::vector<int16_t> m_scratch16Pre;
|
||||
std::vector<int32_t> m_scratch32Pre;
|
||||
std::vector<float> m_scratchFltPre;
|
||||
template <typename T> std::vector<T>& _getScratchPre();
|
||||
std::vector<int16_t> m_scratch16Post;
|
||||
std::vector<int32_t> m_scratch32Post;
|
||||
std::vector<float> m_scratchFltPost;
|
||||
template <typename T> std::vector<T>& _getScratchPost();
|
||||
|
||||
/* LtRt processing if enabled */
|
||||
std::unique_ptr<LtRtProcessing> m_ltRtProcessing;
|
||||
std::vector<int16_t> m_ltRtIn16;
|
||||
std::vector<int32_t> m_ltRtIn32;
|
||||
std::vector<float> m_ltRtInFlt;
|
||||
template <typename T> std::vector<T>& _getLtRtIn();
|
||||
|
||||
AudioSubmix m_mainSubmix;
|
||||
std::unique_ptr<AudioSubmix> m_mainSubmix;
|
||||
std::list<AudioSubmix*> m_linearizedSubmixes;
|
||||
bool m_submixesDirty = true;
|
||||
|
||||
void _pumpAndMixVoices(size_t frames, int16_t* dataOut);
|
||||
void _pumpAndMixVoices(size_t frames, int32_t* dataOut);
|
||||
void _pumpAndMixVoices(size_t frames, float* dataOut);
|
||||
|
||||
void _unbindFrom(std::list<AudioVoice*>::iterator it);
|
||||
void _unbindFrom(std::list<AudioSubmix*>::iterator it);
|
||||
template <typename T>
|
||||
void _pumpAndMixVoices(size_t frames, T* dataOut);
|
||||
|
||||
public:
|
||||
BaseAudioVoiceEngine() : m_mainSubmix(*this, nullptr, -1, false) {}
|
||||
BaseAudioVoiceEngine() : m_mainSubmix(std::make_unique<AudioSubmix>(*this, nullptr, -1, false)) {}
|
||||
~BaseAudioVoiceEngine();
|
||||
std::unique_ptr<IAudioVoice> allocateNewMonoVoice(double sampleRate,
|
||||
IAudioVoiceCallback* cb,
|
||||
@@ -76,6 +77,18 @@ public:
|
||||
size_t get5MsFrames() const {return m_5msFrames;}
|
||||
};
|
||||
|
||||
template <> inline std::vector<int16_t>& BaseAudioVoiceEngine::_getScratchPre<int16_t>() { return m_scratch16Pre; }
|
||||
template <> inline std::vector<int32_t>& BaseAudioVoiceEngine::_getScratchPre<int32_t>() { return m_scratch32Pre; }
|
||||
template <> inline std::vector<float>& BaseAudioVoiceEngine::_getScratchPre<float>() { return m_scratchFltPre; }
|
||||
|
||||
template <> inline std::vector<int16_t>& BaseAudioVoiceEngine::_getScratchPost<int16_t>() { return m_scratch16Post; }
|
||||
template <> inline std::vector<int32_t>& BaseAudioVoiceEngine::_getScratchPost<int32_t>() { return m_scratch32Post; }
|
||||
template <> inline std::vector<float>& BaseAudioVoiceEngine::_getScratchPost<float>() { return m_scratchFltPost; }
|
||||
|
||||
template <> inline std::vector<int16_t>& BaseAudioVoiceEngine::_getLtRtIn<int16_t>() { return m_ltRtIn16; }
|
||||
template <> inline std::vector<int32_t>& BaseAudioVoiceEngine::_getLtRtIn<int32_t>() { return m_ltRtIn32; }
|
||||
template <> inline std::vector<float>& BaseAudioVoiceEngine::_getLtRtIn<float>() { return m_ltRtInFlt; }
|
||||
|
||||
}
|
||||
|
||||
#endif // BOO_AUDIOVOICEENGINE_HPP
|
||||
|
||||
Reference in New Issue
Block a user