0

I have the following code to play mp3:

audioPlayer = new SuperpoweredAdvancedAudioPlayer(&audioPlayer, playerEventCallbackA, samplerate, 0); 

audioPlayer->open(path, 0, fileLength); 

audioSystem = new SuperpoweredAndroidAudioIO(samplerate, buffersize, false, true, audioProcessing, this, -1, SL_ANDROID_STREAM_MEDIA, 0); 

……………

bool silence = !audioPlayer->process(stereoBuffer, false, numberOfSamples); 

if (!silence) { 

  // The stereoBuffer is ready now, let’s put the finished audio into the requested buffers. 

  SuperpoweredFloatToShortInt(stereoBuffer, output, numberOfSamples); 

 }

And I have the following code to connect to usb card:

int r = SuperpoweredUSBSystem::onConnect(deviceID, fd, (unsigned char *) rd, env->GetArrayLength(rawDescriptor)); 

if (r & 1) { 

  SuperpoweredUSBAudio::easyIO(deviceID, 44100, 16, 0, 256, SuperpoweredUSBLatency_Low, this, audioProcessing); 

  }

Please help me to know - how to sound from the player on a usb card?

Thank you.

zephyr
  • 665
  • 6
  • 19

1 Answers1

0

Both SuperpoweredAndroidAudioIO and SuperpoweredUSBAudio uses an audio callback. Put your player code into the SuperpoweredUSBAudio's audio processing callback. I see that both callback are called audioProcessing in your example.

Gabor Szanto
  • 1,329
  • 8
  • 12