mirror of
https://github.com/AxioDL/amuse.git
synced 2025-12-11 06:27:41 +00:00
AudioGroupProject loader and initial driver
This commit is contained in:
@@ -1,13 +1,74 @@
|
||||
#ifndef __AMUSE_AUDIOGROUPPROJECT_HPP__
|
||||
#define __AMUSE_AUDIOGROUPPROJECT_HPP__
|
||||
|
||||
#include "Entity.hpp"
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace amuse
|
||||
{
|
||||
|
||||
struct AudioGroupIndex {};
|
||||
|
||||
/** Root index of SongGroup */
|
||||
struct SongGroupIndex : AudioGroupIndex
|
||||
{
|
||||
/** Maps GM program numbers to sound entities */
|
||||
struct PageEntry
|
||||
{
|
||||
ObjectId objId;
|
||||
uint8_t priority;
|
||||
uint8_t maxVoices;
|
||||
uint8_t programNo;
|
||||
uint8_t pad;
|
||||
};
|
||||
std::unordered_map<uint8_t, const PageEntry*> m_normPages;
|
||||
std::unordered_map<uint8_t, const PageEntry*> m_drumPages;
|
||||
|
||||
/** Maps SongID to 16 MIDI channel numbers to GM program numbers and settings */
|
||||
struct MIDISetup
|
||||
{
|
||||
uint8_t programNo;
|
||||
uint8_t volume;
|
||||
uint8_t panning;
|
||||
uint8_t reverb;
|
||||
uint8_t chorus;
|
||||
};
|
||||
std::unordered_map<int, std::array<const MIDISetup*, 16>> m_midiSetups;
|
||||
};
|
||||
|
||||
/** Root index of SFXGroup */
|
||||
struct SFXGroupIndex : AudioGroupIndex
|
||||
{
|
||||
/** Maps game-side SFX define IDs to sound entities */
|
||||
struct SFXEntry
|
||||
{
|
||||
uint16_t defineId;
|
||||
ObjectId objId;
|
||||
uint8_t priority;
|
||||
uint8_t maxVoices;
|
||||
uint8_t defVel;
|
||||
uint8_t panning;
|
||||
uint8_t defKey;
|
||||
uint8_t pad;
|
||||
};
|
||||
std::unordered_map<uint16_t, const SFXEntry*> m_sfxEntries;
|
||||
};
|
||||
|
||||
/** Collection of SongGroup and SFXGroup indexes */
|
||||
class AudioGroupProject
|
||||
{
|
||||
std::unordered_map<int, SongGroupIndex> m_songGroups;
|
||||
std::unordered_map<int, SFXGroupIndex> m_sfxGroups;
|
||||
public:
|
||||
AudioGroupProject(const unsigned char* data);
|
||||
|
||||
const SongGroupIndex* getSongGroupIndex(int groupId) const;
|
||||
const SFXGroupIndex* getSFXGroupIndex(int groupId) const;
|
||||
|
||||
const std::unordered_map<int, SongGroupIndex>& songGroups() const {return m_songGroups;}
|
||||
const std::unordered_map<int, SFXGroupIndex>& sfxGroups() const {return m_sfxGroups;}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
namespace amuse
|
||||
{
|
||||
|
||||
#ifndef PRISize
|
||||
#ifdef _MSC_VER
|
||||
#define PRISize "Iu"
|
||||
#else
|
||||
#define PRISize "zu"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
static inline T clamp(T a, T val, T b) {return std::max<T>(a, std::min<T>(b, val));}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user