GeneralParamError from InputAudioQueue.Start()
var bytesPerFrame = 1 * sizeof(short);
var description = new AudioStreamBasicDescription()
{
Format = AudioFormatType.LinearPCM,
SampleRate = 16000,
ChannelsPerFrame = 1,
BitsPerChannel = 16,
FormatFlags = AudioFormatFlags.LinearPCMIsSignedInteger | AudioFormatFlags.LinearPCMIsPacked,
FramesPerPacket = 1,
BytesPerPacket = bytesPerFrame,
BytesPerFrame = bytesPerFrame,
Reserved = 0
};
InputAudioQueue _inputAudioQueue = new InputAudioQueue(description);
_inputAudioQueue.InputCompleted += OnInputCompleted;
AudioQueueStatus status;
try
{
status = _inputAudioQueue.Start();
if (status != AudioQueueStatus.Ok)
{
Debug.WriteLine("Input audio queue did not start");
}
}
catch (Exception e)
{
...
}
I have a .NET Maui project, and I've simplified the code around InputAudioQueue
to what I have above. When the Start()
method is called on the _inputAudioQueue
object, I occasionally get a AudioQueueStatus.GeneralParamError
back as the response.
I would appreciate any help / insights as to why this issue might be occurring.
Thank you.
EDIT:
Dotnet version: 8
Frequency of occurrence : This only happens about 5% of the time, it works well for the remaining 95% of the time.
I don't have any idea how to reproduce, and it just seems random to me.
Also I have a loop that retries the Start every 5 seconds, but once the error starts, it will keep happening on every retry.
If I close the app and try again, it can either still have the issue, or the error just goes away for a long time, which is why I originally said it happens "occasionally".
It is very random.
Is there a way to get more details when the failure occurs, instead of just the enum ? as that would help me further investigate too.
There's very little documentation on the enum responses.