サービスから音圧レベルを見つけるために小さな録音をしようとしていますが、Androidはハードウェアへのアクセスを許可しません。Logcatで次のエラーが発生します。
エラーは次のコードから発生します。
AudioRecord recordInstance = null;
// We're important...
android.os.Process
.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);
short bufferSize = 4096;// 2048;
recordInstance = new AudioRecord(MediaRecorder.AudioSource.MIC, this //line 167
.getFrequency(), this.getChannelConfiguration(), this
.getAudioEncoding(), bufferSize); //object not created
tempBuffer = new short[bufferSize];
recordInstance.startRecording();
何が起こるかというと、recordInstanceが適切に作成されないため、最後に到達してrecordInstance.startRecording()を呼び出しても、recordInstanceはnullのままです。Androidは、定義で私のプログラム要求を拒否します。誰かがそれらのerrnoが何を示しているか知っていますか?オンラインでリストが見つかりませんでした。
ありがとう