2011-10-25 2 views
1

iPhone의 터치를 터치하면 연속적인 오디오 클립을 재생하려고합니다. 화면 영역에 따라 특정 오디오 잘라 내기가 있습니다. 터치가 영역을 변경하면 이전 오디오가 &으로 사라지고 새 클립 (새 영역의)이 사라집니다. - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 메서드에서메서드를 호출하는 & 메서드가 감지됩니다. 방법은 다음과 같습니다.iPhone에서 터치 동작으로 오디오 파일을 계속 재생하십시오.

-(void)playSoundWithPath 
{ 
    [self fadeVolume]; 
    NSString *audioPath; 
    switch (curRect) // curRect is the Currently entered region 
    { 
     case 1: 
      audioPath = [[NSBundle mainBundle] pathForResource:@"clip1" ofType:@"mp3"]; 
      break; 
     case 2: 
      audioPath = [[NSBundle mainBundle] pathForResource:@"clip2" ofType:@"mp3"]; 
      break; 
     case 3: 
      audioPath = [[NSBundle mainBundle] pathForResource:@"clip3" ofType:@"mp3"]; 
      break; 
     case 4: 
      audioPath = [[NSBundle mainBundle] pathForResource:@"clip4" ofType:@"mp3"]; 
      break; 
     default: 
      break; 
    } 
    theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:audioPath] error:NULL]; 
    theAudio.delegate = self; 
    [theAudio play]; 
} 

-(void)fadeVolume 
{ 
    if (theAudio.volume > 0.1) 
    { 
     theAudio.volume -= 0.1; 
     [self performSelector:@selector(fadeVolume) withObject:nil afterDelay:0.1];   
    } 
    else 
    { 
     [theAudio stop]; 
    } 
} 

코드가 제대로 작동하지 않습니다. 어떻게 부드럽게 & 느낌이 들도록 & 클립을 적절하게 혼합하는 방법? 어떤 종류의 suggesion도 환영합니다.

답변

0

원시 오디오 용 믹서를 제작하고 AVPlayer API 대신 RemoteIO를 사용하여 믹싱을 스트리밍 해 볼 수 있습니다.

+0

응답 해 주셔서 감사합니다. RemoteIO는 다소 복잡하지만 OpenAL을 사용하고 있습니다. –

관련 문제