OK, so it sounds like audio is being produced by the kernel driver.

I just looked at your code, and I think you need to call read() once
to pass in your first input buffer.

On Apr 24, 6:04 pm, Steven_T <gwb...@126.com> wrote:
> hi Dave Sparks:
> thank you for reply!
>
> I didn't disable audio input in avd
> what you means is use option "-audio <backend>" to set an audio input
>
> I had used the next code test audio input
> //
> ====================================================================
> Intent intent = new Intent
> (MediaStore.Audio.Media.RECORD_SOUND_ACTION);
> startActivityForResult(intent, ACTIVITY_RECORD_SOUND);
> /
> =====================================================================
> it can recording and saved audio as a file named "recording47845.3gpp"
> in sdcard
>
> the next is logcat out put:
> ===================================================================================
> tag: AudioHardware
> Message: AudioStreamInGeneric::read(0x40715b40, 320) from fd 7
>
> tag:AudioFlinger
> Message: AudioRecordThread: buffer overflow
>
> tag: InputMangerServic
> Message: Starting input on non-focused client
> com.android.internal.view.iinputmethodclient$stub$pr...@4360c470
> (uid=100118 pid=764)
> ====================================================================================
>
> Please help me, thanks!
>
> On Apr 25, 4:44 am, Dave Sparks <davidspa...@android.com> wrote:
>
> > Did you enable audio input in the emulator?
>
> > On Apr 23, 6:48 pm, Steven_T <gwb...@126.com> wrote:
>
> > > hi Dave Sparks:
> > >    I have changed 50 frames to 400 frmaes, it doesn't work.
> > >    then I set bufferSizeInBytes to 1000000 to init AudioRecord object,
> > > and set update period to 400,
> > >    it dosn't work too. I had used logcat to watch emulator'log, didn't
> > > find this program pid throwed error,
> > >    Can you give me sample?
> > >    thanks
>
> > > On Apr 24, 1:10 am, Dave Sparks <davidspa...@android.com> wrote:
>
> > > > I suspect the problem is the interval you chose: 50 frames @ 8KHz is
> > > > 6.25 msecs. Your app is not going to be able to handle a callback
> > > > every 6.25 msecs. Try something more reasonable like 50 msecs (400
> > > > frames) and see if that works.
>
> > > > On Apr 23, 1:56 am, Steven_T <gwb...@126.com> wrote:
>
> > > > > hello everyone,
> > > > > I would like to use the new AudioRecord class to record in PCM format.
> > > > > Create class and setRecordPositionUpdateListener to it, then start
> > > > > recording, I can't get any notification from system forever,why?(I
> > > > > didn't get any error when running)
>
> > > > > please help me, thanks.
>
> > > > > the next is my code.
>
> > > > > public class Recorder {
> > > > >         private static final int AUDIO_SAMPLE_FREQ = 8000;
> > > > >         private static final int AUDIO_BUFFER_SIZE = 200000;
>
> > > > >         private AudioRecord recorder;
>
> > > > >         public Recorder()
> > > > >         {
> > > > >                 try
> > > > >                 {
> > > > >                         // init recorder
> > > > >                         recorder = new 
> > > > > AudioRecord(MediaRecorder.AudioSource.MIC,
> > > > >                                         AUDIO_SAMPLE_FREQ,
> > > > >                                         
> > > > > AudioFormat.CHANNEL_CONFIGURATION_MONO,
> > > > >                                         
> > > > > AudioFormat.ENCODING_PCM_16BIT,
> > > > >                                         AUDIO_BUFFER_SIZE);
> > > > >                 }
> > > > >                 catch (IllegalArgumentException e)
> > > > >                 {
> > > > >                        e.printStackTrace();
> > > > >                 }
>
> > > > >                 
> > > > > recorder.setRecordPositionUpdateListener(mNotification);
> > > > >                 recorder.setPositionNotificationPeriod(50);
> > > > >                 
> > > > > recorder.setNotificationMarkerPosition(AUDIO_SAMPLE_FREQ);
> > > > >         }
>
> > > > >         public OnRecordPositionUpdateListener mNotification = new
> > > > >                 OnRecordPositionUpdateListener(){
> > > > >                 public void onMarkerReached(AudioRecord arg0) {
> > > > >                         // read PCM buffer here
> > > > >                         byte[] audioBuffer = new 
> > > > > byte[AUDIO_SAMPLE_FREQ];
> > > > >                         arg0.read(audioBuffer, 0, AUDIO_SAMPLE_FREQ);
> > > > >                 }
>
> > > > >                 public void onPeriodicNotification(AudioRecord arg0) {
> > > > >                         // read PCM buffer here
> > > > >                         byte[] audioBuffer = new 
> > > > > byte[AUDIO_SAMPLE_FREQ];
> > > > >                         arg0.read(audioBuffer, 0, AUDIO_SAMPLE_FREQ);
> > > > >                 }
>
> > > > >         public void StartRecord()
> > > > >         {
> > > > >                 recorder.startRecording();
> > > > >         }
>
> > > > >         public void StopRecord()
> > > > >         {
> > > > >                 recorder.stop();
> > > > >         }
>
> > > > >         public void ReleaseRecord()
> > > > >         {
> > > > >                 recorder.release();
> > > > >         }
>
> > > > > };
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to