Skip to content

Commit fac5d9d

Browse files
ngocdhann0see
andauthoredFeb 27, 2022
Add .mm extension to coding style check (#1871)
* Add .mm extension to coding style check Review of #1865 by @pljones revealed .mm extension was not checked. * .clang-format for ObjC * Apply clang-format to sound.mm * Apply clang format on all .mm files Co-authored-by: ann0see <[email protected]>
1 parent b37732e commit fac5d9d

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed
 

‎.clang-format

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ SpaceAfterTemplateKeyword: false
5050
SpaceBeforeParens: NonEmptyParentheses
5151
SpacesInConditionalStatement: true
5252
SpacesInParentheses: true
53+
ObjCBlockIndentWidth: 4
54+
ObjCSpaceAfterProperty: true
55+
ObjCSpaceBeforeProtocolList: true

‎.github/workflows/coding-style-check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
- uses: DoozyX/clang-format-lint-action@2a28e3a8d9553f244243f7e1ff94f6685dff87be
1919
with:
2020
clangFormatVersion: 10
21-
extensions: 'cpp,h'
21+
extensions: 'cpp,h,mm'

‎ios/sound.mm

+20-20
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242

4343
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&audioSessionError];
4444
[[AVAudioSession sharedInstance] requestRecordPermission:^( BOOL granted ) {
45-
if ( granted )
46-
{
47-
// ok
48-
}
49-
else
50-
{
51-
// TODO - alert user
52-
}
45+
if ( granted )
46+
{
47+
// ok
48+
}
49+
else
50+
{
51+
// TODO - alert user
52+
}
5353
}];
5454
[[AVAudioSession sharedInstance] setMode:AVAudioSessionModeMeasurement error:&audioSessionError];
5555
}
@@ -226,18 +226,18 @@ And because Jamulus uses the same buffer to store input and output data (input i
226226

227227
if ( !isInitialized )
228228
{
229-
[[NSNotificationCenter defaultCenter] addObserverForName:AVAudioSessionRouteChangeNotification
230-
object:nil
231-
queue:nil
232-
usingBlock:^( NSNotification* notification ) {
233-
UInt8 reason =
234-
[[notification.userInfo valueForKey:AVAudioSessionRouteChangeReasonKey] intValue];
235-
if ( reason == AVAudioSessionRouteChangeReasonNewDeviceAvailable or
236-
reason == AVAudioSessionRouteChangeReasonOldDeviceUnavailable )
237-
{
238-
emit ReinitRequest ( RS_RELOAD_RESTART_AND_INIT ); // reload the available devices frame
239-
}
240-
}];
229+
[[NSNotificationCenter defaultCenter]
230+
addObserverForName:AVAudioSessionRouteChangeNotification
231+
object:nil
232+
queue:nil
233+
usingBlock:^( NSNotification* notification ) {
234+
UInt8 reason = [[notification.userInfo valueForKey:AVAudioSessionRouteChangeReasonKey] intValue];
235+
if ( reason == AVAudioSessionRouteChangeReasonNewDeviceAvailable or
236+
reason == AVAudioSessionRouteChangeReasonOldDeviceUnavailable )
237+
{
238+
emit ReinitRequest ( RS_RELOAD_RESTART_AND_INIT ); // reload the available devices frame
239+
}
240+
}];
241241
}
242242

243243
isInitialized = true;

‎mac/activity.mm

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@
3131
id<NSObject> activityId;
3232
};
3333

34-
CActivity::CActivity() : pActivity(new CActivityId()) {}
34+
CActivity::CActivity() : pActivity ( new CActivityId() ) {}
3535

36-
CActivity::~CActivity()
37-
{
38-
delete pActivity;
39-
}
36+
CActivity::~CActivity() { delete pActivity; }
4037

4138
void CActivity::BeginActivity()
4239
{
43-
NSActivityOptions options = NSActivityBackground | NSActivityIdleDisplaySleepDisabled | NSActivityIdleSystemSleepDisabled | NSActivityLatencyCritical;
40+
NSActivityOptions options =
41+
NSActivityBackground | NSActivityIdleDisplaySleepDisabled | NSActivityIdleSystemSleepDisabled | NSActivityLatencyCritical;
4442

45-
pActivity->activityId = [[NSProcessInfo processInfo] beginActivityWithOptions: options reason:@"Jamulus provides low latency audio processing and should not be inturrupted by system throttling."];
43+
pActivity->activityId = [[NSProcessInfo processInfo]
44+
beginActivityWithOptions:options
45+
reason:@"Jamulus provides low latency audio processing and should not be inturrupted by system throttling."];
4646
}
4747

4848
void CActivity::EndActivity()
4949
{
50-
[[NSProcessInfo processInfo] endActivity: pActivity->activityId];
50+
[[NSProcessInfo processInfo] endActivity:pActivity->activityId];
5151

5252
pActivity->activityId = nil;
5353
}

0 commit comments

Comments
 (0)
Please sign in to comment.