Reputation: 526
I am trying to record FM radio audio stream. I am able to record with one audio source which is 9 for Motorola.
But when i tried with different phones it not working. So i wondering how to get this audio source dynamically.
This is how i am recording
//RX_SRC is the FM receiving Antenna
mRecorder = new AudioRecord(10, sampleRateInHz,
channelConfigIn,
AudioFormat.ENCODING_PCM_16BIT,
bufferSizeInBytes);
Please help me.
Upvotes: 2
Views: 440
Reputation: 93678
The predefined sources are found here: http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html Anything not on that list is phone specific, and is not portable between models. So different OEMs will use different values, and many won't support it at all. In fact an OEM may change between devices. So there is no portable way to do this.
Your best bet is to keep a list of supported devices and map device->channel id. Detect the model at runtime and use the id associated with that device. This will require per device testing to see if it has a channel and what it is.
Upvotes: 1