0

我有以下代码来播放 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); 

 }

我有以下代码连接到 USB 卡:

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

  }

请帮助我知道 -如何从 USB 卡上的播放器发出声音?

谢谢你。

4

1 回答 1

0

SuperpoweredAndroidAudioIO 和 SuperpoweredUSBAudio 都使用音频回调。将您的播放器代码放入 SuperpoweredUSBAudio 的音频处理回调中。我看到在您的示例中这两个回调都称为 audioProcessing 。

于 2017-10-16T19:46:52.867 回答