1 #ifndef __AMUSE_ENGINE_HPP__ 2 #define __AMUSE_ENGINE_HPP__ 7 #include <unordered_map> 8 #include <unordered_set> 10 #include "AudioGroupSampleDirectory.hpp" 11 #include "Sequencer.hpp" 15 class IBackendVoiceAllocator;
28 friend class Sequencer::ChannelState;
31 std::unordered_map<const AudioGroupData*, std::unique_ptr<AudioGroup>> m_audioGroups;
32 std::list<std::shared_ptr<Voice>> m_activeVoices;
33 std::list<std::shared_ptr<Emitter>> m_activeEmitters;
34 std::list<std::shared_ptr<Sequencer>> m_activeSequencers;
35 std::list<Submix> m_activeSubmixes;
36 std::unordered_map<uint16_t, std::tuple<AudioGroup*, int, const SFXGroupIndex::SFXEntry*>> m_sfxLookup;
37 std::linear_congruential_engine<uint32_t, 0x41c64e6d, 0x3039, UINT32_MAX> m_random;
40 std::pair<AudioGroup*, const SongGroupIndex*> _findSongGroup(
int groupId)
const;
41 std::pair<AudioGroup*, const SFXGroupIndex*> _findSFXGroup(
int groupId)
const;
43 std::shared_ptr<Voice> _allocateVoice(
const AudioGroup& group,
int groupId,
double sampleRate,
44 bool dynamicPitch,
bool emitter,
Submix* smx);
45 std::shared_ptr<Sequencer> _allocateSequencer(
const AudioGroup& group,
int groupId,
48 std::list<std::shared_ptr<Voice>>::iterator _destroyVoice(
Voice* voice);
49 std::list<std::shared_ptr<Sequencer>>::iterator _destroySequencer(
Sequencer* sequencer);
50 std::list<Submix>::iterator _destroySubmix(
Submix* smx);
51 std::list<Submix>::iterator _removeSubmix(
Submix* smx);
52 void _bringOutYourDead();
76 std::shared_ptr<Voice>
fxStart(
int sfxId,
float vol,
float pan,
Submix* smx=
nullptr);
79 std::shared_ptr<Emitter>
addEmitter(
const Vector3f& pos,
const Vector3f& dir,
float maxDist,
80 float falloff,
int sfxId,
float minVol,
float maxVol,
84 std::shared_ptr<Sequencer>
seqPlay(
int groupId,
int songId,
const unsigned char* arrData,
88 std::shared_ptr<Voice>
findVoice(
int vid);
102 #endif // __AMUSE_ENGINE_HPP__ const AudioGroup * addAudioGroup(const AudioGroupData &data)
void killKeygroup(uint8_t kg, bool now)
std::shared_ptr< Voice > fxStart(int sfxId, float vol, float pan, Submix *smx=nullptr)
Submix * addSubmix(Submix *parent=nullptr)
void pumpEngine(double dt)
void sendMacroMessage(ObjectId macroId, int32_t val)
std::shared_ptr< Sequencer > seqPlay(int groupId, int songId, const unsigned char *arrData, Submix *smx=nullptr)
std::shared_ptr< Emitter > addEmitter(const Vector3f &pos, const Vector3f &dir, float maxDist, float falloff, int sfxId, float minVol, float maxVol, Submix *smx=nullptr)
void removeAudioGroup(const AudioGroupData &data)
IBackendVoiceAllocator & getBackend()
std::shared_ptr< Voice > findVoice(int vid)
void removeSubmix(Submix *smx)