--- libgig/trunk/src/gig.cpp 2017/10/03 17:35:02 3350 +++ libgig/trunk/src/gig.cpp 2018/01/30 20:17:12 3414 @@ -2,7 +2,7 @@ * * * libgig - C++ cross-platform Gigasampler format file access library * * * - * Copyright (C) 2003-2017 by Christian Schoenebeck * + * Copyright (C) 2003-2018 by Christian Schoenebeck * * * * * * This library is free software; you can redistribute it and/or modify * @@ -5590,6 +5590,20 @@ return static_cast( *it ); } + /** + * Returns the total amount of samples of this gig file. + * + * Note that this method might block for a long time in case it is required + * to load the sample info for the first time. + * + * @returns total amount of samples + */ + size_t File::CountSamples() { + if (!pSamples) LoadSamples(); + if (!pSamples) return 0; + return pSamples->size(); + } + /** @brief Add a new sample. * * This will create a new Sample object for the gig file. You have to @@ -5725,6 +5739,20 @@ } /** + * Returns the total amount of instruments of this gig file. + * + * Note that this method might block for a long time in case it is required + * to load the instruments info for the first time. + * + * @returns total amount of instruments + */ + size_t File::CountInstruments() { + if (!pInstruments) LoadInstruments(); + if (!pInstruments) return 0; + return pInstruments->size(); + } + + /** * Returns the instrument with the given index. * * @param index - number of the sought instrument (0..n)