From 01bba290b15ee8e3e3f14f0180ad907a2d3be38b Mon Sep 17 00:00:00 2001 From: ngocdh Date: Sun, 13 Jun 2021 18:35:58 +0200 Subject: [PATCH 1/4] Add .mm extension to coding style check Review of #1865 by @pljones revealed .mm extension was not checked. --- .github/workflows/coding-style-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coding-style-check.yml b/.github/workflows/coding-style-check.yml index d04775f26d..e1b5751c00 100644 --- a/.github/workflows/coding-style-check.yml +++ b/.github/workflows/coding-style-check.yml @@ -18,4 +18,4 @@ jobs: - uses: DoozyX/clang-format-lint-action@2a28e3a8d9553f244243f7e1ff94f6685dff87be with: clangFormatVersion: 10 - extensions: 'cpp,h' + extensions: 'cpp,h,mm' From 37bd464eca87a877d2d031f45b14089867f195ae Mon Sep 17 00:00:00 2001 From: ngocdh Date: Mon, 14 Jun 2021 17:44:45 +0200 Subject: [PATCH 2/4] .clang-format for ObjC --- .clang-format | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.clang-format b/.clang-format index 89d5ac7734..36a70ef86b 100644 --- a/.clang-format +++ b/.clang-format @@ -50,3 +50,6 @@ SpaceAfterTemplateKeyword: false SpaceBeforeParens: NonEmptyParentheses SpacesInConditionalStatement: true SpacesInParentheses: true +ObjCBlockIndentWidth: 4 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true From 083a9a289345970f611736eaa8a80cf721b62ddb Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Sun, 27 Feb 2022 10:44:11 +0100 Subject: [PATCH 3/4] Apply clang-format to sound.mm --- ios/sound.mm | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ios/sound.mm b/ios/sound.mm index 7e2b443359..1467cb5772 100644 --- a/ios/sound.mm +++ b/ios/sound.mm @@ -42,14 +42,14 @@ [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&audioSessionError]; [[AVAudioSession sharedInstance] requestRecordPermission:^( BOOL granted ) { - if ( granted ) - { - // ok - } - else - { - // TODO - alert user - } + if ( granted ) + { + // ok + } + else + { + // TODO - alert user + } }]; [[AVAudioSession sharedInstance] setMode:AVAudioSessionModeMeasurement error:&audioSessionError]; } @@ -226,18 +226,18 @@ And because Jamulus uses the same buffer to store input and output data (input i if ( !isInitialized ) { - [[NSNotificationCenter defaultCenter] addObserverForName:AVAudioSessionRouteChangeNotification - object:nil - queue:nil - usingBlock:^( NSNotification* notification ) { - UInt8 reason = - [[notification.userInfo valueForKey:AVAudioSessionRouteChangeReasonKey] intValue]; - if ( reason == AVAudioSessionRouteChangeReasonNewDeviceAvailable or - reason == AVAudioSessionRouteChangeReasonOldDeviceUnavailable ) - { - emit ReinitRequest ( RS_RELOAD_RESTART_AND_INIT ); // reload the available devices frame - } - }]; + [[NSNotificationCenter defaultCenter] + addObserverForName:AVAudioSessionRouteChangeNotification + object:nil + queue:nil + usingBlock:^( NSNotification* notification ) { + UInt8 reason = [[notification.userInfo valueForKey:AVAudioSessionRouteChangeReasonKey] intValue]; + if ( reason == AVAudioSessionRouteChangeReasonNewDeviceAvailable or + reason == AVAudioSessionRouteChangeReasonOldDeviceUnavailable ) + { + emit ReinitRequest ( RS_RELOAD_RESTART_AND_INIT ); // reload the available devices frame + } + }]; } isInitialized = true; From f06a49910a2b21fc862bb8b5cc318ceda71cc542 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Sun, 27 Feb 2022 10:47:31 +0100 Subject: [PATCH 4/4] Apply clang format on all .mm files --- mac/activity.mm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mac/activity.mm b/mac/activity.mm index 5212437cad..013e92e726 100644 --- a/mac/activity.mm +++ b/mac/activity.mm @@ -31,23 +31,23 @@ id activityId; }; -CActivity::CActivity() : pActivity(new CActivityId()) {} +CActivity::CActivity() : pActivity ( new CActivityId() ) {} -CActivity::~CActivity() -{ - delete pActivity; -} +CActivity::~CActivity() { delete pActivity; } void CActivity::BeginActivity() { - NSActivityOptions options = NSActivityBackground | NSActivityIdleDisplaySleepDisabled | NSActivityIdleSystemSleepDisabled | NSActivityLatencyCritical; + NSActivityOptions options = + NSActivityBackground | NSActivityIdleDisplaySleepDisabled | NSActivityIdleSystemSleepDisabled | NSActivityLatencyCritical; - pActivity->activityId = [[NSProcessInfo processInfo] beginActivityWithOptions: options reason:@"Jamulus provides low latency audio processing and should not be inturrupted by system throttling."]; + pActivity->activityId = [[NSProcessInfo processInfo] + beginActivityWithOptions:options + reason:@"Jamulus provides low latency audio processing and should not be inturrupted by system throttling."]; } void CActivity::EndActivity() { - [[NSProcessInfo processInfo] endActivity: pActivity->activityId]; + [[NSProcessInfo processInfo] endActivity:pActivity->activityId]; pActivity->activityId = nil; }