首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >detection记录器检测中的问题

detection记录器检测中的问题
EN

Stack Overflow用户
提问于 2011-06-17 21:26:38
回答 1查看 266关注 0票数 0

我想检测任何伙伴的声音(注意:我不会按任何按钮,只是感觉到声音并开始录音)用户可以说话,我的应用程序自动检测声音,当用户停止说话时,声音自动为我做这件事,我已经通过按下按钮Record,stop play..How Play..But完成了录制如何为我sense..Its a problem ...这是代码。

代码语言:javascript
复制
#import "recordViewController.h"

@implementation recordViewController
@synthesize playButton, stopButton, recordButton;

-(void) recordAudio
{
     if (!audioRecorder.recording)
     {
             playButton.enabled = NO;
             stopButton.enabled = YES;
             [audioRecorder record];
     }
}
-(void)stop
{
    stopButton.enabled = NO;
    playButton.enabled = YES;
    recordButton.enabled = YES;

    if (audioRecorder.recording)
    {
            [audioRecorder stop];
    } else if (audioPlayer.playing) {
            [audioPlayer stop];
    }
}
-(void) playAudio
{
    if (!audioRecorder.recording)
    {
       stopButton.enabled = YES;
       recordButton.enabled = NO;

        if (audioPlayer)
              [audioPlayer release];
        NSError *error;

        audioPlayer = [[AVAudioPlayer alloc] 
        initWithContentsOfURL:audioRecorder.url                                    
        error:&error];

        audioPlayer.delegate = self;

        if (error)
              NSLog(@"Error: %@", 
              [error localizedDescription]);
        else
              [audioPlayer play];
   }
}
.
.
.
@end
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-01-23 06:58:55

尝尝这个

http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6386434

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档