45 |
Product = smpl->ReadInt32(); |
Product = smpl->ReadInt32(); |
46 |
SamplePeriod = smpl->ReadInt32(); |
SamplePeriod = smpl->ReadInt32(); |
47 |
MIDIUnityNote = smpl->ReadInt32(); |
MIDIUnityNote = smpl->ReadInt32(); |
48 |
MIDIPitchFraction = smpl->ReadInt32(); |
FineTune = smpl->ReadInt32(); |
49 |
smpl->Read(&SMPTEFormat, 1, 4); |
smpl->Read(&SMPTEFormat, 1, 4); |
50 |
SMPTEOffset = smpl->ReadInt32(); |
SMPTEOffset = smpl->ReadInt32(); |
51 |
Loops = smpl->ReadInt32(); |
Loops = smpl->ReadInt32(); |
52 |
|
uint32_t manufByt = smpl->ReadInt32(); |
53 |
LoopID = smpl->ReadInt32(); |
LoopID = smpl->ReadInt32(); |
54 |
smpl->Read(&LoopType, 1, 4); |
smpl->Read(&LoopType, 1, 4); |
55 |
LoopStart = smpl->ReadInt32(); |
LoopStart = smpl->ReadInt32(); |
72 |
} |
} |
73 |
} |
} |
74 |
FrameOffset = 0; // just for streaming compressed samples |
FrameOffset = 0; // just for streaming compressed samples |
75 |
|
|
76 |
|
LoopStart /= FrameSize; // convert to sample points |
77 |
|
LoopEnd /= FrameSize; // convert to sample points |
78 |
|
LoopSize = LoopEnd - LoopStart; |
79 |
} |
} |
80 |
|
|
81 |
/// Scans compressed samples for mandatory informations (e.g. actual number of total sample points). |
/// Scans compressed samples for mandatory informations (e.g. actual number of total sample points). |
328 |
* @see SetPos() |
* @see SetPos() |
329 |
*/ |
*/ |
330 |
unsigned long Sample::Read(void* pBuffer, unsigned long SampleCount) { |
unsigned long Sample::Read(void* pBuffer, unsigned long SampleCount) { |
331 |
|
if (SampleCount == 0) return 0; |
332 |
if (!Compressed) return pCkData->Read(pBuffer, SampleCount, FrameSize); //FIXME: channel inversion due to endian correction? |
if (!Compressed) return pCkData->Read(pBuffer, SampleCount, FrameSize); //FIXME: channel inversion due to endian correction? |
333 |
else { //FIXME: no support for mono compressed samples yet, are there any? |
else { //FIXME: no support for mono compressed samples yet, are there any? |
334 |
if (this->SamplePos >= this->SamplesTotal) return 0; |
if (this->SamplePos >= this->SamplesTotal) return 0; |
1076 |
return (InstrumentsIterator != pInstruments->end()) ? *InstrumentsIterator : NULL; |
return (InstrumentsIterator != pInstruments->end()) ? *InstrumentsIterator : NULL; |
1077 |
} |
} |
1078 |
|
|
1079 |
|
/** |
1080 |
|
* Returns the instrument with the given index. |
1081 |
|
* |
1082 |
|
* @returns sought instrument or NULL if there's no such instrument |
1083 |
|
*/ |
1084 |
|
Instrument* File::GetInstrument(uint index) { |
1085 |
|
if (!pInstruments) LoadInstruments(); |
1086 |
|
if (!pInstruments) return NULL; |
1087 |
|
InstrumentsIterator = pInstruments->begin(); |
1088 |
|
for (uint i = 0; InstrumentsIterator != pInstruments->end(); i++) { |
1089 |
|
if (i == index) return *InstrumentsIterator; |
1090 |
|
InstrumentsIterator++; |
1091 |
|
} |
1092 |
|
return NULL; |
1093 |
|
} |
1094 |
|
|
1095 |
void File::LoadInstruments() { |
void File::LoadInstruments() { |
1096 |
RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS); |
RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS); |
1097 |
if (lstInstruments) { |
if (lstInstruments) { |