0

I'm working on an Android app dealing with a device to which I need to send some signal (like a specific square wave, hardcoded in the device's firmware).

Everything worked fine with Superpowered Audio, but now that I'm migrating to Oboe, these signals don't work anymore. My code for the signal generation hasn't change, so I wonder where could the output be changed.

In my broadcast receiver, I have this piece of code to set the output volume to the max:

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

The manifest contains these:

  <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" />

The playback stream is configured like that:

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);

Some sound is played, I can hear it when I listen to it so my callback works correctly, but the device cannot parse the signal. The phone is not in "Do Not Disturb" mode, and I disabled the equalizer.

I'm testing all of this on a OnePlus 5t running OxygenOS 9.0.6 (Android 9), and I'm out of ideas.

loics2
  • 616
  • 1
  • 10
  • 24
  • "Some sound is played, I can hear it when I listen to it so my callback works correctly, but the device cannot parse the signal" - what's the difference between what you expect to hear and what you actually hear? Is it just quieter or is there some distortion/audible artefacts? – donturner Jun 24 '19 at 10:03
  • Also, do the Oboe sample apps work correctly on your test device? – donturner Jun 24 '19 at 10:04
  • I don't know if there is a difference: I can't listen what the device receive, it only listens to its input and doesn't output anything (I should maybe mention that it's a USB audio device). To test the output, I used a DAC and listened with headphones. The signal sounds right, but I don't know what's really sent to my specific device. I based my code on the LiveEffect sample, and it works correctly. – loics2 Jun 24 '19 at 12:03

1 Answers1

0

It seems that the issue is not with Oboe. I tried my app on a Nexus 5 and it works correctly. I suspect some OxygenOS settings, but I can't find what it is, and I'm slowly starting to give up...

loics2
  • 616
  • 1
  • 10
  • 24