0
내가내가 무엇을 오전, IOS InputAudioQueue이
가 나는 -50 osstatus을 얻을 몇 가지 테스트를하고 IOS 오디오 큐 서비스를 배우고 (아주 간단한 예)를 작동시킬 수 없습니다 잘못하고있는거야?
나는 사과 AudioQueue 서비스 참조 몇 번을 읽고, 기능 문서를 읽을 수 있지만 나는 아직도 모르겠어요 무슨 문제
감사
#import "AudioSenderVC.h"
#import <AudioToolbox/AudioToolbox.h>
#import <Foundation/Foundation.h>
@interface AudioSenderVC()
@property (weak, nonatomic) IBOutlet UITextField *ipTextField;
@end
@implementation AudioSenderVC
static void MyAudioQueueInputCallback (
void *inUserData,
AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer,
const AudioTimeStamp *inStartTime,
UInt32 inNumberPacketDescriptions,
const AudioStreamPacketDescription *inPacketDescs
)
{
NSLog(@"hey I just got audio data from the mic!");
}
void createAudioQueue(AudioStreamBasicDescription* mDataFormat)
{
AudioQueueRef* inAQ = NULL;
OSStatus err=AudioQueueNewInput(mDataFormat, MyAudioQueueInputCallback ,NULL,CFRunLoopGetCurrent(), kCFRunLoopCommonModes, 0, inAQ);
if(inAQ!=NULL)
NSLog(@"YAY!, InputQueue was Created");
if(err)
NSLog(@"Error:%i",(int)err);
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)setupAudioFormat:(AudioStreamBasicDescription*)format
{
format->mSampleRate = 8000.0;
format->mFormatID = kAudioFormatLinearPCM;
format->mFramesPerPacket = 1;
format->mChannelsPerFrame = 1;
format->mBytesPerFrame = 2;
format->mBytesPerPacket = 2;
format->mBitsPerChannel = 16;
format->mReserved = 0;
format->mFormatFlags = kLinearPCMFormatFlagIsBigEndian |
kLinearPCMFormatFlagIsSignedInteger |
kLinearPCMFormatFlagIsPacked;
}
- (IBAction)sendAudio:(id)sender {
AudioStreamBasicDescription* mDataFormat=malloc(sizeof(AudioStreamBasicDescription));
[self setupAudioFormat:mDataFormat];
createAudioQueue(mDataFormat);
}
@end
고맙습니다. 해결해 주셔서 감사합니다. –