MidiPlayer.OnAudioFilterRead C# (CSharp) Method

OnAudioFilterRead() private method

private OnAudioFilterRead ( float data, int channels ) : void
data float
channels int
return void
    void OnAudioFilterRead(float[] data, int channels)
    {
        //This uses the Unity specific float method we added to get the buffer
        if (synthesizer == null ) return;
        synthesizer.GetNext (sampleBuffer);

        for (int i = 0; i < data.Length; i++) {
            data[i] = sampleBuffer[i] * gain;
        }
    }