Permalink
Browse files

Merge pull request #53 from philburk/noteplayer

MultiChannelSynthesizer: add noteOn and noteOff with timestamp
  • Loading branch information...
philburk committed Aug 1, 2017
2 parents 464f3d5 + d20f15b commit b006311f7290fd63a789bed8a7867121aa8096f6
Showing with 31 additions and 1 deletion.
  1. +31 −1 src/com/jsyn/util/MultiChannelSynthesizer.java
@@ -161,9 +161,16 @@ void noteOff(int noteNumber, double amplitude) {
groupContext.allocator.noteOff(noteNumber, synth.createTimeStamp());
}
void noteOff(int noteNumber, double amplitude, TimeStamp timeStamp) {
groupContext.allocator.noteOff(noteNumber, timeStamp);
}
void noteOn(int noteNumber, double amplitude) {
noteOn(noteNumber, amplitude, synth.createTimeStamp());
}
void noteOn(int noteNumber, double amplitude, TimeStamp timeStamp) {
double frequency = AudioMath.pitchToFrequency(noteNumber);
TimeStamp timeStamp = synth.createTimeStamp();
//System.out.println("noteOn(noteNumber) -> " + frequency + " Hz");
groupContext.allocator.noteOn(noteNumber, frequency, amplitude, voiceOperation, timeStamp);
}
@@ -279,6 +286,17 @@ public void noteOff(int channel, int noteNumber, double amplitude) {
channelContext.noteOff(noteNumber, amplitude * mMasterAmplitude);
}
/**
* Turn off a note.
* @param channel
* @param noteNumber
* @param amplitude between 0 and 1.0, will be scaled by masterAmplitude
*/
public void noteOff(int channel, int noteNumber, double amplitude, TimeStamp timeStamp) {
ChannelContext channelContext = channels[channel];
channelContext.noteOff(noteNumber, amplitude * mMasterAmplitude, timeStamp);
}
/**
* Turn on a note.
* @param channel
@@ -289,6 +307,18 @@ public void noteOn(int channel, int noteNumber, int velocity) {
double amplitude = velocity * (1.0 / MAX_VELOCITY);
noteOn(channel, noteNumber, amplitude);
}
/**
* Turn on a note.
* @param channel
* @param noteNumber
* @param amplitude between 0 and 1.0, will be scaled by masterAmplitude
*/
public void noteOn(int channel, int noteNumber, double amplitude, TimeStamp timeStamp) {
ChannelContext channelContext = channels[channel];
channelContext.noteOn(noteNumber, amplitude * mMasterAmplitude, timeStamp);
}
/**
* Turn on a note.
* @param channel

0 comments on commit b006311

Please sign in to comment.