diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/drumkit.cc | 14 | ||||
-rw-r--r-- | src/drumkit.h | 7 | ||||
-rw-r--r-- | src/instrument.cc | 7 | ||||
-rw-r--r-- | src/instrument.h | 3 |
4 files changed, 28 insertions, 3 deletions
diff --git a/src/drumkit.cc b/src/drumkit.cc index 1dadf04..abef1b8 100644 --- a/src/drumkit.cc +++ b/src/drumkit.cc @@ -68,7 +68,19 @@ std::string DrumKit::getDescription() const return _description; } -size_t DrumKit::getSamplerate() const +std::size_t DrumKit::getSamplerate() const { return _samplerate; } + +std::size_t DrumKit::getNumberOfFiles() const +{ + std::size_t number_of_files = 0; + + for(const auto & instrument : instruments) + { + number_of_files += instrument->getNumberOfFiles(); + } + + return number_of_files; +} diff --git a/src/drumkit.h b/src/drumkit.h index e3ae783..f646b22 100644 --- a/src/drumkit.h +++ b/src/drumkit.h @@ -52,7 +52,10 @@ public: bool isValid() const; - size_t getSamplerate() const; + std::size_t getSamplerate() const; + + //! Get the number of audio files (as in single channel) in this drumkit. + std::size_t getNumberOfFiles() const; private: void* magic{nullptr}; @@ -61,7 +64,7 @@ private: std::string _name; std::string _description; - size_t _samplerate{0}; + std::size_t _samplerate{0}; VersionStr _version; }; diff --git a/src/instrument.cc b/src/instrument.cc index 5c96c6d..466acc1 100644 --- a/src/instrument.cc +++ b/src/instrument.cc @@ -117,3 +117,10 @@ void Instrument::setGroup(const std::string& g) { _group = g; } + +std::size_t Instrument::getNumberOfFiles() const +{ + // Note: Each AudioFile instance contains just a single channel even for + // multi-channel files. + return audiofiles.size(); +} diff --git a/src/instrument.h b/src/instrument.h index e61d446..41fe886 100644 --- a/src/instrument.h +++ b/src/instrument.h @@ -60,6 +60,9 @@ public: bool isValid() const; + //! Get the number of audio files (as in single channel) in this instrument. + std::size_t getNumberOfFiles() const; + private: void* magic; |