Hydrogen - Linux Drum Machine
Main Page | Class Hierarchy | Compound List | File List | Compound Members

Sample.h

00001 /*
00002  * Hydrogen
00003  * Copyright(c) 2002-2003 by Alex >Comix< Cominu [comix@users.sourceforge.net]
00004  *
00005  * http://hydrogen.sourceforge.net
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY, without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * $Id: Sample.h,v 1.13 2003/04/21 17:57:30 comix Exp $
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

 
 
Hydrogen (c) 2002..2003 Comix