2014-04-27 5 views
0

ActionScript3과 함께 Adobe AIR를 사용하여 iOS 장치의 마이크에서 녹음 된 사운드를 재생하고 있습니다. FileStream.writeFloat 메서드를 사용하여 파일에 마이크 샘플 (모노)을 저장합니다. 나중에 Sound 객체를 만들고 SampleEvent에 등록합니다. SampleEvent에서 이전에 마이크 샘플과 함께 저장된 파일을 읽고 두 번 씁니다 (출력이 스테레오이기 때문에).iOS의 ActionScript3로 사운드를 재생하면 바람직하지 않은 결과가 발생합니다.

문제는 내가 AIR 시뮬레이터에서 실행했을 때 위대한 사운드를 재생하고 iOS 기기 (iPad)에서 재생할 때 소리가 두 배 빠릅니다.

private function onSampleData(event : SampleDataEvent):void 
    { 

     // the following lines of code are modifying the sound object and creates a "pitch" effect 
     var sample:Number; 

     var outputLength:int = 0; 
     while (outputLength < 2048) { 
      // until we have filled up enough output buffer 
      if (_micSamplesStream.bytesAvailable < 4) 
      { 
       break; 
      } 

      // read out the left and right channels at this position 
      sample = _micSamplesStream.readFloat(); 

      // write the samples to our output buffer 
      event.data.writeFloat(sample); 
      event.data.writeFloat(sample); 

      outputLength++; 
     } 
    } 

답변

0

나는 임시 패키지와 응용 프로그램을 구축하고 TestFlight를 사용하여 아이 패드에 설치하고 지금은 모든 것이 잘 작동하는 것 같다했습니다.

디버그 중에 추측 하건데 Adobe AIR는 사운드 버퍼를 충분히 빠르게 채우고 왜곡을 일으키지 않았습니다.

관련 문제