Could you post a code sample of that, i have been trying for days to
get audio from earpiece :(
On Jan 26, 2:54 pm, ani anish198519851...@gmail.com wrote:
In cupcake setrouting should work but you need to set the mask
properly for it to work.I myself have tried and it is working i.e. the
sound
Just another update, it now appears to be working properly in 1.6 +
using thr setSpeakerPhoneOn() method,
I set it to false in the onCreate method, use the voice call stream,
set the volume control to in call and it appears to be working so far
On Jan 25, 12:01 pm, Donal Rafferty
In cupcake setrouting should work but you need to set the mask
properly for it to work.I myself have tried and it is working i.e. the
sound is working from earpiece just check it properly.
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To
Hi Ani,
I am working on 1.5 (CupCake) and have tried to use the setRouting method,
however the audio still appears to be coming out of the speaker.
I also have an eclair device and the audio is coming out of the speaker on
that device too.
I have tried using the Audiomanager and the
Just to update you a bit
this code works in 1.5 :
audio_service.setSpeakerphoneOn(false);
audio_service.setMode(AudioManager.MODE_IN_CALL);
audio_service.setRouting(AudioManager.MODE_NORMAL,
AudioManager.ROUTE_EARPIECE,
AudioManager.ROUTE_ALL);
Not 100% sure about the earpiece, but you specify a stream when you
create the AudioTrack and I think a stream encpsulates audio routing
and volume amongst possibly other things.
If you set the stream to STREAM_VOICE_CALL it might come through the
earpiece as this is where a call would be routed,
Not 100% sure about the earpiece, but you specify a stream when you
create the AudioTrack and I think a stream encpsulates audio routing
and volume amongst possibly other things.
If you set the stream to STREAM_VOICE_CALL it might come through the
earpiece as this is where a call would be routed,
Hi Micheal,
do you fancy helping me try to solve the ear piece problem to make it
two pints? :-)
It initially sounds like it gets routed to the ear piece on the HTC
Hero but thats because of the way the earpiece and speaker are set up
on the hero, on a G1 it is clearly coming through the
AudioRecord and AudioTrack are the classes you need.
If you use them in streaming mode then you can pipe data out of
AudioRecord straight into AudioTrack and you should be able to acheive
the desired effect.
I have done something similar, but without the delay.
Mike
On Jan 21, 11:28 am,
Hi Mike,
Thanks for the prompt reply.
I was looking at the AudioRecord class but had somehow missed the
AudioTrack class,
thanks for pointing it out.
From looking at the classes I think what I have to do is read the
recording data and put it straight into a streamed
AudioTrack, would I be
Hi Donal,
Yeah if you kick the record off and the play, then you can sit in a
loop reading the data out of Record and putting it into play (on a
thread other than the UI thread of course).
Not 100% sure about the earpiece, but you specify a stream when you
create the AudioTrack and I think a
Hi Micheal,
Thanks again,
I now have it recording in PCM format from the mic and saving it to
the sd card and then
playing it back through the ear piece.
So I just have to look into how to into piping the AudioRecord
straight into the AuditTrack.
So with the AudioRecord instead of creating a
Hi Donal,
Once you have constructed an AudioRecord instance you can call
startRecording and then you can use the various read methods to pull
the PCM data out.
Likewise once you have constructed an AudioTrack and called play you
can use one of the write methods to push the data you got from
Really sorry to keep annoying you Micheal, head just doesn't seem to be
functioning properly today.
I currenlty have the AudiRecord buffer set up like this:
static final int bufferSize = 8;
final short[] buffer = new short[bufferSize];
short[] readBuffer = new short[bufferSize];
File file =
Hi Donal,
I have pulled together some of my code to form an example. I have no
idea if this code would compile, but it should be pretty close and
should serve as an example to get you going.
android.os.Process.setThreadPriority
(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);
Thanks Mike,
Your a legend, have that working now,
I owe you a pint!
Many thanks,
Regards,
Donal
On Thu, Jan 21, 2010 at 5:02 PM, Michael nicholls...@googlemail.com wrote:
Hi Donal,
I have pulled together some of my code to form an example. I have no
idea if this code would compile, but
No worries.
Had a week off in summer and spent some of it watching the tennis in
the sweltering heat and learning how the AudioRecord and AudioTrack
stuff works.
Just polishing some of it up to release my first app, but glad it
could be of use to someone else as well.
I look forward to that pint
17 matches
Mail list logo