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-2017 by Christian Schoenebeck * |
* Copyright (C) 2003-2018 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 * |
4143 |
if ((int32_t)WavePoolTableIndex == -1) return NULL; |
if ((int32_t)WavePoolTableIndex == -1) return NULL; |
4144 |
File* file = (File*) GetParent()->GetParent(); |
File* file = (File*) GetParent()->GetParent(); |
4145 |
if (!file->pWavePoolTable) return NULL; |
if (!file->pWavePoolTable) return NULL; |
4146 |
|
if (WavePoolTableIndex + 1 > file->WavePoolCount) return NULL; |
4147 |
// for new files or files >= 2 GB use 64 bit wave pool offsets |
// for new files or files >= 2 GB use 64 bit wave pool offsets |
4148 |
if (file->pRIFF->IsNew() || (file->pRIFF->GetCurrentFileSize() >> 31)) { |
if (file->pRIFF->IsNew() || (file->pRIFF->GetCurrentFileSize() >> 31)) { |
4149 |
// use 64 bit wave pool offsets (treating this as large file) |
// use 64 bit wave pool offsets (treating this as large file) |
5590 |
return static_cast<gig::Sample*>( *it ); |
return static_cast<gig::Sample*>( *it ); |
5591 |
} |
} |
5592 |
|
|
5593 |
|
/** |
5594 |
|
* Returns the total amount of samples of this gig file. |
5595 |
|
* |
5596 |
|
* Note that this method might block for a long time in case it is required |
5597 |
|
* to load the sample info for the first time. |
5598 |
|
* |
5599 |
|
* @returns total amount of samples |
5600 |
|
*/ |
5601 |
|
size_t File::CountSamples() { |
5602 |
|
if (!pSamples) LoadSamples(); |
5603 |
|
if (!pSamples) return 0; |
5604 |
|
return pSamples->size(); |
5605 |
|
} |
5606 |
|
|
5607 |
/** @brief Add a new sample. |
/** @brief Add a new sample. |
5608 |
* |
* |
5609 |
* This will create a new Sample object for the gig file. You have to |
* This will create a new Sample object for the gig file. You have to |
5739 |
} |
} |
5740 |
|
|
5741 |
/** |
/** |
5742 |
|
* Returns the total amount of instruments of this gig file. |
5743 |
|
* |
5744 |
|
* Note that this method might block for a long time in case it is required |
5745 |
|
* to load the instruments info for the first time. |
5746 |
|
* |
5747 |
|
* @returns total amount of instruments |
5748 |
|
*/ |
5749 |
|
size_t File::CountInstruments() { |
5750 |
|
if (!pInstruments) LoadInstruments(); |
5751 |
|
if (!pInstruments) return 0; |
5752 |
|
return pInstruments->size(); |
5753 |
|
} |
5754 |
|
|
5755 |
|
/** |
5756 |
* Returns the instrument with the given index. |
* Returns the instrument with the given index. |
5757 |
* |
* |
5758 |
* @param index - number of the sought instrument (0..n) |
* @param index - number of the sought instrument (0..n) |