I am working on iOS audio. After struggling with IntPtr-s, which might be a AudioQueueBuffer*,
or pointing to raw samples, I finally managed to make things work.
But, I find below code seems not a good practice.
https://github.com/xamarin/xamarin-macios/blob/e45c3ba794e25c4ecb1c076678b733746ca184e4/src/AudioToolbox/AudioQueue.cs#L499
Steps to Reproduce
Check the source code of AudioQueue.FillAudioData(...).
public static void FillAudioData (IntPtr audioQueueBuffer, int offset, IntPtr source, int sourceOffset, nint size)
{
// Here, location of field AudioData is almost *hard-coded*
IntPtr target = Marshal.ReadIntPtr (audioQueueBuffer, IntPtr.Size);
unsafe {
byte *targetp = (byte *) target;
byte *sourcep = (byte *) source;
Runtime.memcpy (targetp + offset, sourcep + sourceOffset, size);
}
}
Expected Behavior
- Use AudioQueueBuffer.AudioData;
- Use AudioQueueBuffer.CopyToAudioData(IntPtr source, int size).
Actual Behavior
The implementation seems not a good one.
Environment
N/A
Build Logs
N/A
Example Project (If Possible)
N/A
I am working on iOS audio. After struggling with IntPtr-s, which might be a AudioQueueBuffer*,
or pointing to raw samples, I finally managed to make things work.
But, I find below code seems not a good practice.
https://github.com/xamarin/xamarin-macios/blob/e45c3ba794e25c4ecb1c076678b733746ca184e4/src/AudioToolbox/AudioQueue.cs#L499
Steps to Reproduce
Check the source code of AudioQueue.FillAudioData(...).
Expected Behavior
Actual Behavior
The implementation seems not a good one.
Environment
N/A
Build Logs
N/A
Example Project (If Possible)
N/A