2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2017-02-18 02:19:50 +00:00
|
|
|
|
2017-02-27 05:25:14 +00:00
|
|
|
#include "CSfxManager.hpp"
|
|
|
|
|
2017-02-18 02:19:50 +00:00
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
class CMidiManager
|
|
|
|
{
|
|
|
|
public:
|
2017-02-27 05:25:14 +00:00
|
|
|
class CMidiData
|
|
|
|
{
|
|
|
|
u16 x0_setupId;
|
|
|
|
u16 x2_groupId;
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId x4_agscId;
|
2017-02-27 05:25:14 +00:00
|
|
|
std::unique_ptr<u8[]> x8_arrData;
|
|
|
|
public:
|
|
|
|
u16 GetSetupId() const { return x0_setupId; }
|
|
|
|
u16 GetGroupId() const { return x2_groupId; }
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId GetAGSCAssetId() const { return x4_agscId; }
|
2017-02-27 05:25:14 +00:00
|
|
|
const u8* GetArrData() const { return x8_arrData.get(); }
|
|
|
|
CMidiData(CInputStream& in);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CMidiWrapper
|
|
|
|
{
|
2018-08-28 05:44:16 +00:00
|
|
|
amuse::ObjToken<amuse::Sequencer> x0_sequencer;
|
2017-02-27 05:25:14 +00:00
|
|
|
//CSfxHandle x4_handle;
|
|
|
|
u16 x8_songId;
|
|
|
|
bool xa_available = true;
|
|
|
|
public:
|
2018-08-28 05:44:16 +00:00
|
|
|
amuse::ObjToken<amuse::Sequencer> GetAudioSysHandle() const { return x0_sequencer; }
|
|
|
|
void SetAudioSysHandle(amuse::ObjToken<amuse::Sequencer> sequencer) { x0_sequencer = sequencer; }
|
2017-02-27 05:25:14 +00:00
|
|
|
//const CSfxHandle& GetManagerHandle() const { return x4_handle; }
|
|
|
|
//void SetMidiHandle(const CSfxHandle& handle) { x4_handle = handle; }
|
|
|
|
bool IsAvailable() const { return xa_available; }
|
|
|
|
void SetAvailable(bool available) { xa_available = available; }
|
|
|
|
u16 GetSongId() const { return x8_songId; }
|
|
|
|
void SetSongId(u16 songId) { x8_songId = songId; }
|
|
|
|
};
|
|
|
|
using CMidiHandle = std::shared_ptr<CMidiWrapper>;
|
|
|
|
|
2017-02-18 02:19:50 +00:00
|
|
|
static void StopAll();
|
2017-02-27 05:25:14 +00:00
|
|
|
static void Stop(const CMidiHandle& handle, float fadeTime);
|
|
|
|
static std::unordered_set<CMidiHandle>::iterator
|
|
|
|
Stop(std::unordered_set<CMidiHandle>::iterator handle, float fadeTime);
|
|
|
|
static CMidiHandle Play(const CMidiData& data, float fadeTime, bool stopExisting, float volume);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static std::unordered_set<CMidiHandle> m_MidiWrappers;
|
2017-02-18 02:19:50 +00:00
|
|
|
};
|
|
|
|
|
2017-02-27 05:25:14 +00:00
|
|
|
CFactoryFnReturn FMidiDataFactory(const SObjectTag& tag, CInputStream& in,
|
|
|
|
const CVParamTransfer& parms,
|
|
|
|
CObjectReference* selfRef);
|
|
|
|
|
|
|
|
using CMidiHandle = CMidiManager::CMidiHandle;
|
|
|
|
|
2017-02-18 02:19:50 +00:00
|
|
|
}
|
|
|
|
|