BluetoothA2DPSink and MemoryStream of a byte[] sound both to I2sStream #1676
-
Hi all, I'm trying to build a bluetooth speaker. I would play a sound (eg. a voice that tells "Connected") when a bluetooth device is connected. It works only at the first time. If I turn off and on the bluetooth of my phone, the second time the voice doesn't works anymore and the followin error is logged in the serial monitor:
What is the proper way to reproduce the sound inside connected callback?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you connect the BluetoothA2DPSink with a I2SStream, the i2s is automatically started and ended by the sink. You try to write to a closed i2sStream! So either open it by calling begin() in your playConnectedVoice or don't connect the i2sStream (and thus always leave it open) and do the a2dp audio output from the callback yourself. |
Beta Was this translation helpful? Give feedback.
If you connect the BluetoothA2DPSink with a I2SStream, the i2s is automatically started and ended by the sink.
You try to write to a closed i2sStream!
So either open it by calling begin() in your playConnectedVoice or don't connect the i2sStream (and thus always leave it open) and do the a2dp audio output from the callback yourself.