[Q] Sound card stream hijacking and rerouting
I tried to find similar threads or answer but none specifically addressing this question.
I want to detect whether sound is being played on the device in general, then hijack that audio stream to find the BPM in a separate android application. This may or may not include decompressing the audio stream and measuring it based on peaks/troughs in the sound wave. But the general idea, so far as I can tell, is to reroute the IO stream from applications using the sound card and pipe it to another application.
I know this is theoretically
possible using android libraries like BASS by XMPlay, but I've never seen this in practice (I assume there's a good reason).
My gut feeling is that when the sound device is in use, the thread is basically locked down and you can't do much to it. This is the case in many operating systems (but not all!, including Linux based os), so would not be surprised if this question is left unanswered or just not possible.
Also an fyi; I'm very new to Android development but I have a plethora of experience in Java and lower level languages. It's very possible that many of my assumptions are way of the mark here. Any input would be greatly appreciated.