GeneralParamError from InputAudioQueue.Start()

Kolade Otegbade 0 Reputation points
2025-02-17T11:52:17.6933333+00:00
 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.

Developer technologies | .NET | .NET MAUI
{count} votes

1 answer

Sort by: Most helpful
  1. Kolade Otegbade 0 Reputation points
    2025-08-26T09:22:01.6866667+00:00

    I forgot I asked this question here, apologies. I was able to figure this out eventually, turns out another thread that started an instance of the audioqueue wasn't disposed properly, and I get that error when the new one tries to start another audioqueue. Thank you all for your help and response.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.