SndFileInstrument.h

Go to the documentation of this file.
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 
00026 
00027 #ifndef CSL_SndFile_Instrument_H
00028 #define CSL_SndFile_Instrument_H
00029 
00030 #include "Instrument.h"
00031 
00032 namespace csl  {
00033 
00037 
00038 class SndFileInstrument : public Instrument {
00039 public:
00040     SndFileInstrument(string path, int start = -1, int stop = -1);
00041     SndFileInstrument(string folder, string path, int start = -1, int stop = -1);
00042     ~SndFileInstrument();
00043 
00045     void setParameter(unsigned selector, int argc, void **argv, const char *types);
00047     void play();        
00048     void playOSC(int argc, void **argv, const char *types);     
00049     void playNote(float ampl = 1, float rate = 1, float pos = 0, int start = -1, int stop = -1, 
00050                 float attack = 0.0, float decay = 0.0);
00051     void playMIDI(int chan, int key, int vel);  
00052 
00054     SoundFile mPlayer;                  
00055     AR mEnvelope;                       
00056     Panner mPanner;                     
00057     StaticVariable mRate;               
00058     int mStart, mStop;                  
00059 protected:  
00060     void initialize(string path);
00061 
00062 };
00063 
00064 //class SampleFile : public SoundFile {
00065 //  SampleFile();                           /// Constructor
00066 //  SampleFile(string path, unsigned MIDIKey, double frequency, double minRatio, double maxRatio);
00067 //  ~SampleFile();
00068 //                          /// Data members
00069 //  unsigned mMIDIKey;          // sample's MIDI key #
00070 //  double mFrequency;          // sample's actual frequency
00071 //  double mMinRatio;           // min transp.
00072 //  double mMaxRatio;           // max transp. (often 1.0)
00073 //  
00074 //  double ratioForKey(int desiredMIDI);            // answer rate ratios for the given MIDI or Hz transpositions
00075 //  double ratioForPitch(int desiredMIDI);
00076 
00080 
00081 class SampleBankInstrument : public SndFileInstrument {
00082 public:
00083     SampleBankInstrument();
00084     ~SampleBankInstrument();
00085 
00086     void addSample(SoundFile & sndFile, unsigned midi = 0, double freq = 0.0, double minRatio = 0.75);
00087 
00088     void play();        
00089     void playOSC(int argc, void **argv, const char *types);     
00090     void playNote(float ampl = 1, float rate = 1, float pos = 0, int start = -1, int stop = -1, 
00091                 float attack = 0.0, float decay = 0.0);
00092 
00093 protected:
00094 //  SampleBank mBank;                   ///< sample bank map
00095 
00096 };
00097 
00098 }
00099 
00100 #endif

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