thetwom / toc2

Metronome app
GNU General Public License v3.0
151 stars 23 forks source link

No Bluetooth Sound #12

Closed axel-rank closed 4 years ago

axel-rank commented 4 years ago

When using Bluetooth Connection to an Audio Device there is no Sound in Metronome App.(1.6.6)

thetwom commented 4 years ago

Thanks for the report. Bluetooth works for me. Could you provide some extra information? Mobil device info, Bluetooth device info? Maybe you can even provide Logcat info?

loig commented 4 years ago

I get the same issue. More precisely, I get sound (sometimes) when I select the sound for each pulse (the "sample" sound), but when starting the metronome I do not get sound. When listening to music my bluetooth device works fine.

I am using a Faiphone 2 with Fairphone Open as OS (Android 7.1.2). My device is a JBL GO 2.

I would be happy to run some tests on my phone if this could help you solving this problem. Also if you want more information on my device I would be happy to give it.

thetwom commented 4 years ago

Thanks for the details. I think, we will have to do some tests to track down the issue. To my current knowledge, the audio routing is handled by the Android system, but maybe some configuration changes can help to make Bluetooth work. The sample sounds use another method for playing, so it's no surprise that it behaves differently. I will see when I find some time, for writing a small test app which could hopefully help us tracking down the issue. It would be great if you will then help testing. If you have the opportunity to test with another bluetooth device, please let me know the result. It would be interesting to know if there are device specific issues. Besides it would be interesting, if it works with Lineage 17.1 installed, but I think it's not worth the efforts installing another system. Better we wait until I get some tests ready.

loig commented 4 years ago

I have no other bluetooth device at home. But if I ever have the opportunity to try one I will let you know.

thetwom commented 4 years ago

Ok, no problem. If you find time, maybe you can install a first very simple test app: AudioTrackTest This app only plays a constant tone. Maybe you can install it, and press "start", to see that it is playing something. Test it with and without Bluetooth and report the result. Based on the result, I have to see how to go on.

loig commented 4 years ago

I just installed and tried your test app. When pressing "start" I get a constant tone on my mobile when the bluetooth device is not connected and on the bluetooth device when it is connected. So everything looks fine.

thetwom commented 4 years ago

Thanks for testing so quickly, so at least we know that Bluetooth works in principle. Now it's "just" to find out why it doesn't work in the metronome app. I created a second test which checks different audio buffer sizes: AudioTrackTest 2.0 All options play the same constant tone. Could you check whether some of them do not work with/without Bluetooth?

Besides, is it possible for you to check the following? Start the constant tone using the "minimum buffer size"-option with Bluetooth disconnected. Then while it is playing, connect to Bluetooth. Will the tone continue playing through Bluetooth? Or does it only start playing if you select the option again?

loig commented 4 years ago

Here are my results: all options give a constant tone both with and without bluetooth.

Regarding the second test: I start the constant tone with the minimum buffer size option and it works fine. Then I connect the phone to my bluetooth device. At that point the sound stops (neither my phone nor the device produces sound). If I select the stop sound option and then the minimum buffer size option again, the sound works fine and is coming from the bluetooth device.

thetwom commented 4 years ago

Thanks again for testing.

Based on the results of the second test: Could you make sure that the metronome app is really closed (it shouldn't be active in the background anymore)? Then connect to Bluetooth, start the app and see if it will play through Bluetooth.

loig commented 4 years ago

Still not working. I restarted my mobile, so I guess the metronome app should not be running even in background. I connected to bluetooth, then started the metronome. Nothing changed: when playing the metronome I get no sound however when I change the sounds/use the tool to adjust sound levels, I can ear the sound samples (as before).

thetwom commented 4 years ago

Ok, this would have been too simple :-). Seems as I have to dig a bit deeper, which means moving closer to what the Metronome app is actually doing.

Can you run the following test: AudioTrackTest v3.0? It is pretty much the same as the first test, but does not completely reinitialize when pressing "start" again.

Given that Bluetooth is not working after the test, please restart the app while Bluetooth is on, and try again. (You don't have to restart your phone in this case, since bringing another app into the background should lead to reinitialization. Something which is different for the Metronome app btw ...)

loig commented 4 years ago

I just did the test, and I confirm that it behaves as you expected:

When I then close the app and restart it, I get sound from the bluetooth device.

thetwom commented 4 years ago

Thanks for your patience in testing. Let's try this version: recreateAudioTrack-test1 I am not very confident that it works, but it's worth trying before creating more complicated tests.

loig commented 4 years ago

It is not working as far as I can tell, the behaviour seems to be similar as the last release of your metronome app…

thetwom commented 4 years ago

Ok, still we hopefully get closer. I have an updated test which is quite close what the metronome app is doing (it's still a bit different, so I expect it to work with Bluetooth). Could you install this test: AudioTrackTest v4.0 Then with Bluetooth disconnected:

thetwom commented 4 years ago

Maybe you could also try this Metronome test: recreateAudioTrack-test2

loig commented 4 years ago

For the sound test I can ear the sound in the four cases. Here are the screens.

Without Bluetooth device: Screenshot_20200805-200611 Screenshot_20200805-200619

With device: Screenshot_20200805-200700 Screenshot_20200805-200710

loig commented 4 years ago

With the new metronome version I get sound on the Bluetooth device!

thetwom commented 4 years ago

Sorry for the late response. Thanks a lot for all the testing. Seems like the audio output should better be completely reconfigured when the audio device changes. I am still lacking complete understanding, why some of the tests worked and others didn't, but I think we stop testing here. I will see that I make the changes official during the next days.