什么可能会改变声音输出

What could possibly change sound output

我正在开发一个 Android 应用程序来处理我需要向其发送一些信号(如特定方波,硬编码在设备固件中)的设备。

Superpowered Audio 一切正常,但现在我正在迁移到 Oboe,这些信号不再有效。我的信号生成代码没有改变,所以我想知道输出在哪里可以改变。

在我的广播接收器中,我有这段代码可以将输出音量设置为最大:

audioManager.setStreamVolume(
          AudioManager.STREAM_MUSIC,
          audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC),
          0);

清单包含这些:

  <uses-feature android:name="android.hardware.usb.host" android:required="true"/>
  <uses-feature android:name="android.hardware.microphone" android:required="true" />
  <uses-feature android:name="android.hardware.audio.output" android:required="true" />

  <uses-permission android:name="android.permission.RECORD_AUDIO" />
  <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

播放流配置如下:

builder->setCallback(this)
      ->setDeviceId(outputDeviceId)
      ->setDirection(oboe::Direction::Output)
      ->setChannelCount(oboe::ChannelCount::Stereo)
      ->setFormat(oboe::AudioFormat::I16)
      ->setSampleRate(samplerate)
      ->setSharingMode(oboe::SharingMode::Exclusive)
      ->setPerformanceMode(oboe::PerformanceMode::LowLatency)
      ->setInputPreset(oboe::InputPreset::Unprocessed);

播放了一些声音,我听的时候能听到,所以我的回调正常,但设备无法解析信号。 phone 不在 "Do Not Disturb" 模式,我禁用了均衡器。

我正在 OnePlus 5t 运行 OxygenOS 9.0.6 (Android 9) 上测试所有这些,但我没有想法。

好像不是双簧管的问题。我在 Nexus 5 上试用了我的应用程序,它运行正常。我怀疑一些 OxygenOS 设置,但我找不到它是什么,我正在慢慢开始放弃...