/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Software synthesizer voice class.
*
* @author Karl Helgason
*/
public boolean releaseTriggered = false;
boolean stealer_releaseTriggered = false;
boolean sustain = false;
boolean sostenuto = false;
boolean portamento = false;
boolean on = false;
private boolean audiostarted = false;
private boolean started = false;
private boolean stopping = false;
private int osc_stream_nrofchannels;
private boolean osc_stream_off_transmitted = false;
private boolean out_mixer_end = false;
// Last value added to destination
// Pointer to source value
// Key-based override (if any)
// Pointer to destination value
private boolean soundoff = false;
double[] keynumber = co_noteon_keynumber;
double[] velocity = co_noteon_velocity;
double[] on = co_noteon_on;
return null;
return keynumber;
return velocity;
return on;
return null;
}
};
double[] active = co_mixer_active;
double[] gain = co_mixer_gain;
double[] pan = co_mixer_pan;
double[] balance = co_mixer_balance;
double[] reverb = co_mixer_reverb;
double[] chorus = co_mixer_chorus;
return null;
return active;
return gain;
return pan;
return balance;
return reverb;
return chorus;
return null;
}
};
double[] pitch = co_osc_pitch;
return null;
return pitch;
return null;
}
};
double[] freq = co_filter_freq;
double[] ftype = co_filter_type;
double[] q = co_filter_q;
return null;
return freq;
return ftype;
return q;
return null;
}
};
private final int nrofchannels;
synthesizer = synth;
}
if (ic < 120)
return ic;
}
return 120; // Fine tuning
return 121; // Coarse tuning
}
return -1;
}
if (o == null)
return null;
}
else
return value;
}
else
return value;
}
if (keycontrol == -1)
return value;
double key_controlvalue =
return key_controlvalue;
if (value > 1)
value = 1;
else if (value < 0)
value = 0;
}
return value;
}
return;
if (value == 0)
break;
}
} else {
if (value == 0)
break;
}
}
// co_mixer_gain[0] = 0;
}
if (!portamento) {
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
}
note = noteNumber;
}
sustain = false;
sostenuto = false;
portamento = false;
soundoff = false;
on = true;
active = true;
started = true;
// volume = velocity;
lastMuteValue = 0;
lastSoloMuteValue = 0;
if (performer.forcedKeynumber)
else
if (performer.forcedVelocity)
else
filter_left.reset();
if (connections_last == null
}
if (connections_src == null
}
if (connections_dst == null
}
connections_last[i] = 0;
if (connections_src[i] == null
}
double[][] src = connections_src[i];
int[] src_kc = connections_src_kc[i];
connections_src[i] = src;
}
}
.getIdentifier());
else
connections_dst[i] = null;
}
if (extendedConnectionBlocks != null) {
double value = 0;
if (t == null)
value += x;
else
}
} else {
x = processKeyBasedController(x,
if (t == null)
value += x;
else
}
}
if (t != null)
}
}
}
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
}
}
void shutdown() {
return;
on = false;
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
void soundOff() {
on = false;
soundoff = true;
}
if (!on)
return;
on = false;
if (softchannel.sustain) {
sustain = true;
return;
}
if (sostenuto)
return;
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
void redamp() {
return;
return; // don't redamp notes in shutdown stage
sustain = true;
return;
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
void processControlLogic() {
if (stopping) {
active = false;
stopping = false;
audiostarted = false;
instrument = null;
connections = null;
channelmixer = null;
if (osc_stream != null)
try {
osc_stream.close();
} catch (IOException e) {
//e.printStackTrace();
}
if (stealer_channel != null) {
stealer_releaseTriggered = false;
stealer_voiceID = -1;
stealer_noteNumber = 0;
stealer_velocity = 0;
}
}
if (started) {
audiostarted = true;
osc_stream_off_transmitted = false;
if (osc instanceof ModelWavetable) {
try {
} catch (IOException e) {
//e.printStackTrace();
}
} else {
}
osc_buff = new float[osc_stream_nrofchannels][];
if (osc_stream != null)
}
if (audiostarted) {
if (portamento) {
if (note_delta_a < 0.0000000001) {
portamento = false;
} else {
}
if (c == null)
return;
for (int i = 0; i < c.length; i++)
processConnection(c[i]);
}
double filter_freq;
filter_freq = 19912.126958213175;
else
/*
filter_freq = 440.0 * Math.pow(2.0,
((co_filter_freq[0]) - 6900.0) / 1200.0);*/
/*
* double velocity = co_noteon_velocity[0]; if(velocity < 0.5)
* filter_freq *= ((velocity * 2)*0.75 + 0.25);
*/
/*
float gain = (float) Math.pow(10,
(-osc_attenuation + co_mixer_gain[0]) / 200.0);
*/
gain = 0;
if (soundoff) {
stopping = true;
gain = 0;
/*
* if(co_mixer_gain[0] > -960)
* co_mixer_gain[0] -= 960;
*/
}
// gain *= 0.2;
// System.out.println("pan = " + pan);
if (pan < 0)
pan = 0;
else if (pan > 1)
pan = 1;
if (pan == 0.5) {
} else {
}
if (balance != 0.5) {
if (balance > 0.5)
else
}
if (synthesizer.reverb_on) {
} else
out_mixer_effect1 = 0;
if (synthesizer.chorus_on) {
} else
out_mixer_effect2 = 0;
if (!on)
if (!osc_stream_off_transmitted) {
osc_stream_off_transmitted = true;
if (osc_stream != null)
}
}
if (started) {
started = false;
}
}
float amp_to) {
return;
{
int j = 0;
for (int i = 0; i < delay; i++)
} else {
int j = 0;
}
for (int i = 0; i < delay; i++) {
}
}
}
else
{
for (int i = 0; i < bufferlen; i++)
} else {
for (int i = 0; i < bufferlen; i++) {
}
}
}
}
if (!audiostarted)
return;
try {
if (nrofchannels != 1)
if (ret == -1) {
stopping = true;
return;
}
if (nrofchannels != 1)
}
} catch (IOException e) {
//e.printStackTrace();
}
if (osc_stream_nrofchannels == 1)
}
if (nrofchannels == 1) {
} else {
{
}
else
{
else
}
}
} else {
out_mixer_effect1 * 0.5f);
out_mixer_effect2 * 0.5f);
out_mixer_effect1 * 0.5f);
out_mixer_effect2 * 0.5f);
}
if (out_mixer_end) {
stopping = true;
}
}
}