00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef SAMPLE_BUFFER_H
00026 #define SAMPLE_BUFFER_H
00027
00028 #include <iostream>
00029 using std::endl;
00030 using std::cout;
00031 using std::cerr;
00032
00033 #include <string>
00034 using std::string;
00035 #include <audiofile.h>
00036
00037 #include "Globals.h"
00038 #include "Object.h"
00039 #include "PreferencesMng.h"
00040
00041
00042
00046 class Sample : public Object{
00047 private:
00049 string filename;
00050
00052 uint nFrames;
00053
00055 float *dataL;
00056
00058 float *dataR;
00059
00060
00061 public:
00062 virtual string getClassName() { return "Sample"; }
00063
00065 Sample(uint nFrames, string filename);
00066
00068 ~Sample();
00069
00070 void setData_L(float *left);
00071 void setData_R(float *right);
00072
00073 float* getData_L();
00074 float* getData_R();
00075
00077 uint getNFrames(){ return nFrames; }
00078
00080 uint getNBytes(){ return nFrames * 2 * STEREO; }
00081
00083 string getFilename(){ return filename; }
00084
00085 void setFilename(string filename) { this->filename = filename; }
00086
00088 static Sample* load(string filename);
00089
00091 void save(string filename);
00092 };
00093
00094
00095 #endif