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(Instrument&);                            
00061     ~Instrument();
00063     UnitGenerator * graph() { return mGraph; };         
00064     UGenMap * genMap() { return & mUGens; };            
00065     UGenVector * envelopes() { return & mEnvelopes; };  
00066 
00067     const string name() { return mName; };              
00068 
00069     UnitGenerator * genNamed(string name);              
00070 
00072     AccessorVector getAccessors() { return mAccessors; };               
00073     unsigned numAccessors() { return mAccessors.size(); };              
00074     virtual void setParameter(unsigned selector, int argc, void **argv, const char *types) { }; 
00075 //  virtual float getParameter(unsigned selector);
00076     
00077     virtual void nextBuffer(Buffer & outputBuffer) throw (CException);  
00078     
00079     virtual bool isActive();                                            
00080     virtual void play();        
00081     virtual void playOSC(int argc, void **argv, const char *types) { }; 
00082     virtual void playNote(int argc, void **argv, const char *types) { };    
00083     virtual void playMIDI(float dur, int chan, int key, int vel) { };   
00084     virtual void release(); 
00085 
00086 protected:          
00087     UnitGenerator * mGraph;         
00088     string mName;                   
00089     UGenMap mUGens;                 
00090     UGenVector mEnvelopes;          
00091     AccessorVector mAccessors;      
00092 };
00093 
00094 }
00095 
00096 #endif

Generated on Sat Oct 17 14:12:31 2009 for CSL by  doxygen 1.4.5-20051010