BEAST/BSE - Better Audio System and Sound Engine
0.8.2
|
00001 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __BWT_WAVE_H__ 00003 #define __BWT_WAVE_H__ 00004 00005 #include <bse/gsldatahandle.hh> 00006 #include <bse/gslwavechunk.hh> 00007 #include <bse/bseenums.hh> 00008 #include <string> 00009 #include <list> 00010 #include <vector> 00011 00012 namespace BseWaveTool { 00013 using namespace std; 00014 00015 class WaveChunk { 00016 public: 00017 GslDataHandle *dhandle; /* always open */ 00018 /*Con*/ WaveChunk(); 00019 /*Copy*/ WaveChunk (const WaveChunk &rhs); 00020 WaveChunk& operator= (const WaveChunk &); 00021 BseErrorType set_dhandle_from_file (const string &fname, 00022 gdouble osc_freq, 00023 gchar **xinfos); 00024 BseErrorType change_dhandle (GslDataHandle *xhandle, 00025 gdouble osc_freq, 00026 gchar **xinfos); 00027 /*Des*/ ~WaveChunk(); 00028 }; 00029 00030 struct Wave { 00031 guint n_channels; 00032 string name; 00033 list<WaveChunk> chunks; 00034 gchar **wave_xinfos; 00035 void set_chunks_xinfo (const gchar *key, 00036 const gchar *value, 00037 gfloat osc_freq, 00038 bool all_chunks); 00039 public: 00040 /*Con*/ Wave (const gchar *wave_name, 00041 guint n_channels, 00042 gchar **xinfos); 00043 void set_xinfo (const gchar *key, 00044 const gchar *value); 00045 void set_all_xinfo (const gchar *key, 00046 const gchar *value) 00047 { 00048 set_chunks_xinfo (key, value, -1, true); 00049 } 00050 void set_chunk_xinfo (gfloat osc_freq, 00051 const gchar *key, 00052 const gchar *value) 00053 { 00054 set_chunks_xinfo (key, value, osc_freq, false); 00055 } 00056 BseErrorType add_chunk (GslDataHandle *dhandle, 00057 gchar **xinfos = NULL); 00058 GslDataHandle* lookup (gfloat osc_freq); 00059 bool match (const WaveChunk &wchunk, 00060 vector<float> &sorted_freqs); 00061 void remove (list<WaveChunk>::iterator it); 00062 void sort (); 00063 BseErrorType store (const string file_name); 00064 /*Des*/ ~Wave (); 00065 }; 00066 00067 } // BseWaveTool 00068 00069 #endif /* __BWT_WAVE_H__ */