Reputation: 189
Here is my code:
var queue: AudioQueueRef
error = AudioQueueNewOutput(&dataFormat,
AQOutputCallback,
&player,
nil,
nil,
0,
&queue) // This gives me an error
I get an error associated with the queue
variable: "Cannot pass immutable value as inout argument: implicit conversion from 'AudioQueueRef' to 'AudioQueueRef?' requires a temporary". AudioQueueNewOutput
requires that parameter to be of type UnsafeMutablePointer<AudioQueueRef?>
. I don't know how to implement that conversion.
Any ideas on how to fix this? Thanks.
Upvotes: 0
Views: 247
Reputation: 9540
As it says that AudioQueueRef
must be inout
parameter means the same variable will change it's value anytime to new or old. So, you must define it as an Optional
like below:
var queue: AudioQueueRef?
var error = AudioQueueNewOutput(&dataFormat,
AQOutputCallback,
&player,
nil,
nil,
0,
&queue)
Let me know, if you still face any issues.
Upvotes: 2