@@ -35,24 +35,24 @@ struct EchoAudioEngine {
3535 SLObjectItf slEngineObj_;
3636 SLEngineItf slEngineItf_;
3737
38- AudioRecorder * recorder_;
39- AudioPlayer * player_;
40- AudioQueue * freeBufQueue_; // Owner of the queue
41- AudioQueue * recBufQueue_; // Owner of the queue
38+ AudioRecorder* recorder_;
39+ AudioPlayer* player_;
40+ AudioQueue* freeBufQueue_; // Owner of the queue
41+ AudioQueue* recBufQueue_; // Owner of the queue
4242
43- sample_buf * bufs_;
43+ sample_buf* bufs_;
4444 uint32_t bufCount_;
4545 uint32_t frameCount_;
4646 int64_t echoDelay_;
4747 float echoDecay_;
48- AudioDelay * delayEffect_;
48+ AudioDelay* delayEffect_;
4949};
5050static EchoAudioEngine engine;
5151
52- bool EngineService (void * ctx, uint32_t msg, void * data);
52+ bool EngineService (void * ctx, uint32_t msg, void * data);
5353
5454JNIEXPORT void JNICALL Java_com_google_sample_echo_MainActivity_createSLEngine (
55- JNIEnv * env, jclass type, jint sampleRate, jint framesPerBuf,
55+ JNIEnv* env, jclass type, jint sampleRate, jint framesPerBuf,
5656 jlong delayInMs, jfloat decay) {
5757 SLresult result;
5858 memset (&engine, 0 , sizeof (engine));
@@ -103,7 +103,7 @@ JNIEXPORT void JNICALL Java_com_google_sample_echo_MainActivity_createSLEngine(
103103}
104104
105105JNIEXPORT jboolean JNICALL
106- Java_com_google_sample_echo_MainActivity_configureEcho (JNIEnv * env, jclass type,
106+ Java_com_google_sample_echo_MainActivity_configureEcho (JNIEnv* env, jclass type,
107107 jint delayInMs,
108108 jfloat decay) {
109109 engine.echoDelay_ = delayInMs;
@@ -116,7 +116,7 @@ Java_com_google_sample_echo_MainActivity_configureEcho(JNIEnv *env, jclass type,
116116
117117JNIEXPORT jboolean JNICALL
118118Java_com_google_sample_echo_MainActivity_createSLBufferQueueAudioPlayer (
119- JNIEnv * env, jclass type) {
119+ JNIEnv* env, jclass type) {
120120 SampleFormat sampleFormat;
121121 memset (&sampleFormat, 0 , sizeof (sampleFormat));
122122 sampleFormat.pcmFormat_ = (uint16_t )engine.bitsPerSample_ ;
@@ -131,22 +131,22 @@ Java_com_google_sample_echo_MainActivity_createSLBufferQueueAudioPlayer(
131131 if (engine.player_ == nullptr ) return JNI_FALSE;
132132
133133 engine.player_ ->SetBufQueue (engine.recBufQueue_ , engine.freeBufQueue_ );
134- engine.player_ ->RegisterCallback (EngineService, (void *)&engine);
134+ engine.player_ ->RegisterCallback (EngineService, (void *)&engine);
135135
136136 return JNI_TRUE;
137137}
138138
139139JNIEXPORT void JNICALL
140140Java_com_google_sample_echo_MainActivity_deleteSLBufferQueueAudioPlayer (
141- JNIEnv * env, jclass type) {
141+ JNIEnv* env, jclass type) {
142142 if (engine.player_ ) {
143143 delete engine.player_ ;
144144 engine.player_ = nullptr ;
145145 }
146146}
147147
148148JNIEXPORT jboolean JNICALL
149- Java_com_google_sample_echo_MainActivity_createAudioRecorder (JNIEnv * env,
149+ Java_com_google_sample_echo_MainActivity_createAudioRecorder (JNIEnv* env,
150150 jclass type) {
151151 SampleFormat sampleFormat;
152152 memset (&sampleFormat, 0 , sizeof (sampleFormat));
@@ -161,20 +161,20 @@ Java_com_google_sample_echo_MainActivity_createAudioRecorder(JNIEnv *env,
161161 return JNI_FALSE;
162162 }
163163 engine.recorder_ ->SetBufQueues (engine.freeBufQueue_ , engine.recBufQueue_ );
164- engine.recorder_ ->RegisterCallback (EngineService, (void *)&engine);
164+ engine.recorder_ ->RegisterCallback (EngineService, (void *)&engine);
165165 return JNI_TRUE;
166166}
167167
168168JNIEXPORT void JNICALL
169- Java_com_google_sample_echo_MainActivity_deleteAudioRecorder (JNIEnv * env,
169+ Java_com_google_sample_echo_MainActivity_deleteAudioRecorder (JNIEnv* env,
170170 jclass type) {
171171 if (engine.recorder_ ) delete engine.recorder_ ;
172172
173173 engine.recorder_ = nullptr ;
174174}
175175
176176JNIEXPORT void JNICALL
177- Java_com_google_sample_echo_MainActivity_startPlay (JNIEnv * env, jclass type) {
177+ Java_com_google_sample_echo_MainActivity_startPlay (JNIEnv* env, jclass type) {
178178 engine.frameCount_ = 0 ;
179179 /*
180180 * start player: make it into waitForData state
@@ -187,7 +187,7 @@ Java_com_google_sample_echo_MainActivity_startPlay(JNIEnv *env, jclass type) {
187187}
188188
189189JNIEXPORT void JNICALL
190- Java_com_google_sample_echo_MainActivity_stopPlay (JNIEnv * env, jclass type) {
190+ Java_com_google_sample_echo_MainActivity_stopPlay (JNIEnv* env, jclass type) {
191191 engine.recorder_ ->Stop ();
192192 engine.player_ ->Stop ();
193193
@@ -198,7 +198,7 @@ Java_com_google_sample_echo_MainActivity_stopPlay(JNIEnv *env, jclass type) {
198198}
199199
200200JNIEXPORT void JNICALL Java_com_google_sample_echo_MainActivity_deleteSLEngine (
201- JNIEnv * env, jclass type) {
201+ JNIEnv* env, jclass type) {
202202 delete engine.recBufQueue_ ;
203203 delete engine.freeBufQueue_ ;
204204 releaseSampleBufs (engine.bufs_ , engine.bufCount_ );
@@ -236,19 +236,19 @@ uint32_t dbgEngineGetBufCount(void) {
236236/*
237237 * simple message passing for player/recorder to communicate with engine
238238 */
239- bool EngineService (void * ctx, uint32_t msg, void * data) {
239+ bool EngineService (void * ctx, uint32_t msg, void * data) {
240240 assert (ctx == &engine);
241241 switch (msg) {
242242 case ENGINE_SERVICE_MSG_RETRIEVE_DUMP_BUFS: {
243- *(static_cast <uint32_t *>(data)) = dbgEngineGetBufCount ();
243+ *(static_cast <uint32_t *>(data)) = dbgEngineGetBufCount ();
244244 break ;
245245 }
246246 case ENGINE_SERVICE_MSG_RECORDED_AUDIO_AVAILABLE: {
247247 // adding audio delay effect
248- sample_buf * buf = static_cast <sample_buf *>(data);
248+ sample_buf* buf = static_cast <sample_buf*>(data);
249249 assert (engine.fastPathFramesPerBuf_ ==
250250 buf->size_ / engine.sampleChannels_ / (engine.bitsPerSample_ / 8 ));
251- engine.delayEffect_ ->process (reinterpret_cast <int16_t *>(buf->buf_ ),
251+ engine.delayEffect_ ->process (reinterpret_cast <int16_t *>(buf->buf_ ),
252252 engine.fastPathFramesPerBuf_ );
253253 break ;
254254 }
0 commit comments