kod*_*r16 1 c pointers objective-c core-audio
我正在使用 Apple Audio Queue Services 指南示例。https://developer.apple.com/library/mac/documentation/MusicAudio/Conceptual/AudioQueueProgrammingGuide/AQRecord/RecordingAudio.html#//apple_ref/doc/uid/TP40005343-CH4-SW1 通过示例我得到了一些看不见的东西错误
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
const static int kNumberBuffers=3; //Sets the number of audio queue buffers to use
typedef struct AQRecorderState{
AudioStreamPacketDescription * mDataFormat; // An AudioStreamBasicDescription structure (from CoreAudioTypes.h) representing the audio data format to write to disk. This format gets used by the audio queue specified in the mQueue field.
AudioQueueRef mQueue; // The recording audio queue created by your application.
AudioQueueBufferRef mBuffers[kNumberBuffers]; //An array holding pointers to the audio queue buffers managed by the audio queue.
AudioFileID mAudioFile; // An audio file object representing the file into which your program records audio data.
UInt32 bufferByteSize; // The size, in bytes, for each audio queue buffer
SInt64 mCurrentPacket; // The packet index for the first packet to be written from the current audio queue buffer.
bool mIsRunning; // Indicates whether queue is running.
}AQRecorderState;
static void HandleInputBuffer(
void *AQData, // Typically, aqData is a custom structure that contains state data for the audio queue
AudioQueueRef inAQ, // The audio queue that owns this callback.
AudioQueueBufferRef inBuffer, //The audio queue buffer containing the incoming audio data to record.
const AudioTimeStamp *inStartTime, //The sample time of the first sample in the audio queue buffer (not needed for simple recording).
UInt32 inNumPackets, //The number of packet descriptions in the inPacketDesc parameter. A value of 0 indicates CBR data.
const AudioStreamPacketDescription *inPacketDesc // For compressed audio data formats that require packet descriptions, the packet descriptions produced by the encoder for the packets in the buffer.
){
AudioFileWritePackets(AQData->mAudioFile, // Member reference base type 'void' is not a structure or union
false,
inBuffer->mAudioDataByteSize,
inPacketDesc,
AQData->mCurrentPacket, // same here
&inNumPackets,
inBuffer->mAudioData);
};
Run Code Online (Sandbox Code Playgroud)
构建失败,我不知道错误在哪里,因为它在文档中没有说明任何内容。谢谢你的帮助
您无法访问 上的字段void *,必须先将其转换为特定类型。
大概:
((AQRecorderState *) AQData)->mAudioFile
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13663 次 |
| 最近记录: |