- initial import

git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@37 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2014-10-25 07:27:55 +00:00
commit 843c6e300c
75 changed files with 40248 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
/*
==============================================================================
This file was generated by user!
==============================================================================
*/
#include <math.h>
#include "synth_defs.h"
#include "JaySynthSound.h"
#include "JaySynthVoice.h"
/** A JaySynth voice that just plays incredible sounds.. */
JaySynthVoice::JaySynthVoice(voice_t *pVoice, int id, voice_common_t *pCom)
{
m_pVoice = pVoice;
VoiceInit(pVoice, pCom, id, 44100);
}
JaySynthVoice::~JaySynthVoice()
{
VoiceFree(m_pVoice);
}
void JaySynthVoice::setSampleRate (synth_float_t sampleRate)
{
VoiceSetFS(m_pVoice, sampleRate);
}
void JaySynthVoice::setBufsize (int bufsize)
{
VoiceSetBufsize(m_pVoice, bufsize);
}
bool JaySynthVoice::canPlaySound (SynthesiserSound* sound)
{
return dynamic_cast <JaySynthSound*> (sound) != 0;
}
void JaySynthVoice::startNote (const int midiNoteNumber, const float velocity,
SynthesiserSound* sound, const int /*currentPitchWheelPosition*/)
{
VoiceEvent(m_pVoice, voice_event_trigger);
return;
/*
if (m_pVoice->state == note_state_idle)
{
VoiceEvent(m_pVoice, voice_event_trigger);
}
else
{
VoiceEvent(m_pVoice, voice_event_retrigger);
}
*/
}
void JaySynthVoice::stopNote (const bool allowTailOff)
{
if (allowTailOff)
{
VoiceEvent(m_pVoice, voice_event_release);
}
else
{
// we're being told to stop playing immediately, so reset everything..
VoiceEvent(m_pVoice, voice_event_release);
clearCurrentNote();
}
}
void JaySynthVoice::pitchWheelMoved (const int /*newValue*/)
{
}
void JaySynthVoice::controllerMoved (const int /*controllerNumber*/, const int /*newValue*/)
{
}
void JaySynthVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples)
{
/* Done in JaySynth::renderNextBlock()
float *buf1 = outputBuffer.getSampleData (0, startSample);
float *buf2 = outputBuffer.getSampleData (1, startSample);
VoiceProcessDataV_Common(m_pVoice, buf1, buf2, numSamples);
if (m_pVoice->state == note_state_idle)
return;
VoiceProcessDataV(m_pVoice, buf1, buf2, numSamples);
if (m_pVoice->state == note_state_idle)
clearCurrentNote();
*/
}
void JaySynthVoice::setParameter(int index, synth_float_t value)
{
VoiceParam2Set(m_pVoice, index, value);
}