I am trying to use the iOS sink node as in the following example
Visual Studio 2022 17.4.4
Remote connection to Mac
using System;
using System.Runtime.InteropServices;
using System.Threading;
using Foundation;
using AudioToolbox;
using AVFoundation;
using UIKit;
void SomeFunc()
{
var engine = new AVAudioEngine();
var inputNode = engine.InputNode;
var inputFormat = inputNode.GetBusOutputFormat(0);
var handler = new AVAudioSinkNodeReceiverHandler(SinkHandler);
var sinkNode = new AVAudioSinkNode(handler);
engine.AttachNode(sinkNode);
engine.Connect(inputNode, sinkNode, inputFormat);
NSError error;
engine.StartAndReturnError(out error);
}
int SinkHandler(AudioTimeStamp ts, uint n, ref AudioBuffers buffers)
{
int nCh = buffers.Count;
for (int i = 0; i < nCh; i++)
{
var f = buffers[i].Data;
Marshal.Copy(f, data, 0, (int)n);
}
return 0;
}
The program crash since buffers is not a valid reference to AudioBuffers. Also it is strange to use a ref parameter in the delegate
AVAudioSinkNodeReceiverHandler. I cannot find a way to make it work
I am trying to use the iOS sink node as in the following example Visual Studio 2022 17.4.4 Remote connection to Mac
The program crash since buffers is not a valid reference to AudioBuffers. Also it is strange to use a ref parameter in the delegate AVAudioSinkNodeReceiverHandler. I cannot find a way to make it work