6 #include "MemoryWvIn.h"
28 const int DRUM_NUMWAVES = 11;
29 const int DRUM_POLYPHONY = 4;
50 void noteOn( StkFloat instrument, StkFloat amplitude );
56 StkFloat
tick(
unsigned int channel = 0 );
70 OnePole filters_[DRUM_POLYPHONY];
71 std::vector<int> soundOrder_;
72 std::vector<int> soundNumber_;
79 if ( nSounding_ == 0 )
return lastFrame_[0];
81 for (
int i=0; i<DRUM_POLYPHONY; i++ ) {
82 if ( soundOrder_[i] >= 0 ) {
83 if ( waves_[i].isFinished() ) {
85 for (
int j=0; j<DRUM_POLYPHONY; j++ ) {
86 if ( soundOrder_[j] > soundOrder_[i] )
93 lastFrame_[0] += filters_[i].
tick( waves_[i].
tick() );
102 unsigned int nChannels = lastFrame_.
channels();
103 #if defined(_STK_DEBUG_)
104 if ( channel > frames.
channels() - nChannels ) {
105 oStream_ <<
"Drummer::tick(): channel and StkFrames arguments are incompatible!";
110 StkFloat *samples = &frames[channel];
111 unsigned int j, hop = frames.
channels() - nChannels;
112 if ( nChannels == 1 ) {
113 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop )
117 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
119 for ( j=1; j<nChannels; j++ )
120 *samples++ = lastFrame_[j];
STK drum sample player class.
Definition: Drummer.h:32
~Drummer(void)
Class destructor.
void noteOn(StkFloat instrument, StkFloat amplitude)
Start a note with the given drum type and amplitude.
void noteOff(StkFloat amplitude)
Stop a note with the given amplitude (speed of decay).
StkFloat tick(unsigned int channel=0)
Compute and return one output sample.
Definition: Drummer.h:76
Drummer(void)
Class constructor.
STK audio file input class.
Definition: FileWvIn.h:53
STK instrument abstract base class.
Definition: Instrmnt.h:20
STK one-pole filter class.
Definition: OnePole.h:21
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition: OnePole.h:80
An STK class to handle vectorized audio data.
Definition: Stk.h:287
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition: Stk.h:415
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition: Stk.h:418
static void handleError(const char *message, StkError::Type type)
Static function for error reporting and handling using c-strings.
The STK namespace.
Definition: ADSR.h:8