Instrument.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef INCLUDE_Instrument_H
00010 #define INCLUDE_Instrument_H
00011 
00012 #include "CSL_Includes.h"
00013 #include "Accessor.h"
00014 
00018 
00019 #define set_duration_f  100         // basic accessors: dur, amp, freq, pos
00020 #define set_amplitude_f 101
00021 #define set_frequency_f 102
00022 #define set_position_f  103         // position as a float or a point
00023 #define set_position_p  104
00024 
00025 #define  set_attack_f       105         // ADSR envelope
00026 #define  set_decay_f        106
00027 #define  set_sustain_f  107
00028 #define  set_release_f  108
00029 
00030 #define  set_iattack_f      110         // 2nd ADSR envelope (index, mod)
00031 #define  set_idecay_f       111
00032 #define  set_isustain_f 112
00033 #define  set_irelease_f 113
00034 
00035 #define  set_index_f        114         // Various frequencies
00036 #define  set_c_freq_f       115
00037 #define  set_m_freq_f   116
00038 
00039 #define  set_vib_depth_f    120         // Vibrato, attack-chiff
00040 #define  set_chiff_amt_f    121
00041 #define  set_chiff_time_f   122
00042 
00043 #define set_rate_f      125         // Sampler file, start, stop, rate
00044 #define set_file_f      126
00045 #define set_start_f     127
00046 #define set_stop_f      128
00047 
00048 #define  set_partial_f      130         // SumOfSines partial and partial list
00049 #define  set_partials_f 131
00050 
00051 namespace csl  {
00052 
00056 class Instrument : public UnitGenerator {
00057 public:
00059     Instrument();
00060     ~Instrument();
00062     UnitGenerator * graph() { return mGraph; };         
00063     UGenMap * genMap() { return & mUGens; };            
00064     UGenVector * envelopes() { return & mEnvelopes; };  
00065 
00066     const string name() { return mName; };              
00067 
00068     UnitGenerator * genNamed(string name);          
00069     
00071     AccessorVector getAccessors() { return mAccessors; };               
00072     unsigned numAccessors() { return mAccessors.size(); };              
00073     virtual void setParameter(unsigned selector, int argc, void **argv, const char *types) { }; 
00074 //  virtual float getParameter(unsigned selector);
00075     
00076     virtual void nextBuffer(Buffer & outputBuffer) throw (CException);  
00077     
00078     virtual bool isActive();                            
00079     virtual void play();        
00080     virtual void playOSC(int argc, void **argv, const char *types) { };     
00081     virtual void playNote(int argc, void **argv, const char *types) { };    
00082     virtual void release(); 
00083 
00084 protected:          
00085     UnitGenerator * mGraph;         
00086     string mName;                   
00087     UGenMap mUGens;             
00088     UGenVector mEnvelopes;          
00089     AccessorVector mAccessors;      
00090 };
00091 
00092 }
00093 
00094 #endif

Generated on Thu Sep 17 23:14:15 2009 for CSL by  doxygen 1.5.8