2022-10-21 21:40:29 +00:00
|
|
|
#ifndef _CMIDIMANAGER
|
|
|
|
#define _CMIDIMANAGER
|
|
|
|
|
|
|
|
#include "Kyoto/Audio/CSfxHandle.hpp"
|
|
|
|
|
2023-10-26 19:50:31 +00:00
|
|
|
#include <rstl/auto_ptr.hpp>
|
|
|
|
#include <rstl/reserved_vector.hpp>
|
|
|
|
|
|
|
|
class CInputStream;
|
2022-10-21 21:40:29 +00:00
|
|
|
class CMidiManager {
|
|
|
|
public:
|
2023-10-26 19:50:31 +00:00
|
|
|
class CMidiWrapper {
|
|
|
|
public:
|
|
|
|
CMidiWrapper();
|
|
|
|
const CSfxHandle& GetManagerHandle() const;
|
|
|
|
const u32 GetAudioSysHandle() const;
|
|
|
|
const bool IsAvailable() const;
|
|
|
|
|
|
|
|
void SetAvailable(const bool v);
|
|
|
|
void SetAudioSysHandle(const u32 handle);
|
|
|
|
const short GetSongId() const;
|
|
|
|
void SetMidiHandle(const CSfxHandle& handle);
|
|
|
|
void SetSongId(const short id);
|
|
|
|
|
|
|
|
private:
|
2023-10-26 19:56:19 +00:00
|
|
|
u32 x0_sysHandle;
|
|
|
|
CSfxHandle x4_midiHandle;
|
|
|
|
short x8_songId;
|
|
|
|
bool xa_available;
|
2023-10-26 19:50:31 +00:00
|
|
|
};
|
2024-10-17 05:02:14 +00:00
|
|
|
|
2023-10-26 19:50:31 +00:00
|
|
|
class CMidiData {
|
|
|
|
public:
|
|
|
|
CMidiData(CInputStream& in);
|
2022-10-21 21:40:29 +00:00
|
|
|
|
2023-10-26 19:50:31 +00:00
|
|
|
const short GetSongId() const { return x0_songId; }
|
|
|
|
const short GetGroupId() const { return x2_groupId; }
|
|
|
|
const int GetSetupId() const { return x4_setupId; }
|
|
|
|
uchar* GetData() const { return x8_data.get(); }
|
2024-10-17 05:02:14 +00:00
|
|
|
|
2023-10-26 19:50:31 +00:00
|
|
|
private:
|
|
|
|
short x0_songId;
|
|
|
|
short x2_groupId;
|
|
|
|
int x4_setupId;
|
|
|
|
rstl::auto_ptr< uchar > x8_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
static CSfxHandle Play(const CMidiData&, unsigned short fadeTime, bool stopExisting,
|
|
|
|
short volume);
|
2022-10-21 21:40:29 +00:00
|
|
|
static void Stop(const CSfxHandle&, unsigned short);
|
2023-10-26 19:50:31 +00:00
|
|
|
static void StopAll();
|
|
|
|
|
|
|
|
static CSfxHandle LocateHandle();
|
|
|
|
|
|
|
|
static rstl::reserved_vector< CMidiWrapper, 3 > mMidiWrappers;
|
2022-10-21 21:40:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _CMIDIMANAGER
|