2

我有一个带有基于触摸的音调的钢琴应用程序,现在我想在其中添加一个录音功能。谁能指导我这样做。但我需要记录下来并发送到流中。

-(void) viewDidLoad {
    [super viewDidLoad];
    [keyboardView setVisibleKeyRange: NSMakeRange(48, 5)];

    if (audio == nil) {
        [self setAudio:[NSMutableArray arrayWithCapacity:0]];
    }

    [drawingView setShowOutsideLedger:YES];

    NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"keyboardLayout" ofType:@"plist"];
    NSArray* names = [NSArray arrayWithContentsOfFile:plistPath];

    // Load Audio
    for (int i = 0; i < [names count]; i++) {
        SystemSoundID soundID;
        AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:names[i] ofType:@"aif"]], &soundID);  
        NSNumber* audioId = @(soundID);
        [audio addObject:audioId];
    }

    [[self keyboardView] setDelegate:self];
    [[self octaveSelectionView] setDelegate:self];

     }

- (void) keysPressed:(NSSet *)keys {
    NSLog(@"keysPressed=%d", [keys count]);

    [drawingView addNotes:keys];

    for (NSNumber* keyIndex in keys) {
        if ([audio count] > [keyIndex intValue]) {
            SystemSoundID soundID = [audio[[keyIndex intValue]] unsignedLongValue];
            AudioServicesPlaySystemSound(soundID);
        }
    } }
4

1 回答 1

0

只是想知道如何保存按键并记录本地数据库上的延迟计时器。之后使用 AVAsset 结合命中音频和静音音频以保存或重放。有帮助吗

于 2013-08-20T07:44:43.317 回答