2011-04-28 1 views
3

AudioQueueBufferRef-> mAudioData에서 오디오 데이터를 읽으려고합니다.AudioQueueBufferRef에서 데이터를 읽는 방법 -> mAudioData

내가하고 싶은 것은 내가 마이크/파일에서 읽은 버퍼를 콘솔에 출력하는 것이다.

오디오 데이터가 어떤 형식으로 표시되는지 알 수 없습니다. 길게/int/float로 인쇄하려고했지만 아무 것도 올바른 데이터를 제공하지 않는 것 같습니다.

내 코드는 apple에서 제공 한 SpeakHere 샘플과 매우 유사합니다.

다음과 같이 버퍼를 인쇄하려고합니다. printf ("% d", (int *) inCompleteAQBuffer-> mAudioData) [i]);

나는 뭔가 잘못하고 있니? mAudioData에서 데이터를 읽는 올바른 방법은 무엇입니까 ??

내 스트림 설명 세부 사항은 다음과 같습니다

 streamDescription.mFormatID = kAudioFormatLinearPCM; 

    // if we want pcm, default to signed 16-bit little-endian 
    streamDescription.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; 
    streamDescription.mBitsPerChannel = 8 * sizeof (int); 
    streamDescription.mBytesPerPacket = streamDescription.mBytesPerFrame = (streamDescription.mBitsPerChannel/8) * streamDescription.mChannelsPerFrame; 
    streamDescription.mFramesPerPacket = 1; 

답변

0

애플의 SpeakHere 샘플 응용 프로그램이 있습니다

mRecordFormat.mBitsPerChannel = 16; 

당신은 다른 무언가가있다. C short 유형은 일반적으로 현재 iOS 장치와 같은 32 비트 RISC 구조의 C int 유형과 크기가 다릅니다.