Android Question VR audio problem

hookshy

Well-Known Member
Licensed User
Longtime User
Using the streamer object to record audio on some devices makes the voice recognitions unavaillable ...
after pressing a button that raise vr.listen action then an audio problem is raised by google voice recognition window

I have tried initialising streamer with initialize2 method in activity_create with audiosource 0,1,,2,3 but I could not solved the problem
What's the problem ? ...

B4X:
'streamer.Initialize("streamer", mSampleRate, mMono, mBitRate, streamer.VOLUME_MUSIC)
        streamer.Initialize2(1,"streamer", mSampleRate, mMono, mBitRate, streamer.VOLUME_MUSIC)
 

hookshy

Well-Known Member
Licensed User
Longtime User
No that is the problem the recorder is stopped ...I only initialize the streamer...in the activity create so I could record later on
The app works great on other devices with vr and streamer ... both initialised in activity create
Nothing special in the unfiltered logs ....

As soon as I start the app without streamer initialisation the audio problem on vr window is gone
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can try to release the internal AudioTrack object before you start the VR:
B4X:
Dim r As Reflector
r.Target = AudioStreamer1
r.Target = r.GetField("track")
r.RunMethod("release")
If it doesn't work then try to also release audioRecord (same code with audioRecord instead of track).

You will need to initialize the streamer again.
 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
Thanks Erel !

I have solved the problem by initialising the streamer only when needed generaly before start recording and releasing when is no longer needed with the above code!

Note: that if you want to record again the release method must not be used in the same sub with initialization as the streamer may fail to work...I guess the release needs some time .
 
Upvote 0
Top