コード例 #1
0
        void OnAudioFilterRead(float[] buffer, int channels)
        {
            if (!started)
            {
                return;
            }
            if (buffer.Length != bufferSize)
            {
                Debug.LogError("buffer size does not match jack"); return;
            }
            if (channels != 1)
            {
                Debug.LogError("jack can only accept mono"); return;
            }

            // It is neccesary to make a copy here because the data is managed and will be deleted
            // after the call is finished or before
            System.Array.Copy(buffer, monodata, buffer.Length);
            JackWrapper.WriteBuffer(port, monodata, monodata.Length);
            System.Array.Clear(buffer, 0, buffer.Length);
        }
コード例 #2
0
 void OnDestroy()
 {
     System.Array.Clear(monodata, 0, bufferSize);
     JackWrapper.WriteBuffer(port, monodata, bufferSize);
     monodataHandler.Free();
 }