Files
JaySynth/Source/JaySynthVoice.h
T
jens 843c6e300c - initial import
git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@37 b431acfa-c32f-4a4a-93f1-934dc6c82436
2014-10-25 07:27:55 +00:00

80 lines
2.0 KiB
C++

/*
==============================================================================
This file was generated by user!
==============================================================================
*/
#ifndef _JAYSYNTHVOICE_H_
#define _JAYSYNTHVOICE_H_
#include "../JuceLibraryCode/JuceHeader.h"
#include "synth_defs.h"
class JaySynthVoice
{
public:
JaySynthVoice(voice_t *pVoice, int id, voice_common_t *pCom);
~JaySynthVoice();
void setSampleRate (synth_float_t sampleRate);
void setBufsize (int bufsize);
bool canPlaySound (SynthesiserSound* sound);
void startNote (const int midiNoteNumber, const float velocity,
SynthesiserSound* /*sound*/, const int /*currentPitchWheelPosition*/);
void stopNote (const bool allowTailOff);
void pitchWheelMoved (const int newValue);
void controllerMoved (const int controllerNumber, const int newValue);
void renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples);
void setParameter(int index, synth_float_t value);
int getCurrentlyPlayingNote() const
{
return currentlyPlayingNote;
}
SynthesiserSound::Ptr getCurrentlyPlayingSound() const
{
return currentlyPlayingSound;
}
bool isPlayingChannel (int midiChannel) const
{
return currentlyPlayingSound != nullptr
&& currentlyPlayingSound->appliesToChannel (midiChannel);
}
void setCurrentPlaybackSampleRate (double newRate)
{
currentSampleRate = newRate;
}
double getSampleRate() const
{
return currentSampleRate;
}
void clearCurrentNote()
{
currentlyPlayingNote = -1;
currentlyPlayingSound = nullptr;
}
private:
friend class JaySynth;
voice_t *m_pVoice;
synth_float_t note_on_time;
double currentSampleRate;
int currentlyPlayingNote;
uint32 noteOnTime;
SynthesiserSound::Ptr currentlyPlayingSound;
bool keyIsDown; // the voice may still be playing when the key is not down (i.e. sustain pedal)
bool sostenutoPedalDown;
};
#endif // _JAYSYNTHVOICE_H_