diff --git a/AudioFile.h b/AudioFile.h index e45136d..9869b89 100644 --- a/AudioFile.h +++ b/AudioFile.h @@ -185,7 +185,6 @@ class AudioFile }; //============================================================= - AudioFileFormat determineAudioFileFormat (const std::vector& fileData); bool decodeWaveFile (const std::vector& fileData); bool decodeAiffFile (const std::vector& fileData); @@ -197,22 +196,25 @@ class AudioFile void clearAudioBuffer(); //============================================================= - int32_t fourBytesToInt (const std::vector& source, int startIndex, Endianness endianness = Endianness::LittleEndian); - int16_t twoBytesToInt (const std::vector& source, int startIndex, Endianness endianness = Endianness::LittleEndian); - int getIndexOfChunk (const std::vector& source, const std::string& chunkHeaderID, int startIndex, Endianness endianness = Endianness::LittleEndian); + static inline AudioFileFormat determineAudioFileFormat (const std::vector& fileData); + + static inline int32_t fourBytesToInt (const std::vector& source, int startIndex, Endianness endianness = Endianness::LittleEndian); + static inline int16_t twoBytesToInt (const std::vector& source, int startIndex, Endianness endianness = Endianness::LittleEndian); + static inline int getIndexOfString (const std::vector& source, std::string s); + static inline int getIndexOfChunk (const std::vector& source, const std::string& chunkHeaderID, int startIndex, Endianness endianness = Endianness::LittleEndian); //============================================================= - uint32_t getAiffSampleRate (const std::vector& fileData, int sampleRateStartIndex); - bool tenByteMatch (const std::vector& v1, int startIndex1, std::vector& v2, int startIndex2); - void addSampleRateToAiffData (std::vector& fileData, uint32_t sampleRate); + static inline uint32_t getAiffSampleRate (const std::vector& fileData, int sampleRateStartIndex); + static inline bool tenByteMatch (const std::vector& v1, int startIndex1, const std::vector& v2, int startIndex2); + static inline void addSampleRateToAiffData (std::vector& fileData, uint32_t sampleRate); //============================================================= - void addStringToFileData (std::vector& fileData, std::string s); - void addInt32ToFileData (std::vector& fileData, int32_t i, Endianness endianness = Endianness::LittleEndian); - void addInt16ToFileData (std::vector& fileData, int16_t i, Endianness endianness = Endianness::LittleEndian); + static inline void addStringToFileData (std::vector& fileData, std::string s); + static inline void addInt32ToFileData (std::vector& fileData, int32_t i, Endianness endianness = Endianness::LittleEndian); + static inline void addInt16ToFileData (std::vector& fileData, int16_t i, Endianness endianness = Endianness::LittleEndian); //============================================================= - bool writeDataToFile (const std::vector& fileData, const std::string& filePath); + static inline bool writeDataToFile (const std::vector& fileData, std::string filePath); //============================================================= void reportError (const std::string& errorMessage); @@ -893,7 +895,7 @@ uint32_t AudioFile::getAiffSampleRate (const std::vector& fileData, //============================================================= template -bool AudioFile::tenByteMatch (const std::vector& v1, int startIndex1, std::vector& v2, int startIndex2) +bool AudioFile::tenByteMatch (const std::vector& v1, int startIndex1, const std::vector& v2, int startIndex2) { for (int i = 0; i < 10; i++) { @@ -1155,7 +1157,7 @@ bool AudioFile::saveToAiffFile (const std::string& filePath) //============================================================= template -bool AudioFile::writeDataToFile (const std::vector& fileData, const std::string& filePath) +bool AudioFile::writeDataToFile (const std::vector& fileData, std::string filePath) { std::ofstream outputFile (filePath, std::ios::binary);