/* * Author: Harry van Haaren 2013 * harryhaaren@gmail.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef LUPPP_AUDIOBUFFER_H #define LUPPP_AUDIOBUFFER_H #include #include #include #include #include using namespace std; /// AudioBuffer stores float samples in a big vector. class AudioBuffer { public: AudioBuffer(); AudioBuffer(unsigned long size); void init(); /// this function is used for "resizing" an exisiting buffer, and should /// not be called for any other reason. void setID(int id); int getID(); void setName(const std::string& n); const std::string& getName() const; int getBeats(); void setBeats(int b); bool setAudioFrames(long af); long getAudioFrames(); long getSize(); std::vector& getDataL(); std::vector& getDataR(); void nonRtSetSample(std::vector& sampleL, std::vector& sampleR); protected: static int privateID; int ID; int numBeats; /// holds the number of samples that are usable audio, as opposed to /// buffer.size(), which also has non-used space at the end. long audioFrames; std::string name; std::vector bufferL; std::vector bufferR; }; #endif