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
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
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
00095
00096 };
00097
00098 }
00099
00100 #endif