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 
00053     SoundFile mPlayer;                  
00054     AR mEnvelope;                       
00055     Panner mPanner;                     
00056     StaticVariable mRate;               
00057     int mStart, mStop;                  
00058 protected:  
00059     void initialize(string path);
00060 
00061 };
00062 
00063 //class SampleFile : public SoundFile {
00064 //  SampleFile();                           /// Constructor
00065 //  SampleFile(string path, unsigned MIDIKey, double frequency, double minRatio, double maxRatio);
00066 //  ~SampleFile();
00067 //                          /// Data members
00068 //  unsigned mMIDIKey;          // sample's MIDI key #
00069 //  double mFrequency;          // sample's actual frequency
00070 //  double mMinRatio;           // min transp.
00071 //  double mMaxRatio;           // max transp. (often 1.0)
00072 //  
00073 //  double ratioForKey(int desiredMIDI);            // answer rate ratios for the given MIDI or Hz transpositions
00074 //  double ratioForPitch(int desiredMIDI);
00075 
00079 
00080 class SampleBankInstrument : public SndFileInstrument {
00081 public:
00082     SampleBankInstrument();
00083     ~SampleBankInstrument();
00084 
00085     void addSample(SoundFile & sndFile, unsigned midi = 0, double freq = 0.0, double minRatio = 0.75);
00086 
00087     void play();        
00088     void playOSC(int argc, void **argv, const char *types);     
00089     void playNote(float ampl = 1, float rate = 1, float pos = 0, int start = -1, int stop = -1, 
00090                 float attack = 0.0, float decay = 0.0);
00091 
00092 protected:
00093 //  SampleBank mBank;                   ///< sample bank map
00094 
00095 };
00096 
00097 }
00098 
00099 #endif

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