com.softsynth.jsyn
Class SynthPort

java.lang.Object
  extended by com.softsynth.jsyn.SynthPort
Direct Known Subclasses:
SynthBusInput, SynthBusOutput, SynthDataQueue, SynthScalarPort, SynthTablePort

public class SynthPort
extends java.lang.Object

SynthPort class for Java Audio Synthesis

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

Method Summary
 java.lang.String getAlias()
           
 java.lang.String getName()
           
 int getNumParts()
          Get number of parts in a port.
 int getSignalType()
           
 int getSignalType(int partIndex)
           
 SynthSound getSound()
           
 void setAlias(java.lang.String alias)
           
 void setSignalType(int signalType)
           
 void setSignalType(int signalType, int partIndex)
          NOTE: Signal types are being phased out.
 void setSignalType(SynthPort port)
          Set signal type to the type of the passed in port.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setAlias

public void setAlias(java.lang.String alias)

getAlias

public java.lang.String getAlias()

getName

public java.lang.String getName()

getSound

public SynthSound getSound()
Returns:
SynthSound that contains this port.

setSignalType

public void setSignalType(int signalType,
                          int partIndex)
                   throws SynthException
NOTE: Signal types are being phased out. You don't need to worry about these any more. Use Filter_StateVariable instead of StateVariableFilter because it does not need setSignalType().

Specify type of signal that the port uses. This controls how values passed using set are converted to internal raw values. SynthUnits typically have their ports set to the appropriate signal type. Thus if you set the Frequency of an Osc_Triangle directly you will not need to call setSignalType. But if you are calculating frequency control signals using StateVariableFilters and Math units then you may wish to set their port signal types so that you can specify the port values in Hertz. For example, you may be calculating StateVariableFilter frequency using a MultiplyAddUnit. Set the ports that control modulation depth and center frequency to SIGNAL_TYPE_SVF_FREQ so that these values may be specified in Hertz. Using setSignalType() will help ensure that your sounds will be the same regardless of the Engine's frame rate.

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 portHash out of range, or signalType is invalid, or one tries to switch between signed and unsigned signal types.

setSignalType

public void setSignalType(int signalType)
                   throws SynthException
Throws:
SynthException

getSignalType

public int getSignalType(int partIndex)
                  throws SynthException
Throws:
SynthException

getSignalType

public int getSignalType()
                  throws SynthException
Throws:
SynthException

setSignalType

public void setSignalType(SynthPort port)
                   throws SynthException
Set signal type to the type of the passed in port.

Throws:
SynthException - If port portHash is not recognized, or index out of range, or signalType is invalid, or one tries to switch between signed and unsigned signal types.

getNumParts

public int getNumParts()
                throws SynthException
Get number of parts in a port. For example, LineOut's input port has two parts numbered 0 and 1.

Throws:
SynthException