public AudioGraphEventArgs(AudioUnitRenderActionFlags actionFlags, AudioTimeStamp timeStamp, int busNumber, int numberFrames, AudioBufferList data) : base(actionFlags, timeStamp, busNumber, numberFrames, data) { }
public AudioUnitEventArgs(AudioUnitRenderActionFlags actionFlags, AudioTimeStamp timestamp, int busNumber, int frames, AudioBufferList data) { ActionFlags = actionFlags; this.TimeStamp = timestamp; BusNumber = busNumber; NumberFrames = frames; Data = data; }
static AudioUnitStatus RenderCallbackImpl (IntPtr clientData, ref AudioUnitRenderActionFlags actionFlags, ref AudioTimeStamp timeStamp, uint busNumber, uint numberFrames, IntPtr data) { GCHandle gch = GCHandle.FromIntPtr (clientData); var au = (AUGraph) gch.Target; RenderDelegate callback; if (!au.nodesCallbacks.TryGetValue (busNumber, out callback)) return AudioUnitStatus.InvalidParameter; using (var buffers = new AudioBuffers (data)) { return callback (actionFlags, timeStamp, busNumber, numberFrames, buffers); } }
static AudioUnitStatus renderCallback(IntPtr inRefCon, ref AudioUnitRenderActionFlags _ioActionFlags, ref AudioTimeStamp _inTimeStamp, uint _inBusNumber, uint _inNumberFrames, IntPtr _ioData) { // getting audiounit instance var handler = GCHandle.FromIntPtr (inRefCon); var inst = (AUGraph)handler.Target; HashSet<RenderDelegate> renderers = inst.graphUserCallbacks; if (renderers.Count != 0) { using (var buffers = new AudioBuffers (_ioData)) { foreach (RenderDelegate renderer in renderers) renderer (_ioActionFlags, _inTimeStamp, _inBusNumber, _inNumberFrames, buffers); return AudioUnitStatus.OK; } } return AudioUnitStatus.InvalidParameter; }
static int oldRenderCallback(IntPtr inRefCon, ref AudioUnitRenderActionFlags _ioActionFlags, ref AudioTimeStamp _inTimeStamp, int _inBusNumber, int _inNumberFrames, AudioBufferList _ioData) { // getting audiounit instance var handler = GCHandle.FromIntPtr(inRefCon); var inst = (AUGraph)handler.Target; // invoke event handler with an argument if (inst.RenderCallback != null){ var args = new AudioGraphEventArgs( _ioActionFlags, _inTimeStamp, _inBusNumber, _inNumberFrames, _ioData); inst.RenderCallback(inst, args); } return 0; // noerror }