ios - 在iOS上使用ActionScript3播放声音会导致不良效果

标签 ios apache-flex audio mobile air

我正在将Adobe AIR与ActionScript3配合使用,以播放从iOS设备上的麦克风录制的声音。
我使用FileStream.writeFloat方法将麦克风样本(单声道)存储在文件中。
稍后我创建一个Sound对象并注册到SampleEvent,在SampleEvent中,我读取了之前与麦克风采样一起存储的文件,并将它们写入两次(因为输出是立体声)。

问题是,当我在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++;
        }
    }   

最佳答案

我已经将应用程序构建为临时包,并使用TestFlight将其安装在iPad上,现在一切似乎都可以正常工作。

我猜在调试期间,Adobe AIR未能足够快地填充声音缓冲区并导致失真。

关于ios - 在iOS上使用ActionScript3播放声音会导致不良效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23325044/

相关文章:

ios - 使用 MKMapView 和 MKRoute 获取方向问题

apache-flex - flex中有 sleep 功能吗?

apache-flex - 使 AS3/Flex 类可扩展但不能作为对象实例化?

c - FFmpeg - 音频编码在音频上产生额外的噪音

ios - 从 App Store 升级 Xcode 时出现 STATUS_CODE_ERROR

ios - 表达式类型不明确,没有更多上下文(枚举)

Objective-C:访问另一个类的属性

javascript - 在 Adob​​e Flex 中打印 HTML 对象内容

cocos2d-iphone - iOS的ObjectAL/OpenAL-运行时停止/暂停/静音?

ios - 获取XCODE以将运行脚本转换后的文件复制到iOS资源包中?