C# Class Synthesizer, unity_synthesizer

Inheritance: MonoBehaviour
Mostra file Open project: calvinbaart/unity_synthesizer Class Usage Examples

Public Properties

Property Type Description
DampSpeed float
OnNotePressed OnNotePressedDelegate
OnNoteReleased OnNoteReleasedDelegate
OnStartedPlaying OnStartedPlayingDelegate
OnStoppedPlaying OnStoppedPlayingDelegate
SoundThreshold float
Threshold double
comboBoxList GUIContent[]
midi Midi,
soundPack MidiSoundPack,

Public Methods

Method Description
CalculateVolume ( int channelIndex ) : void

Calculates the actual volume of the channel based on the volume and expression (both coarse and fine)

SetExpression ( int channelIndex, int expression, bool isFine ) : void

Called by the application to set the expression of a specific channel.

SetInstrument ( int channelIndex, Instrument, instrument ) : void

Called by the application to set the Instrument of a specific channel

SetNote ( int channelIndex, int note, int octave, float velocity, bool on ) : void

Called by the application to set the properties of a specific note & octave.

SetPan ( int channelIndex, int pan, bool isFine ) : void

Called by the application to set the pan of a specific channel.

SetPitchBend ( int channelIndex, int bend ) : void

Called by the application to set the Pitch bend of a specific channel.

SetReverb ( int channelIndex, int reverb ) : void

Called by the application to set the reverb of a specific channel.

SetSustain ( int channelIndex, bool sustain ) : void

Called by the application to set the sustain of a specific channel.

SetVolume ( int channelIndex, int volume, bool isFine ) : void

Called by the applicatiion to set the volume of a specific channel.

StartPlaying ( ) : void

Called by the Synthesizer when the Synthesizer starts playing.

StopPlaying ( ) : void

Called by the Synthesizer when the Synthesizer stops playing.

Protected Methods

Method Description
Mix ( double sample, double threshold ) : double

Mixing formula developed by Camiel. This function makes sure the audio sample stays within the -t/t range.

OnAudioFilterRead ( float data, int channels ) : void

Called by unity when new audio data is requested. This function processes active audio clips, puts them in the correct channel and applies dampening and volume changes to the channel.

OnGUI ( ) : void

Called by Unity when the Component should render the UI.

Private Methods

Method Description
OnEnable ( ) : void

Called by Unity when the Component is enabled. This function initializes the AudioChannels and sets up the UI style.

Method Details

CalculateVolume() public method

Calculates the actual volume of the channel based on the volume and expression (both coarse and fine)
public CalculateVolume ( int channelIndex ) : void
channelIndex int The channel to apply the change to. (range: 0-16)
return void

Mix() protected static method

Mixing formula developed by Camiel. This function makes sure the audio sample stays within the -t/t range.
protected static Mix ( double sample, double threshold ) : double
sample double
threshold double
return double

OnAudioFilterRead() protected method

Called by unity when new audio data is requested. This function processes active audio clips, puts them in the correct channel and applies dampening and volume changes to the channel.
protected OnAudioFilterRead ( float data, int channels ) : void
data float Buffer to write the new audio data to
channels int Number of channels to request data for
return void

OnGUI() protected method

Called by Unity when the Component should render the UI.
protected OnGUI ( ) : void
return void

SetExpression() public method

Called by the application to set the expression of a specific channel.
public SetExpression ( int channelIndex, int expression, bool isFine ) : void
channelIndex int The channel to apply the change to. (range: 0-16)
expression int Expression of the channel
isFine bool Determines if the expression set is the coarse or fine expression.
return void

SetInstrument() public method

Called by the application to set the Instrument of a specific channel
public SetInstrument ( int channelIndex, Instrument, instrument ) : void
channelIndex int The channel to apply the change to. (range: 0-16)
instrument Instrument, Instrument of the channel
return void

SetNote() public method

Called by the application to set the properties of a specific note & octave.
public SetNote ( int channelIndex, int note, int octave, float velocity, bool on ) : void
channelIndex int The channel to apply the change to. (range: 0-16)
note int The note to apply the change to.
octave int The octave to apply the change to.
velocity float The velocity of the key press. (Only applicable when on = true).
on bool Determines wether the note is on or off.
return void

SetPan() public method

Called by the application to set the pan of a specific channel.
public SetPan ( int channelIndex, int pan, bool isFine ) : void
channelIndex int The channel to apply the change to. (range: 0-16)
pan int Pan of the channel
isFine bool Determines if the pan set is the coarse or fine pan.
return void

SetPitchBend() public method

Called by the application to set the Pitch bend of a specific channel.
public SetPitchBend ( int channelIndex, int bend ) : void
channelIndex int The channel to apply the change to. (range: 0-16)
bend int Bend of the channel
return void

SetReverb() public method

Called by the application to set the reverb of a specific channel.
public SetReverb ( int channelIndex, int reverb ) : void
channelIndex int The channel to apply the change to. (range: 0-16)
reverb int Reverb of the channel
return void

SetSustain() public method

Called by the application to set the sustain of a specific channel.
public SetSustain ( int channelIndex, bool sustain ) : void
channelIndex int The channel to apply the change to. (range: 0-16)
sustain bool Sustain of the channel
return void

SetVolume() public method

Called by the applicatiion to set the volume of a specific channel.
public SetVolume ( int channelIndex, int volume, bool isFine ) : void
channelIndex int The channel to apply the change to. (range: 0-16)
volume int Volume of the channel
isFine bool Determines if the volume set is the coarse or fine volume.
return void

StartPlaying() public method

Called by the Synthesizer when the Synthesizer starts playing.
public StartPlaying ( ) : void
return void

StopPlaying() public method

Called by the Synthesizer when the Synthesizer stops playing.
public StopPlaying ( ) : void
return void

Property Details

DampSpeed public_oe static_oe property

public static float DampSpeed
return float

OnNotePressed public_oe property

public OnNotePressedDelegate OnNotePressed
return OnNotePressedDelegate

OnNoteReleased public_oe property

public OnNoteReleasedDelegate OnNoteReleased
return OnNoteReleasedDelegate

OnStartedPlaying public_oe property

public OnStartedPlayingDelegate OnStartedPlaying
return OnStartedPlayingDelegate

OnStoppedPlaying public_oe property

public OnStoppedPlayingDelegate OnStoppedPlaying
return OnStoppedPlayingDelegate

SoundThreshold public_oe static_oe property

public static float SoundThreshold
return float

Threshold public_oe static_oe property

public static double Threshold
return double

comboBoxList public_oe property

public GUIContent[] comboBoxList
return GUIContent[]

midi public_oe property

public Midi, midi
return Midi,

soundPack public_oe property

public MidiSoundPack, soundPack
return MidiSoundPack,