Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 73: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 74: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 75: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 76: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 77: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 78: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
package com.jbs36.AudioRecorderPCM; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; public class Recorder implements Runnable { private int frequency; private int channelConfiguration; private volatile boolean isPaused; private File fileName; private volatile boolean isRecording; private final Object mutex = new Object(); // Changing the sample resolution changes sample type. byte vs. short. private static final int audioEncoding = AudioFormat.ENCODING_PCM_16BIT; /** * */ public Recorder() { super(); this.setFrequency(8000); this.setChannelConfiguration(AudioFormat.CHANNEL_CONFIGURATION_MONO); this.setPaused(false); } public void run() { // Wait until we're recording... synchronized (mutex) { while (!this.isRecording) { try { mutex.wait(); } catch (InterruptedException e) { throw new IllegalStateException("Wait() interrupted!", e); } } } // Open output stream... if (this.fileName == null) { throw new IllegalStateException("fileName is null"); } java.io.BufferedOutputStream bufferedStreamInstance = null; if (fileName.exists()) { fileName.delete(); } try { fileName.createNewFile(); } catch (IOException e) { throw new IllegalStateException("Cannot create file: " + fileName.toString()); } try { bufferedStreamInstance = new BufferedOutputStream( new FileOutputStream(this.fileName)); } catch (FileNotFoundException e) { throw new IllegalStateException("Cannot Open File", e); } // We're important... android.os.Process .setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO); // Allocate Recorder and Start Recording... int bufferRead = 0; int bufferSize = AudioRecord.getMinBufferSize(this.getFrequency(), this.getChannelConfiguration(), this.getAudioEncoding()); AudioRecord recordInstance = new AudioRecord( MediaRecorder.AudioSource.MIC, this.getFrequency(), this .getChannelConfiguration(), this.getAudioEncoding(), bufferSize); byte[] tempBuffer = new byte[bufferSize]; recordInstance.startRecording(); while (this.isRecording) { // Are we paused? synchronized (mutex) { if (this.isPaused) { try { mutex.wait(250); } catch (InterruptedException e) { throw new IllegalStateException("Wait() interrupted!", e); } continue; } } bufferRead = recordInstance.read(tempBuffer, 0, bufferSize); if (bufferRead == AudioRecord.ERROR_INVALID_OPERATION) { throw new IllegalStateException( "read() returned AudioRecord.ERROR_INVALID_OPERATION"); } else if (bufferRead == AudioRecord.ERROR_BAD_VALUE) { throw new IllegalStateException( "read() returned AudioRecord.ERROR_BAD_VALUE"); } else if (bufferRead == AudioRecord.ERROR_INVALID_OPERATION) { throw new IllegalStateException( "read() returned AudioRecord.ERROR_INVALID_OPERATION"); } try { bufferedStreamInstance.write(tempBuffer, 0, bufferRead); } catch (IOException e) { throw new IllegalStateException( "IO Error while writing to output file.", e); } } // Close resources... recordInstance.startRecording(); try { bufferedStreamInstance.close(); } catch (IOException e) { throw new IllegalStateException("Cannot close buffered writer."); } } public void setFileName(File fileName) { this.fileName = fileName; } public File getFileName() { return fileName; } /** * @param isRecording * the isRecording to set */ public void setRecording(boolean isRecording) { synchronized (mutex) { this.isRecording = isRecording; if (this.isRecording) { mutex.notify(); } } } /** * @return the isRecording */ public boolean isRecording() { synchronized (mutex) { return isRecording; } } /** * @param frequency * the frequency to set */ public void setFrequency(int frequency) { this.frequency = frequency; } /** * @return the frequency */ public int getFrequency() { return frequency; } /** * @param channelConfiguration * the channelConfiguration to set */ public void setChannelConfiguration(int channelConfiguration) { this.channelConfiguration = channelConfiguration; } /** * @return the channelConfiguration */ public int getChannelConfiguration() { return channelConfiguration; } /** * @return the audioEncoding */ public int getAudioEncoding() { return audioEncoding; } /** * @param isPaused * the isPaused to set */ public void setPaused(boolean isPaused) { synchronized (mutex) { this.isPaused = isPaused; } } /** * @return the isPaused */ public boolean isPaused() { synchronized (mutex) { return isPaused; } } }