first version which runs in simulator

This commit is contained in:
Volker Fischer 2014-01-30 16:41:43 +00:00
parent 74259276df
commit 7d5c8165d4

View file

@ -32,11 +32,11 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
// set up stream format // set up stream format
SLDataFormat_PCM streamFormat; SLDataFormat_PCM streamFormat;
streamFormat.formatType = SL_DATAFORMAT_PCM; streamFormat.formatType = SL_DATAFORMAT_PCM;
streamFormat.numChannels = 2; streamFormat.numChannels = 1;// TEST 2;
streamFormat.samplesPerSec = SYSTEM_SAMPLE_RATE_HZ * 1000; // unit is mHz streamFormat.samplesPerSec = SL_SAMPLINGRATE_16;//TEST SYSTEM_SAMPLE_RATE_HZ * 1000; // unit is mHz
streamFormat.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16; streamFormat.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16;
streamFormat.containerSize = 16; streamFormat.containerSize = 16;
streamFormat.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; streamFormat.channelMask = SL_SPEAKER_FRONT_CENTER;// TEST SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
streamFormat.endianness = SL_BYTEORDER_LITTLEENDIAN; streamFormat.endianness = SL_BYTEORDER_LITTLEENDIAN;
// create the OpenSL root engine object // create the OpenSL root engine object
@ -101,8 +101,6 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
recorderReq ); recorderReq );
// realize the audio recorder // realize the audio recorder
// TEST
SLresult test =
(*recorderObject)->Realize ( recorderObject, (*recorderObject)->Realize ( recorderObject,
SL_BOOLEAN_FALSE ); SL_BOOLEAN_FALSE );
@ -112,21 +110,15 @@ SLresult test =
&recorder ); &recorder );
// get the audio recorder simple buffer queue interface // get the audio recorder simple buffer queue interface
// TEST
//SLresult test =
(*recorderObject)->GetInterface ( recorderObject, (*recorderObject)->GetInterface ( recorderObject,
SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
&recorderSimpleBufQueue ); &recorderSimpleBufQueue );
// TEST
if ( test == SL_RESULT_SUCCESS )
{
// register the audio input callback // register the audio input callback
(*recorderSimpleBufQueue)->RegisterCallback ( recorderSimpleBufQueue, (*recorderSimpleBufQueue)->RegisterCallback ( recorderSimpleBufQueue,
processInput, processInput,
this ); this );
}
// TEST
#if 0
// configure the output buffer queue // configure the output buffer queue
SLDataLocator_AndroidSimpleBufferQueue outBufferQueue; SLDataLocator_AndroidSimpleBufferQueue outBufferQueue;
outBufferQueue.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; outBufferQueue.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE;
@ -177,7 +169,6 @@ if ( test == SL_RESULT_SUCCESS )
(*playerSimpleBufQueue)->RegisterCallback ( playerSimpleBufQueue, (*playerSimpleBufQueue)->RegisterCallback ( playerSimpleBufQueue,
processOutput, processOutput,
this ); this );
#endif
} }
void CSound::CloseOpenSL() void CSound::CloseOpenSL()