2 |
* * |
* * |
3 |
* libgig - C++ cross-platform Gigasampler format file access library * |
* libgig - C++ cross-platform Gigasampler format file access library * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003-2016 by Christian Schoenebeck * |
* Copyright (C) 2003-2017 by Christian Schoenebeck * |
6 |
* <cuse@users.sourceforge.net> * |
* <cuse@users.sourceforge.net> * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
65 |
# define CHUNK_ID_SCSL 0x4c534353 // own gig format extension |
# define CHUNK_ID_SCSL 0x4c534353 // own gig format extension |
66 |
#endif // WORDS_BIGENDIAN |
#endif // WORDS_BIGENDIAN |
67 |
|
|
68 |
|
// just symbol prototyping (since Serialization.h not included by default here) |
69 |
|
namespace Serialization { class Archive; } |
70 |
|
|
71 |
/** Gigasampler/GigaStudio specific classes and definitions */ |
/** Gigasampler/GigaStudio specific classes and definitions */ |
72 |
namespace gig { |
namespace gig { |
73 |
|
|
194 |
|
|
195 |
type_t type; ///< Controller type |
type_t type; ///< Controller type |
196 |
uint controller_number; ///< MIDI controller number if this controller is a control change controller, 0 otherwise |
uint controller_number; ///< MIDI controller number if this controller is a control change controller, 0 otherwise |
197 |
|
|
198 |
|
void serialize(Serialization::Archive* archive); |
199 |
}; |
}; |
200 |
|
|
201 |
/** |
/** |
309 |
uint8_t out_start; ///< Start position of fade out. |
uint8_t out_start; ///< Start position of fade out. |
310 |
uint8_t out_end; ///< End postition of fade out. |
uint8_t out_end; ///< End postition of fade out. |
311 |
#endif // WORDS_BIGENDIAN |
#endif // WORDS_BIGENDIAN |
312 |
|
|
313 |
|
void serialize(Serialization::Archive* archive); |
314 |
}; |
}; |
315 |
|
|
316 |
/** Reflects the current playback state for a sample. */ |
/** Reflects the current playback state for a sample. */ |
493 |
DimensionRegion(RIFF::List* _3ewl, const DimensionRegion& src); |
DimensionRegion(RIFF::List* _3ewl, const DimensionRegion& src); |
494 |
~DimensionRegion(); |
~DimensionRegion(); |
495 |
void CopyAssign(const DimensionRegion* orig, const std::map<Sample*,Sample*>* mSamples); |
void CopyAssign(const DimensionRegion* orig, const std::map<Sample*,Sample*>* mSamples); |
496 |
|
void serialize(Serialization::Archive* archive); |
497 |
friend class Region; |
friend class Region; |
498 |
|
friend class Serialization::Archive; |
499 |
private: |
private: |
500 |
typedef enum { ///< Used to decode attenuation, EG1 and EG2 controller |
typedef enum { ///< Used to decode attenuation, EG1 and EG2 controller |
501 |
// official leverage controllers as they were defined in the original Gigasampler/GigaStudio format: |
// official leverage controllers as they were defined in the original Gigasampler/GigaStudio format: |
598 |
} _lev_ctrl_t; |
} _lev_ctrl_t; |
599 |
typedef std::map<uint32_t, double*> VelocityTableMap; |
typedef std::map<uint32_t, double*> VelocityTableMap; |
600 |
|
|
601 |
static uint Instances; ///< Number of DimensionRegion instances. |
static size_t Instances; ///< Number of DimensionRegion instances. |
602 |
static VelocityTableMap* pVelocityTables; ///< Contains the tables corresponding to the various velocity parameters (VelocityResponseCurve and VelocityResponseDepth). |
static VelocityTableMap* pVelocityTables; ///< Contains the tables corresponding to the various velocity parameters (VelocityResponseCurve and VelocityResponseDepth). |
603 |
double* pVelocityAttenuationTable; ///< Points to the velocity table corresponding to the velocity parameters of this DimensionRegion. |
double* pVelocityAttenuationTable; ///< Points to the velocity table corresponding to the velocity parameters of this DimensionRegion. |
604 |
double* pVelocityReleaseTable; ///< Points to the velocity table corresponding to the release velocity parameters of this DimensionRegion |
double* pVelocityReleaseTable; ///< Points to the velocity table corresponding to the release velocity parameters of this DimensionRegion |
670 |
static void DestroyDecompressionBuffer(buffer_t& DecompressionBuffer); |
static void DestroyDecompressionBuffer(buffer_t& DecompressionBuffer); |
671 |
// overridden methods |
// overridden methods |
672 |
void ReleaseSampleData(); |
void ReleaseSampleData(); |
673 |
void Resize(int iNewSize); |
void Resize(file_offset_t NewSize); |
674 |
file_offset_t SetPos(file_offset_t SampleCount, RIFF::stream_whence_t Whence = RIFF::stream_start); |
file_offset_t SetPos(file_offset_t SampleCount, RIFF::stream_whence_t Whence = RIFF::stream_start); |
675 |
file_offset_t GetPos() const; |
file_offset_t GetPos() const; |
676 |
file_offset_t Read(void* pBuffer, file_offset_t SampleCount, buffer_t* pExternalDecompressionBuffer = NULL); |
file_offset_t Read(void* pBuffer, file_offset_t SampleCount, buffer_t* pExternalDecompressionBuffer = NULL); |
680 |
virtual void UpdateChunks(progress_t* pProgress); |
virtual void UpdateChunks(progress_t* pProgress); |
681 |
void CopyAssignMeta(const Sample* orig); |
void CopyAssignMeta(const Sample* orig); |
682 |
void CopyAssignWave(const Sample* orig); |
void CopyAssignWave(const Sample* orig); |
683 |
|
uint32_t GetWaveDataCRC32Checksum(); |
684 |
|
bool VerifyWaveData(uint32_t* pActually = NULL); |
685 |
protected: |
protected: |
686 |
static unsigned int Instances; ///< Number of instances of class Sample. |
static size_t Instances; ///< Number of instances of class Sample. |
687 |
static buffer_t InternalDecompressionBuffer; ///< Buffer used for decompression as well as for truncation of 24 Bit -> 16 Bit samples. |
static buffer_t InternalDecompressionBuffer; ///< Buffer used for decompression as well as for truncation of 24 Bit -> 16 Bit samples. |
688 |
Group* pGroup; ///< pointer to the Group this sample belongs to (always not-NULL) |
Group* pGroup; ///< pointer to the Group this sample belongs to (always not-NULL) |
689 |
file_offset_t FrameOffset; ///< Current offset (sample points) in current sample frame (for decompression only). |
file_offset_t FrameOffset; ///< Current offset (sample points) in current sample frame (for decompression only). |
696 |
unsigned long FileNo; ///< File number (> 0 when sample is stored in an extension file, 0 when it's in the gig) |
unsigned long FileNo; ///< File number (> 0 when sample is stored in an extension file, 0 when it's in the gig) |
697 |
RIFF::Chunk* pCk3gix; |
RIFF::Chunk* pCk3gix; |
698 |
RIFF::Chunk* pCkSmpl; |
RIFF::Chunk* pCkSmpl; |
699 |
uint32_t crc; ///< CRC-32 checksum of the raw sample data |
uint32_t crc; ///< Reflects CRC-32 checksum of the raw sample data at the last time when the sample's raw wave form data has been modified consciously by the user by calling Write(). |
700 |
|
|
701 |
Sample(File* pFile, RIFF::List* waveList, file_offset_t WavePoolOffset, unsigned long fileNo = 0); |
Sample(File* pFile, RIFF::List* waveList, file_offset_t WavePoolOffset, unsigned long fileNo = 0, int index = -1); |
702 |
~Sample(); |
~Sample(); |
703 |
|
uint32_t CalculateWaveDataChecksum(); |
704 |
|
|
705 |
// Guess size (in bytes) of a compressed sample |
// Guess size (in bytes) of a compressed sample |
706 |
inline file_offset_t GuessSize(file_offset_t samples) { |
inline file_offset_t GuessSize(file_offset_t samples) { |
1023 |
void SetScriptAsText(const String& text); |
void SetScriptAsText(const String& text); |
1024 |
void SetGroup(ScriptGroup* pGroup); |
void SetGroup(ScriptGroup* pGroup); |
1025 |
ScriptGroup* GetGroup() const; |
ScriptGroup* GetGroup() const; |
1026 |
|
void CopyAssign(const Script* orig); |
1027 |
protected: |
protected: |
1028 |
Script(ScriptGroup* group, RIFF::Chunk* ckScri); |
Script(ScriptGroup* group, RIFF::Chunk* ckScri); |
1029 |
virtual ~Script(); |
virtual ~Script(); |
1280 |
virtual void LoadInstruments(progress_t* pProgress); |
virtual void LoadInstruments(progress_t* pProgress); |
1281 |
virtual void LoadScriptGroups(); |
virtual void LoadScriptGroups(); |
1282 |
void SetSampleChecksum(Sample* pSample, uint32_t crc); |
void SetSampleChecksum(Sample* pSample, uint32_t crc); |
1283 |
|
uint32_t GetSampleChecksum(Sample* pSample); |
1284 |
|
uint32_t GetSampleChecksumByIndex(int index); |
1285 |
|
bool VerifySampleChecksumTable(); |
1286 |
|
bool RebuildSampleChecksumTable(); |
1287 |
|
int GetWaveTableIndexOf(gig::Sample* pSample); |
1288 |
friend class Region; |
friend class Region; |
1289 |
friend class Sample; |
friend class Sample; |
1290 |
friend class Instrument; |
friend class Instrument; |