|
|
|
@ -30,8 +30,8 @@ using namespace std;
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
#define INPUT_SIZE 8192
|
|
|
|
|
#define _TQUEUE_FLOAT 1
|
|
|
|
|
#define _TQUEUE_INT 2
|
|
|
|
|
#define _QUEUE_FLOAT 1
|
|
|
|
|
#define _QUEUE_INT 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void usage() {
|
|
|
|
@ -52,7 +52,7 @@ void initDSP(DSPWrapper* dsp) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
int queueType=_TQUEUE_INT;
|
|
|
|
|
int queueType=_QUEUE_INT;
|
|
|
|
|
int samples=8192;
|
|
|
|
|
|
|
|
|
|
PCMFrame* outFrame;
|
|
|
|
@ -67,7 +67,7 @@ int main(int argc, char** argv) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'f': {
|
|
|
|
|
queueType=_TQUEUE_FLOAT;
|
|
|
|
|
queueType=_QUEUE_FLOAT;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'c': {
|
|
|
|
@ -101,10 +101,10 @@ int main(int argc, char** argv) {
|
|
|
|
|
// so we need a _FRAME_AUDIO_PCM type and we need
|
|
|
|
|
// for splay at least MP3FRAMESIZE
|
|
|
|
|
AudioFrameQueue* frameQueue;
|
|
|
|
|
if (queueType == _TQUEUE_INT) {
|
|
|
|
|
if (queueType == _QUEUE_INT) {
|
|
|
|
|
frameQueue=new AudioFrameQueue(500,MP3FRAMESIZE,_FRAME_AUDIO_PCM);
|
|
|
|
|
}
|
|
|
|
|
if (queueType == _TQUEUE_FLOAT) {
|
|
|
|
|
if (queueType == _QUEUE_FLOAT) {
|
|
|
|
|
frameQueue=new AudioFrameQueue(100,MP3FRAMESIZE,_FRAME_AUDIO_FLOAT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -188,12 +188,12 @@ int main(int argc, char** argv) {
|
|
|
|
|
//
|
|
|
|
|
// we need to setup the dsp manually, when we do not play pcmFrames directly
|
|
|
|
|
//
|
|
|
|
|
if (queueType == _TQUEUE_INT) {
|
|
|
|
|
if (queueType == _QUEUE_INT) {
|
|
|
|
|
AudioFrame* audioFrame=frameQueue->getCurrent();
|
|
|
|
|
dsp->audioSetup(audioFrame);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (queueType == _TQUEUE_FLOAT) {
|
|
|
|
|
if (queueType == _QUEUE_FLOAT) {
|
|
|
|
|
AudioFrame* audioFrame=frameQueue->getCurrent();
|
|
|
|
|
dsp->audioSetup(audioFrame->getStereo(),16,
|
|
|
|
|
audioFrame->getSigned(),
|
|
|
|
@ -220,7 +220,7 @@ int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (queueType == _TQUEUE_INT) {
|
|
|
|
|
if (queueType == _QUEUE_INT) {
|
|
|
|
|
cout << "reading :"<<samples<<" data"<<endl;
|
|
|
|
|
hasRead=frameQueue->copy(outFrame->getData(),samples);
|
|
|
|
|
dsp->audioPlay((char*)outFrame->getData(),hasRead*sizeof(short int));
|
|
|
|
@ -228,7 +228,7 @@ int main(int argc, char** argv) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (queueType == _TQUEUE_FLOAT) {
|
|
|
|
|
if (queueType == _QUEUE_FLOAT) {
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
hasRead=frameQueue->copy(left,right,samples);
|
|
|
|
|