Skip to content

Commit 5c283e2

Browse files
Dan AlbertDanAlbert
authored andcommitted
clang-format the world.
This used to be done by CI but we ripped that out since there wasn't any good way to ensure that CI and and local workflows were using the same clang-format. Back when it was in CI, the pointer alignment was configured incorrectly (we used the Google style presets, but those are alignment preserving rather than actually style enforcing). Reformat everything since the .clang-format file has changed since then so I stop including so many unrelated edits in my commits.
1 parent 2575793 commit 5c283e2

File tree

63 files changed

+564
-563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+564
-563
lines changed

audio-echo/app/src/main/cpp/audio_effect.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ class AudioDelay : public AudioFormat {
5050
size_t getDelayTime(void) const;
5151
void setDecayWeight(float weight);
5252
float getDecayWeight(void) const;
53-
void process(int16_t *liveAudio, int32_t numFrames);
53+
void process(int16_t* liveAudio, int32_t numFrames);
5454

5555
private:
5656
size_t delayTime_ = 0;
5757
float decayWeight_ = 0.5;
58-
void *buffer_ = nullptr;
58+
void* buffer_ = nullptr;
5959
size_t bufCapacity_ = 0;
6060
size_t bufSize_ = 0;
6161
size_t curPos_ = 0;

audio-echo/app/src/main/cpp/audio_main.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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
};
5050
static EchoAudioEngine engine;
5151

52-
bool EngineService(void *ctx, uint32_t msg, void *data);
52+
bool EngineService(void* ctx, uint32_t msg, void* data);
5353

5454
JNIEXPORT 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

105105
JNIEXPORT 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

117117
JNIEXPORT jboolean JNICALL
118118
Java_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

139139
JNIEXPORT void JNICALL
140140
Java_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

148148
JNIEXPORT 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

168168
JNIEXPORT 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

176176
JNIEXPORT 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

189189
JNIEXPORT 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

200200
JNIEXPORT 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
}

audio-echo/app/src/main/cpp/audio_player.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
* very regular, you could buffer much less audio samples between
2929
* recorder and player, hence lower latency.
3030
*/
31-
void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *ctx) {
32-
(static_cast<AudioPlayer *>(ctx))->ProcessSLCallback(bq);
31+
void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void* ctx) {
32+
(static_cast<AudioPlayer*>(ctx))->ProcessSLCallback(bq);
3333
}
3434
void AudioPlayer::ProcessSLCallback(SLAndroidSimpleBufferQueueItf bq) {
3535
#ifdef ENABLE_LOG
@@ -39,7 +39,7 @@ void AudioPlayer::ProcessSLCallback(SLAndroidSimpleBufferQueueItf bq) {
3939

4040
// retrieve the finished device buf and put onto the free queue
4141
// so recorder could re-use it
42-
sample_buf *buf;
42+
sample_buf* buf;
4343
if (!devShadowQueue_->front(&buf)) {
4444
/*
4545
* This should not happen: we got a callback,
@@ -87,7 +87,7 @@ void AudioPlayer::ProcessSLCallback(SLAndroidSimpleBufferQueueItf bq) {
8787
}
8888
}
8989

90-
AudioPlayer::AudioPlayer(SampleFormat *sampleFormat, SLEngineItf slEngine)
90+
AudioPlayer::AudioPlayer(SampleFormat* sampleFormat, SLEngineItf slEngine)
9191
: freeQueue_(nullptr),
9292
playQueue_(nullptr),
9393
devShadowQueue_(nullptr),
@@ -176,7 +176,7 @@ AudioPlayer::~AudioPlayer() {
176176
(*playerObjectItf_)->Destroy(playerObjectItf_);
177177
}
178178
// Consume all non-completed audio buffers
179-
sample_buf *buf = NULL;
179+
sample_buf* buf = NULL;
180180
while (devShadowQueue_->front(&buf)) {
181181
buf->size_ = 0;
182182
devShadowQueue_->pop();
@@ -200,7 +200,7 @@ AudioPlayer::~AudioPlayer() {
200200
delete[] silentBuf_.buf_;
201201
}
202202

203-
void AudioPlayer::SetBufQueue(AudioQueue *playQ, AudioQueue *freeQ) {
203+
void AudioPlayer::SetBufQueue(AudioQueue* playQ, AudioQueue* freeQ) {
204204
playQueue_ = playQ;
205205
freeQueue_ = freeQ;
206206
}
@@ -251,7 +251,7 @@ void AudioPlayer::Stop(void) {
251251
#endif
252252
}
253253

254-
void AudioPlayer::RegisterCallback(ENGINE_CALLBACK cb, void *ctx) {
254+
void AudioPlayer::RegisterCallback(ENGINE_CALLBACK cb, void* ctx) {
255255
callback_ = cb;
256256
ctx_ = ctx;
257257
}

audio-echo/app/src/main/cpp/audio_player.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@ class AudioPlayer {
3030
SLAndroidSimpleBufferQueueItf playBufferQueueItf_;
3131

3232
SampleFormat sampleInfo_;
33-
AudioQueue *freeQueue_; // user
34-
AudioQueue *playQueue_; // user
35-
AudioQueue *devShadowQueue_; // owner
33+
AudioQueue* freeQueue_; // user
34+
AudioQueue* playQueue_; // user
35+
AudioQueue* devShadowQueue_; // owner
3636

3737
ENGINE_CALLBACK callback_;
38-
void *ctx_;
38+
void* ctx_;
3939
sample_buf silentBuf_;
4040
#ifdef ENABLE_LOG
41-
AndroidLog *logFile_;
41+
AndroidLog* logFile_;
4242
#endif
4343
std::mutex stopMutex_;
4444

4545
public:
46-
explicit AudioPlayer(SampleFormat *sampleFormat, SLEngineItf engine);
46+
explicit AudioPlayer(SampleFormat* sampleFormat, SLEngineItf engine);
4747
~AudioPlayer();
48-
void SetBufQueue(AudioQueue *playQ, AudioQueue *freeQ);
48+
void SetBufQueue(AudioQueue* playQ, AudioQueue* freeQ);
4949
SLresult Start(void);
5050
void Stop(void);
5151
void ProcessSLCallback(SLAndroidSimpleBufferQueueItf bq);
5252
uint32_t dbgGetDevBufCount(void);
53-
void RegisterCallback(ENGINE_CALLBACK cb, void *ctx);
53+
void RegisterCallback(ENGINE_CALLBACK cb, void* ctx);
5454
};
5555

5656
#endif // NATIVE_AUDIO_AUDIO_PLAYER_H

audio-echo/app/src/main/cpp/audio_recorder.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
* bqRecorderCallback(): called for every buffer is full;
2323
* pass directly to handler
2424
*/
25-
void bqRecorderCallback(SLAndroidSimpleBufferQueueItf bq, void *rec) {
26-
(static_cast<AudioRecorder *>(rec))->ProcessSLCallback(bq);
25+
void bqRecorderCallback(SLAndroidSimpleBufferQueueItf bq, void* rec) {
26+
(static_cast<AudioRecorder*>(rec))->ProcessSLCallback(bq);
2727
}
2828

2929
void AudioRecorder::ProcessSLCallback(SLAndroidSimpleBufferQueueItf bq) {
3030
#ifdef ENABLE_LOG
3131
recLog_->logTime();
3232
#endif
3333
assert(bq == recBufQueueItf_);
34-
sample_buf *dataBuf = NULL;
34+
sample_buf* dataBuf = NULL;
3535
devShadowQueue_->front(&dataBuf);
3636
devShadowQueue_->pop();
3737
dataBuf->size_ = dataBuf->cap_; // device only calls us when it is really
@@ -40,7 +40,7 @@ void AudioRecorder::ProcessSLCallback(SLAndroidSimpleBufferQueueItf bq) {
4040
callback_(ctx_, ENGINE_SERVICE_MSG_RECORDED_AUDIO_AVAILABLE, dataBuf);
4141
recQueue_->push(dataBuf);
4242

43-
sample_buf *freeBuf;
43+
sample_buf* freeBuf;
4444
while (freeQueue_->front(&freeBuf) && devShadowQueue_->push(freeBuf)) {
4545
freeQueue_->pop();
4646
SLresult result = (*bq)->Enqueue(bq, freeBuf->buf_, freeBuf->cap_);
@@ -55,7 +55,7 @@ void AudioRecorder::ProcessSLCallback(SLAndroidSimpleBufferQueueItf bq) {
5555
}
5656
}
5757

58-
AudioRecorder::AudioRecorder(SampleFormat *sampleFormat, SLEngineItf slEngine)
58+
AudioRecorder::AudioRecorder(SampleFormat* sampleFormat, SLEngineItf slEngine)
5959
: freeQueue_(nullptr),
6060
recQueue_(nullptr),
6161
devShadowQueue_(nullptr),
@@ -138,7 +138,7 @@ SLboolean AudioRecorder::Start(void) {
138138
SLASSERT(result);
139139

140140
for (int i = 0; i < RECORD_DEVICE_KICKSTART_BUF_COUNT; i++) {
141-
sample_buf *buf = NULL;
141+
sample_buf* buf = NULL;
142142
if (!freeQueue_->front(&buf)) {
143143
LOGE("=====OutOfFreeBuffers @ startingRecording @ (%d)", i);
144144
break;
@@ -185,7 +185,7 @@ AudioRecorder::~AudioRecorder() {
185185
}
186186

187187
if (devShadowQueue_) {
188-
sample_buf *buf = NULL;
188+
sample_buf* buf = NULL;
189189
while (devShadowQueue_->front(&buf)) {
190190
devShadowQueue_->pop();
191191
freeQueue_->push(buf);
@@ -199,13 +199,13 @@ AudioRecorder::~AudioRecorder() {
199199
#endif
200200
}
201201

202-
void AudioRecorder::SetBufQueues(AudioQueue *freeQ, AudioQueue *recQ) {
202+
void AudioRecorder::SetBufQueues(AudioQueue* freeQ, AudioQueue* recQ) {
203203
assert(freeQ && recQ);
204204
freeQueue_ = freeQ;
205205
recQueue_ = recQ;
206206
}
207207

208-
void AudioRecorder::RegisterCallback(ENGINE_CALLBACK cb, void *ctx) {
208+
void AudioRecorder::RegisterCallback(ENGINE_CALLBACK cb, void* ctx) {
209209
callback_ = cb;
210210
ctx_ = ctx;
211211
}

audio-echo/app/src/main/cpp/audio_recorder.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,26 @@ class AudioRecorder {
3030
SLAndroidSimpleBufferQueueItf recBufQueueItf_;
3131

3232
SampleFormat sampleInfo_;
33-
AudioQueue *freeQueue_; // user
34-
AudioQueue *recQueue_; // user
35-
AudioQueue *devShadowQueue_; // owner
33+
AudioQueue* freeQueue_; // user
34+
AudioQueue* recQueue_; // user
35+
AudioQueue* devShadowQueue_; // owner
3636
uint32_t audioBufCount;
3737

3838
ENGINE_CALLBACK callback_;
39-
void *ctx_;
39+
void* ctx_;
4040

4141
public:
42-
explicit AudioRecorder(SampleFormat *, SLEngineItf engineEngine);
42+
explicit AudioRecorder(SampleFormat*, SLEngineItf engineEngine);
4343
~AudioRecorder();
4444
SLboolean Start(void);
4545
SLboolean Stop(void);
46-
void SetBufQueues(AudioQueue *freeQ, AudioQueue *recQ);
46+
void SetBufQueues(AudioQueue* freeQ, AudioQueue* recQ);
4747
void ProcessSLCallback(SLAndroidSimpleBufferQueueItf bq);
48-
void RegisterCallback(ENGINE_CALLBACK cb, void *ctx);
48+
void RegisterCallback(ENGINE_CALLBACK cb, void* ctx);
4949
int32_t dbgGetDevBufCount(void);
5050

5151
#ifdef ENABLE_LOG
52-
AndroidLog *recLog_;
52+
AndroidLog* recLog_;
5353
#endif
5454
};
5555

audio-echo/app/src/main/cpp/jni_interface.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,28 @@ extern "C" {
2323
#endif
2424

2525
JNIEXPORT void JNICALL Java_com_google_sample_echo_MainActivity_createSLEngine(
26-
JNIEnv *env, jclass, jint, jint, jlong delayInMs, jfloat decay);
26+
JNIEnv* env, jclass, jint, jint, jlong delayInMs, jfloat decay);
2727
JNIEXPORT void JNICALL Java_com_google_sample_echo_MainActivity_deleteSLEngine(
28-
JNIEnv *env, jclass type);
28+
JNIEnv* env, jclass type);
2929
JNIEXPORT jboolean JNICALL
3030
Java_com_google_sample_echo_MainActivity_createSLBufferQueueAudioPlayer(
31-
JNIEnv *env, jclass);
31+
JNIEnv* env, jclass);
3232
JNIEXPORT void JNICALL
3333
Java_com_google_sample_echo_MainActivity_deleteSLBufferQueueAudioPlayer(
34-
JNIEnv *env, jclass type);
34+
JNIEnv* env, jclass type);
3535

3636
JNIEXPORT jboolean JNICALL
37-
Java_com_google_sample_echo_MainActivity_createAudioRecorder(JNIEnv *env,
37+
Java_com_google_sample_echo_MainActivity_createAudioRecorder(JNIEnv* env,
3838
jclass type);
3939
JNIEXPORT void JNICALL
40-
Java_com_google_sample_echo_MainActivity_deleteAudioRecorder(JNIEnv *env,
40+
Java_com_google_sample_echo_MainActivity_deleteAudioRecorder(JNIEnv* env,
4141
jclass type);
4242
JNIEXPORT void JNICALL
43-
Java_com_google_sample_echo_MainActivity_startPlay(JNIEnv *env, jclass type);
43+
Java_com_google_sample_echo_MainActivity_startPlay(JNIEnv* env, jclass type);
4444
JNIEXPORT void JNICALL
45-
Java_com_google_sample_echo_MainActivity_stopPlay(JNIEnv *env, jclass type);
45+
Java_com_google_sample_echo_MainActivity_stopPlay(JNIEnv* env, jclass type);
4646
JNIEXPORT jboolean JNICALL
47-
Java_com_google_sample_echo_MainActivity_configureEcho(JNIEnv *env, jclass type,
47+
Java_com_google_sample_echo_MainActivity_configureEcho(JNIEnv* env, jclass type,
4848
jint delayInMs,
4949
jfloat decay);
5050
#ifdef __cplusplus

0 commit comments

Comments
 (0)