2016-05-02 18:16:26 -07:00
|
|
|
#ifndef __AMUSE_AUDIOGROUPSAMPLEDIR_HPP__
|
|
|
|
#define __AMUSE_AUDIOGROUPSAMPLEDIR_HPP__
|
|
|
|
|
2016-05-10 21:48:08 -07:00
|
|
|
#include <unordered_map>
|
2016-05-02 18:16:26 -07:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
namespace amuse
|
|
|
|
{
|
|
|
|
|
2016-05-18 22:55:10 -07:00
|
|
|
/** Indexes individual samples in SAMP chunk */
|
2016-05-02 18:16:26 -07:00
|
|
|
class AudioGroupSampleDirectory
|
|
|
|
{
|
|
|
|
friend class AudioGroup;
|
|
|
|
public:
|
|
|
|
struct Entry
|
|
|
|
{
|
|
|
|
uint16_t m_sfxId;
|
|
|
|
uint32_t m_sampleOff;
|
|
|
|
uint32_t m_unk;
|
|
|
|
uint8_t m_pitch;
|
|
|
|
uint16_t m_sampleRate;
|
|
|
|
uint32_t m_numSamples;
|
|
|
|
uint32_t m_loopStartSample;
|
|
|
|
uint32_t m_loopLengthSamples;
|
|
|
|
uint32_t m_adpcmParmOffset;
|
|
|
|
void swapBig();
|
|
|
|
};
|
|
|
|
struct ADPCMParms
|
|
|
|
{
|
|
|
|
uint16_t m_bytesPerFrame;
|
|
|
|
uint8_t m_ps;
|
|
|
|
uint8_t m_lps;
|
|
|
|
int16_t m_hist1;
|
|
|
|
int16_t m_hist2;
|
2016-05-10 21:48:08 -07:00
|
|
|
int16_t m_coefs[8][2];
|
2016-05-02 18:16:26 -07:00
|
|
|
void swapBig();
|
|
|
|
};
|
|
|
|
private:
|
2016-05-10 21:48:08 -07:00
|
|
|
std::unordered_map<uint16_t, std::pair<Entry, ADPCMParms>> m_entries;
|
2016-05-02 18:16:26 -07:00
|
|
|
public:
|
|
|
|
AudioGroupSampleDirectory(const unsigned char* data);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __AMUSE_AUDIOGROUPSAMPLEDIR_HPP__
|