如何从播放音乐播放器录制音频
问题描述:
答
使用此功能来播放声音
- (AVAudioPlayer *)getNoteFromFilename:(NSString *)name andoftype:(NSString *)type{
NSString *soundPath = [[NSBundle mainBundle] pathForResource:name
ofType:type];
NSURL *fileURL = [NSURL fileURLWithPath:soundPath];
AVAudioPlayer *note = [[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL
error:nil] autorelease];
return note;
和U可以这样调用
self.btn_do = [self getNoteFromFilename:@"MusicFileName" andoftype:@"mp3"];
功能