これが私の問題です:
コード(FooController):
NSString *path = [[NSBundle mainBundle] pathForResource:@"mySound" ofType:@"m4v"];
soundEffect = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[soundEffect play];
// MicBlow
micBlow = [[MicBlowController alloc]init];
そして、MicBlowControllerには以下が含まれています:
NSURL *url = [NSURL fileURLWithPath:@"/dev/null"];
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: 44100.0], AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey,
nil];
と
[recorder updateMeters];
const double ALPHA = 0.05;
double peakPowerForChannel = pow(10,(0.05*[recorder peakPowerForChannel:0]));
lowPassResults = ALPHA * peakPowerForChannel + (1.0 - ALPHA) * lowPassResults;
NSLog(@"Average input: %f Peak input %f Low pass results: %f",[recorder averagePowerForChannel:0],[recorder peakPowerForChannel:0],lowPassResults);
バックグラウンドサウンドを再生してマイクからピークを取得しようとすると、次のログが表示されます。平均入力:0.000000ピーク入力-120.000000ローパス結果:0.000001
しかし、AVAudioPlayerに関するすべての部分にコメントすると、機能します。チャンネルの問題があると思います。
ありがとう