com.softsynth.jsyn
Class SynthVariable

java.lang.Object
  extended by com.softsynth.jsyn.SynthPort
      extended by com.softsynth.jsyn.SynthScalarPort
          extended by com.softsynth.jsyn.SynthVariable
Direct Known Subclasses:
SynthInput

public class SynthVariable
extends SynthScalarPort

SynthVariables are ports that can be set but not connected.

Author:
(C) 1997 Phil Burk, SoftSynth.com, All Rights Reserved

Method Summary
 double get(int partIndex)
           
 double getCurrent()
           
 double getCurrent(int partIndex)
          This method reaches down to inside the native unit and returns the current value of the signal in its raw form.
 double getMax()
           
 double getMin()
           
 void set(double value)
           
 void set(double value, int partIndex)
           
 void set(int time, double value)
           
 void set(int time, double value, int partIndex)
          Set the value of a port that controls the instrument.
 void setAt(int time, double value)
          Deprecated. Set now has a selector with time as first parameter.
 void setAt(int time, int partIndex, double value)
          Deprecated. Set now has a selector with time as first parameter.
 void setMax(double max)
          Set maximum preferred value.
 void setMin(double min)
          Set minimum preferred value.
 void setSignalType(int signalType, int partIndex)
          Set type for conversion when set() called.
 void setup(double min, double value, double max)
          Conveniance method for setting minimum, current, and maximum values.
 
Methods inherited from class com.softsynth.jsyn.SynthScalarPort
get
 
Methods inherited from class com.softsynth.jsyn.SynthPort
getAlias, getName, getNumParts, getSignalType, getSignalType, getSound, setAlias, setSignalType, setSignalType, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

setSignalType

public void setSignalType(int signalType,
                          int partIndex)
                   throws SynthException
Set type for conversion when set() called.

Overrides:
setSignalType in class SynthPort
Parameters:
signalType - Selects signal type. Legal values are:
  • Synth.SIGNAL_TYPE_RAW_SIGNED = internal signal type that ranges from -1.0 to +1.0. This is used for Amplitude as an example.
  • Synth.SIGNAL_TYPE_RAW_UNSIGNED = internal signal type that ranges from 0.0 to +2.0. This is used for Amplitude as an example.
  • Synth.SIGNAL_TYPE_OSC_FREQ = oscillator frequency. Using this signal type allows you to call set with Frequency values in Hertz. (SIGNED)
  • Synth.SIGNAL_TYPE_SAMPLE_RATE = SynthSample reader sample rate. Using this signal type allows you to call set with SynthSample rate values in Hertz. The frequency that you actually hear will depend on the content of the sample. A bassoon sample played at 44100 Hz will sound lower than a picollo sample played at 44100 Hz. (UNSIGNED)
  • Synth.SIGNAL_TYPE_HALF_LIFE = half life of an exponential decay function. (UNSIGNED)
Throws:
SynthException - If partIndex out of range or illegal signalType.

setAt

public void setAt(int time,
                  int partIndex,
                  double value)
           throws SynthException
Deprecated. Set now has a selector with time as first parameter.

Throws:
SynthException - If partIndex out of range.
See Also:
set(int, double, int)

setAt

public void setAt(int time,
                  double value)
           throws SynthException
Deprecated. Set now has a selector with time as first parameter.

Throws:
SynthException - If internal error occured.
See Also:
set(int, double, int)

set

public void set(int time,
                double value,
                int partIndex)
         throws SynthException
Set the value of a port that controls the instrument. For example:
        sawtooth.amplitude.set( 0.5 );
        sawtooth.frequency.set( Synth.getTickCount() + 100, 220.0 );

Parameters:
time - Time in ticks for setting to occur.
value - Floating point value to set port. Must be in units that correspond to signal type of port.
partIndex - Index of part of multi-part port. Typically zero.
Throws:
SynthException - If partIndex out of range, or port already connected, or port not settable.

set

public void set(int time,
                double value)
         throws SynthException
Throws:
SynthException

set

public void set(double value,
                int partIndex)
         throws SynthException
Throws:
SynthException

set

public void set(double value)
         throws SynthException
Throws:
SynthException

get

public double get(int partIndex)
           throws SynthException
Overrides:
get in class SynthScalarPort
Returns:
last value set() on port.
Throws:
SynthException - If port name is not recognized, or index out of range.

getCurrent

public double getCurrent(int partIndex)
                  throws SynthException
This method reaches down to inside the native unit and returns the current value of the signal in its raw form. It is not converted back to its original signal type so it may not match the value passed to set().

Returns:
current value of port.
Throws:
SynthException - If port name is not recognized, or index out of range.

getCurrent

public double getCurrent()

setMin

public void setMin(double min)
Set minimum preferred value.


getMin

public double getMin()
Returns:
minimum preferred value.

setMax

public void setMax(double max)
Set maximum preferred value.


getMax

public double getMax()
Returns:
maximum preferred value.

setup

public void setup(double min,
                  double value,
                  double max)
           throws SynthException
Conveniance method for setting minimum, current, and maximum values.

Throws:
SynthException - If call to set() fails.