2018-10-07 03:40:25 +00:00
|
|
|
#pragma once
|
2016-05-03 01:16:26 +00:00
|
|
|
|
2019-08-25 10:28:43 +00:00
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
#include "amuse/Common.hpp"
|
2016-05-28 02:28:59 +00:00
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
namespace amuse {
|
2016-05-03 01:16:26 +00:00
|
|
|
|
2016-05-19 05:55:10 +00:00
|
|
|
/** Simple pointer-container of the four Audio Group chunks */
|
2018-12-08 05:20:09 +00:00
|
|
|
class AudioGroupData {
|
|
|
|
friend class Engine;
|
2016-07-14 04:54:46 +00:00
|
|
|
|
2016-05-03 01:16:26 +00:00
|
|
|
protected:
|
2018-12-08 05:20:09 +00:00
|
|
|
unsigned char* m_proj;
|
|
|
|
size_t m_projSz;
|
|
|
|
unsigned char* m_pool;
|
|
|
|
size_t m_poolSz;
|
|
|
|
unsigned char* m_sdir;
|
|
|
|
size_t m_sdirSz;
|
|
|
|
unsigned char* m_samp;
|
|
|
|
size_t m_sampSz;
|
|
|
|
|
|
|
|
DataFormat m_fmt;
|
|
|
|
bool m_absOffs;
|
|
|
|
|
|
|
|
AudioGroupData(unsigned char* proj, size_t projSz, unsigned char* pool, size_t poolSz, unsigned char* sdir,
|
|
|
|
size_t sdirSz, unsigned char* samp, size_t sampSz, DataFormat fmt, bool absOffs)
|
|
|
|
: m_proj(proj)
|
|
|
|
, m_projSz(projSz)
|
|
|
|
, m_pool(pool)
|
|
|
|
, m_poolSz(poolSz)
|
|
|
|
, m_sdir(sdir)
|
|
|
|
, m_sdirSz(sdirSz)
|
|
|
|
, m_samp(samp)
|
|
|
|
, m_sampSz(sampSz)
|
|
|
|
, m_fmt(fmt)
|
|
|
|
, m_absOffs(absOffs) {}
|
2016-07-14 04:54:46 +00:00
|
|
|
|
2016-05-03 01:16:26 +00:00
|
|
|
public:
|
2018-12-08 05:20:09 +00:00
|
|
|
AudioGroupData(unsigned char* proj, size_t projSz, unsigned char* pool, size_t poolSz, unsigned char* sdir,
|
|
|
|
size_t sdirSz, unsigned char* samp, size_t sampSz, GCNDataTag)
|
|
|
|
: m_proj(proj)
|
|
|
|
, m_projSz(projSz)
|
|
|
|
, m_pool(pool)
|
|
|
|
, m_poolSz(poolSz)
|
|
|
|
, m_sdir(sdir)
|
|
|
|
, m_sdirSz(sdirSz)
|
|
|
|
, m_samp(samp)
|
|
|
|
, m_sampSz(sampSz)
|
|
|
|
, m_fmt(DataFormat::GCN)
|
|
|
|
, m_absOffs(true) {}
|
|
|
|
AudioGroupData(unsigned char* proj, size_t projSz, unsigned char* pool, size_t poolSz, unsigned char* sdir,
|
|
|
|
size_t sdirSz, unsigned char* samp, size_t sampSz, bool absOffs, N64DataTag)
|
|
|
|
: m_proj(proj)
|
|
|
|
, m_projSz(projSz)
|
|
|
|
, m_pool(pool)
|
|
|
|
, m_poolSz(poolSz)
|
|
|
|
, m_sdir(sdir)
|
|
|
|
, m_sdirSz(sdirSz)
|
|
|
|
, m_samp(samp)
|
|
|
|
, m_sampSz(sampSz)
|
|
|
|
, m_fmt(DataFormat::N64)
|
|
|
|
, m_absOffs(absOffs) {}
|
|
|
|
AudioGroupData(unsigned char* proj, size_t projSz, unsigned char* pool, size_t poolSz, unsigned char* sdir,
|
|
|
|
size_t sdirSz, unsigned char* samp, size_t sampSz, bool absOffs, PCDataTag)
|
|
|
|
: m_proj(proj)
|
|
|
|
, m_projSz(projSz)
|
|
|
|
, m_pool(pool)
|
|
|
|
, m_poolSz(poolSz)
|
|
|
|
, m_sdir(sdir)
|
|
|
|
, m_sdirSz(sdirSz)
|
|
|
|
, m_samp(samp)
|
|
|
|
, m_sampSz(sampSz)
|
|
|
|
, m_fmt(DataFormat::PC)
|
|
|
|
, m_absOffs(absOffs) {}
|
|
|
|
|
|
|
|
const unsigned char* getProj() const { return m_proj; }
|
|
|
|
const unsigned char* getPool() const { return m_pool; }
|
|
|
|
const unsigned char* getSdir() const { return m_sdir; }
|
|
|
|
const unsigned char* getSamp() const { return m_samp; }
|
|
|
|
|
|
|
|
unsigned char* getProj() { return m_proj; }
|
|
|
|
unsigned char* getPool() { return m_pool; }
|
|
|
|
unsigned char* getSdir() { return m_sdir; }
|
|
|
|
unsigned char* getSamp() { return m_samp; }
|
|
|
|
|
|
|
|
size_t getProjSize() const { return m_projSz; }
|
|
|
|
size_t getPoolSize() const { return m_poolSz; }
|
|
|
|
size_t getSdirSize() const { return m_sdirSz; }
|
|
|
|
size_t getSampSize() const { return m_sampSz; }
|
|
|
|
|
|
|
|
operator bool() const { return m_proj != nullptr && m_pool != nullptr && m_sdir != nullptr && m_samp != nullptr; }
|
|
|
|
|
|
|
|
DataFormat getDataFormat() const { return m_fmt; }
|
|
|
|
bool getAbsoluteProjOffsets() const { return m_absOffs; }
|
2016-05-03 01:16:26 +00:00
|
|
|
};
|
|
|
|
|
2016-05-19 05:55:10 +00:00
|
|
|
/** A buffer-owning version of AudioGroupData */
|
2018-12-08 05:20:09 +00:00
|
|
|
class IntrusiveAudioGroupData : public AudioGroupData {
|
|
|
|
bool m_owns = true;
|
2016-07-14 04:54:46 +00:00
|
|
|
|
2016-05-03 01:16:26 +00:00
|
|
|
public:
|
2018-12-08 05:20:09 +00:00
|
|
|
using AudioGroupData::AudioGroupData;
|
|
|
|
~IntrusiveAudioGroupData();
|
2016-05-18 00:59:44 +00:00
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
IntrusiveAudioGroupData(const IntrusiveAudioGroupData&) = delete;
|
|
|
|
IntrusiveAudioGroupData& operator=(const IntrusiveAudioGroupData&) = delete;
|
2016-05-18 00:59:44 +00:00
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
IntrusiveAudioGroupData(IntrusiveAudioGroupData&& other) noexcept;
|
|
|
|
IntrusiveAudioGroupData& operator=(IntrusiveAudioGroupData&& other) noexcept;
|
2016-05-03 01:16:26 +00:00
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
void dangleOwnership() { m_owns = false; }
|
2016-07-14 04:54:46 +00:00
|
|
|
};
|
2018-12-08 05:20:09 +00:00
|
|
|
} // namespace amuse
|