DSP 관련 iOS 앱에서 작업하고 있습니다. 작업의 일부는 데이터 처리를 위해 outBuffer -> mAudioData에서 사용자 지정 배열로 오디오 데이터를 복사하는 것입니다. 읽기 방법은 다음과 같습니다.AudioQueue : AudioFileReadPackets에서 원시 데이터를 읽을 수 없습니다.
OSStatus result = AudioFileReadPackets(myInfo->mAudioFile, // The audio file from which packets of audio data are to be read.
false, // Set to true to cache the data. Otherwise, set to false.
&numBytes, // On output, a pointer to the number of bytes actually returned.
myInfo->mPacketDescs, // A pointer to an array of packet descriptions that have been allocated.
myInfo->mCurrentPacket, // The packet index of the first packet you want to be returned.
&nPackets, // On input, a pointer to the number of packets to read. On output, the number of packets actually read.
outBuffer->mAudioData); // A pointer to user-allocated memory.
이 프로세스는 성공합니다. 내가 좋아하는 몇 가지 관련 질문을 통해 갈
outBuffer->mAudioDataByteSize = numBytes;
SInt16 *testBuffer = outBuffer->mAudioData; //Read data from buffer... Error!
for (int i=0; i<numBytes; i++)
{
UInt16 currentData = testBuffer[i];
printf("Current data in testbuffer is %d", currentData);
}
: 나는 outBuffer-> mAudioData에서 데이터를 읽을려고 때, 항상 'SInt16 *'에 '무효 * const를'에서 유효하지 않은 변환을 말하는 오류가 THIS 및 THIS, 그들의 것 같다 ... 나는 또한 AudioFileReadPackets()에서 testBuffer outBuffer- mAudioData 교체하려고하지만 testBuffer 빈 배열 것으로 밝혀졌습니다.
그래서 올바른 접근 방법입니까? int/float 배열에 원시 데이터를 읽는 다른 방법이 있습니까?
보다 일반적으로 보이드 상수 포인터에 액세스하여 읽기/쓰기 작업을 수행하는 방법은 무엇입니까? (그래, 내 C++은 ... 강한되지 않습니다)
어떤 도움,
건배 :-) MANCA