This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] PROCESSOR-SDK-AM335X:音频播放问题

Guru**** 2556110 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/622753/processor-sdk-am335x-audio-playback-issue

器件型号:PROCESSOR-SDK-AM335X

我的 Android 项目中的 AudioTrack 库有问题、我正在尝试使用 AM335x 板上的3.5mm 连接器播放正弦波、但每当我运行应用时、就会引发异常、因为没有音频设备... 此应用程序可通过扬声器或耳机插孔在我的手机上完美运行。 下面是我尝试运行的代码示例:  

double[] mSound = new double[4410];
    short[] mBuffer = new short[duration];
    for (int i = 0; i < mSound.length; i++) {
        mSound[i] = Math.sin((2.0*Math.PI * i/(44100/frequency)));
        mBuffer[i] = (short) (mSound[i]*Short.MAX_VALUE);
    }

    mAudioTrack.setStereoVolume(AudioTrack.getMaxVolume(), AudioTrack.getMaxVolume());
    mAudioTrack.play();

mAudioTrack.play 每次都抛出异常... 在该板上是否有其他方式播放声音?
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Branislav、您好!

    请查看 指南。

    此致、
    Kemal

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    但这是 C++示例、我将构建 Android 应用程序

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您是否找到问题所在? 如果 C 示例有效、可能是 Android 框架中隐藏了某个位置。