2
Tucnak - VHF contest log
3
Copyright (C) 2002-2013 Ladislav Vaiz <ok1zia@nagano.cz>
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
version 2 as published by the Free Software Foundation.
15
#ifdef HAVE_SLES_OPENSLES_H
16
#include <SLES/OpenSLES_Android.h>
20
int sles_open(struct dsp *dsp, int rec){
23
result = slCreateEngine(&(dsp->engineObject), 0, NULL, 0, NULL, NULL);
27
const SLInterfaceID ids[] = {SL_IID_VOLUME};
28
const SLboolean req[] = {SL_BOOLEAN_FALSE} ;
29
result = (*dsp->engineEngine)->CreateOutputMix(dsp->engineEngine, &(dsp->outputMixObject), 1, ids, req);
30
result = (*dsp->outputMixObject)->Realize(dsp->outputMixObject, SL_BOOLEAN_FALSE);
32
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
33
SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM, dsp->channels, dsp->speed, SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16,
34
speakers, SL_BYTEORDER_LITTLEENDIAN};
35
SLDataSource audioSrc = {&loc_bufq, &format_pcm};
37
SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, dsp->outputMixObject};
38
SLDataSink audioSnk = {&loc_outmix, NULL};
40
const SLInterfaceID ids1[] = {SL_IID_ANDROIDSIMPLEBUFFERQUEUE};
41
const SLboolean req1[] = {SL_BOOLEAN_TRUE};
42
result = (*dsp->engineEngine)->CreateAudioPlayer(dsp->engineEngine, &(dsp->bqPlayerObject), &audioSrc, &audioSnk, 1, ids1, req1);
43
result = (*dsp->bqPlayerObject)->Realize(dsp->bqPlayerObject, SL_BOOLEAN_FALSE);
45
result = (*dsp->bqPlayerObject)->GetInterface(dsp->bqPlayerObject, SL_IID_PLAY,&(dsp->bqPlayerPlay));
46
result = (*dsp->bqPlayerObject)->GetInterface(dsp->bqPlayerObject, SL_IID_ANDROIDSIMPLEBUFFERQUEUE, &(dsp->bqPlayerBufferQueue));
48
result = (*dsp->bqPlayerBufferQueue)->RegisterCallback(dsp->bqPlayerBufferQueue, bqPlayerCallback, dsp);
49
result = (*p->bqPlayerPlay)->SetPlayState(p->bqPlayerPlay, SL_PLAYSTATE_PLAYING);
54
SLDataLocator_IODevice loc_dev = {SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, SL_DEFAULTDEVICEID_AUDIOINPUT, NULL};
55
SLDataSource audioSrc = {&loc_dev, NULL};
57
SLDataLocator_AndroidSimpleBufferQueue loc_bq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
58
SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM, channels, sr, SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16,
59
speakers, SL_BYTEORDER_LITTLEENDIAN};
60
SLDataSink audioSnk = {&loc_bq, &format_pcm};
62
const SLInterfaceID id[1] = {SL_IID_ANDROIDSIMPLEBUFFERQUEUE};
63
const SLboolean req[1] = {SL_BOOLEAN_TRUE};
64
result = (*p->engineEngine)->CreateAudioRecorder(p->engineEngine, &(p->recorderObject), &audioSrc, &audioSnk, 1, id, req);
66
result = (*p->recorderObject)->Realize(p->recorderObject, SL_BOOLEAN_FALSE);
68
result = (*p->recorderObject)->GetInterface(p->recorderObject, SL_IID_RECORD, &(p->recorderRecord));
70
result = (*p->recorderObject)->GetInterface(p->recorderObject, SL_IID_ANDROIDSIMPLEBUFFERQUEUE, &(p->recorderBufferQueue));
72
result = (*p->recorderBufferQueue)->RegisterCallback(p->recorderBufferQueue, bqRecorderCallback,p);
74
result = (*p->recorderRecord)->SetRecordState(
75
p->recorderRecord,SL_RECORDSTATE_RECORDING);
80
int sles_close(struct dsp *dsp){
85
int sles_write(struct dsp *dsp, void *data, int len){
88
int sles_read(struct dsp *dsp, void *data, int len){
91
int sles_reset(struct dsp *dsp){
94
int sles_sync(struct dsp *dsp){
97
int sles_set_format(struct dsp *dsp, SF_INFO *sfinfo, int ret){