Hi, I am doing a simple app to record a wav file.  In my codes, I use
onPeriodicNotification function (wait for notification to write to
file).  However, this function is never called.

Please help me.  Below is my code regarding this function.

private AudioRecord.OnRecordPositionUpdateListener updateListener =
new AudioRecord.OnRecordPositionUpdateListener()
        {


                public void onPeriodicNotification(AudioRecord recorder)
                {
                        System.out.println("start write to file()");
                        audioRecorder.read(buffer, 0, buffer.length); // Fill 
buffer
                        try
                        {

                                randomAccessWriter.write(buffer); // Write 
buffer to file
                                payloadSize += buffer.length;
                                if (bSamples == 16)
                                {
                                        for (int i=0; i<buffer.length/2; i++)
                                        { // 16bit sample size
                                                short curSample = 
getShort(buffer[i*2], buffer[i*2+1]);
                                                if (curSample > cAmplitude)
                                                { // Check amplitude
                                                        cAmplitude = curSample;
                                                }
                                        }
                                }
                                else
                                { // 8bit sample size
                                        for (int i=0; i<buffer.length; i++)
                                        {
                                                if (buffer[i] > cAmplitude)
                                                { // Check amplitude
                                                        cAmplitude = buffer[i];
                                                }
                                        }
                                }
                        }
                        catch (IOException e)
                        {
                                Log.e(ExtAudioRecorder.class.getName(), "Error 
occured in
updateListener, recording is aborted");
                                //stop();
                        }
                }

                public void onMarkerReached(AudioRecord recorder)
                {
                        // NOT USED
                }
        };

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to