簡體   English   中英

錄制音頻時的xCode控制台錯誤

[英]xCode Console Errors when recording Audio

錄制聲音時出現以下控制台錯誤。任何想法我做錯了嗎? 錄音工作,除了輸出非常柔和。

TIA

2011-04-17 12:51:25.707 FlashCards[18561:1210f] Cannot find executable for CFBundle/CFPlugIn 0x5a64780 </Library/Audio/Plug-Ins/HAL/DVCPROHDAudio.plugin> (not loaded)
2011-04-17 12:51:25.708 FlashCards[18561:1210f] Cannot find function pointer NewPlugIn for factory C5A4CE5B-0BB8-11D8-9D75-0003939615B6 in CFBundle/CFPlugIn 0x5a64780 </Library/Audio/Plug-Ins/HAL/DVCPROHDAudio.plugin> (not loaded)
2011-04-17 12:51:25.712 FlashCards[18561:1210f] Cannot find executable for CFBundle/CFPlugIn 0x5c69e90 </Library/Audio/Plug-Ins/HAL/iSightAudio.plugin> (not loaded)
2011-04-17 12:51:25.713 FlashCards[18561:1210f] Cannot find function pointer iSightAudioNewPlugIn for factory 9BE7661E-8AEF-11D7-8692-000A959F49B0 in CFBundle/CFPlugIn 0x5c69e90 </Library/Audio/Plug-Ins/HAL/iSightAudio.plugin> (not loaded)
2011-04-17 12:51:25.729 FlashCards[18561:c503] start recording

根據要求,我要添加代碼:

.h文件片段:

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <CoreAudio/CoreAudioTypes.h>
#import <AudioToolbox/AudioToolbox.h>

@protocol BackViewControllerDelegate;


@interface BackViewController : UIViewController <UITextViewDelegate, AVAudioRecorderDelegate, AVAudioPlayerDelegate, UIAlertViewDelegate>
{
AVAudioRecorder *audioRecorder;
AVAudioPlayer *audioPlayer;
IBOutlet UIButton *playButton;
IBOutlet UIButton *recordButton;
IBOutlet UIActivityIndicatorView *autoCog;
BOOL toggle;
}

@property (nonatomic, retain) IBOutlet UIButton *playButton;
@property (nonatomic, retain) IBOutlet UIButton *recordButton;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *autoCog;

-(IBAction) recordAudio;
-(IBAction) playAudio;

.m片段

@synthesize playButton; 
@synthesize recordButton;
@synthesize autoCog;

- (void)viewWillAppear:(BOOL)animated {
    NSLog(@"%s", __FUNCTION__);
    [super viewWillAppear:animated];

    //Start the toggle in false mode. PREMISE: WHEN WE GET HERE FIRST, WE ARE NOT RECORDING
    toggle = NO;

    NSError *error = nil;

    //Instantiate an instance of the AVAudioSession object.
    AVAudioSession * audioSession = [AVAudioSession sharedInstance];

    [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error: &error];

    //Activate the session
    [audioSession setActive:YES error: &error];
}

-(void) playAudio
{
    NSLog(@"%s", __FUNCTION__);

    if (audioPlayer.playing) {
        [audioPlayer stop];
    }

    if (toggle == NO)
    {
        recordButton.enabled = NO;        
        if (audioPlayer)
            [audioPlayer release];
        NSError *error;

        // GET THE APPROPRIATE SOUND FILE NAME
.....

        //CHECK FOR EXISTING SOUNDFILE

        if (![[NSFileManager defaultManager] fileExistsAtPath:soundFilePath])
        {
            UIAlertView *someError = [[UIAlertView alloc] initWithTitle: @"Oops!" message: @"There is not a sound for this word. Press REC to record one. Press cancel to stop" delegate: self 
                                                      cancelButtonTitle: @"REC" otherButtonTitles:@"CANCEL", nil];

            [someError show];
            [someError release]; 
        }


        NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];

        AudioSessionSetProperty (
                                 kAudioSessionProperty_OverrideCategoryDefaultToSpeaker,
                                 sizeof (doChangeDefaultRoute),
                                 &doChangeDefaultRoute
                                 );

        audioPlayer = [[AVAudioPlayer alloc] 
                       initWithContentsOfURL:soundFileURL                                    
                       error:&error];
        audioPlayer.volume = 1.0;
        audioPlayer.delegate = self;

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

        }
    }
    recordButton.enabled = YES;
    //NSLog(@"end of playAudio");
}

我之前已經看過這些警告,如果您復制了另一個舊項目,會發生什么情況? 如果是這樣的話,我只是使用最新版本的Xcode創建了一個新的空白項目,然后開始將舊文件復制到其中。

這似乎可以清除這些錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM