static const int32 AUTO_RAMP_DURATION_MS = 300;
////////////////////////////////////////////////////////////////////////////
-AndroidAudioInput::AndroidAudioInput()
+AndroidAudioInput::AndroidAudioInput(uint32 audioSource)
: OsclTimerObject(OsclActiveObject::EPriorityNominal, "AndroidAudioInput"),
iCmdIdCounter(0),
iPeer(NULL),
iThreadLoggedOn(false),
iAudioSamplingRate(8000),
+ iAudioSource(audioSource),
iDataEventCounter(0),
iWriteCompleteAO(NULL),
iTimeStamp(0),
LOGV("create AudioRecord %p", this);
android::AudioRecord
* record = new android::AudioRecord(
- android::AudioRecord::DEFAULT_INPUT, iAudioSamplingRate,
+ iAudioSource, iAudioSamplingRate,
android::AudioSystem::PCM_16_BIT, iAudioNumChannels,
4*kBufferSize/iAudioNumChannels/sizeof(int16), flags);
LOGV("AudioRecord created %p, this %p", record, this);
#ifndef OSCL_VECTOR_H_INCLUDED
#include "oscl_vector.h"
#endif
-#ifndef PVLOGGER_H_INCLUDED
-#include "pvlogger.h"
-#endif
#ifndef PVMI_MIO_CONTROL_H_INCLUDED
#include "pvmi_mio_control.h"
#endif
public RefBase
{
public:
- AndroidAudioInput();
+ AndroidAudioInput(uint32 audioSource);
virtual ~AndroidAudioInput();
// Pure virtuals from PvmiMIOControl
int maxAmplitude();
private:
+ AndroidAudioInput();
void Run();
int audin_thread_func();
bool iAudioNumChannelsValid;
int32 iAudioSamplingRate;
bool iAudioSamplingRateValid;
+ uint32 iAudioSource;
int32 iFrameSize;
int32 iDataEventCounter;
{
int error = 0;
- switch(ac->as) {
- case AUDIO_SOURCE_DEFAULT:
- case AUDIO_SOURCE_MIC:
- mAudioInputMIO = new AndroidAudioInput();
- if(mAudioInputMIO != NULL){
- LOGV("create mio input audio");
- mAudioNode = PvmfMediaInputNodeFactory::Create(static_cast<PvmiMIOControl *>(mAudioInputMIO.get()));
- if(mAudioNode){
- break;
- }
- else{
- // do nothing, let it go in default case
- }
- }
- else{
- // do nothing, let it go in default case
+ mAudioInputMIO = new AndroidAudioInput(ac->as);
+ if (mAudioInputMIO != NULL) {
+ LOGV("create mio input audio");
+ mAudioNode = PvmfMediaInputNodeFactory::Create(static_cast<PvmiMIOControl *>(mAudioInputMIO.get()));
+ if (mAudioNode == NULL) {
+ commandFailed(ac);
+ return;
}
- default:
- commandFailed(ac);
- return;
}
OSCL_TRY(error, mAuthor->AddDataSource(*mAudioNode, ac));