Skip to content

Commit 648c595

Browse files
committed
Update format
1 parent 770a235 commit 648c595

File tree

4 files changed

+75
-63
lines changed

4 files changed

+75
-63
lines changed

ios/RCTWebRTC/AudioDeviceModuleObserver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
NS_ASSUME_NONNULL_BEGIN
55

6-
@interface AudioDeviceModuleObserver : NSObject <RTCAudioDeviceModuleDelegate>
6+
@interface AudioDeviceModuleObserver : NSObject<RTCAudioDeviceModuleDelegate>
77

88
- (instancetype)initWithWebRTCModule:(WebRTCModule *)module;
99

ios/RCTWebRTC/WebRTCModule+RTCAudioDeviceModule.m

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ @implementation WebRTCModule (RTCAudioDeviceModule)
1010

1111
#pragma mark - Recording & Playback Control
1212

13-
RCT_EXPORT_METHOD(audioDeviceModuleStartPlayout : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)
14-
reject) {
13+
RCT_EXPORT_METHOD(audioDeviceModuleStartPlayout
14+
: (RCTPromiseResolveBlock)resolve rejecter
15+
: (RCTPromiseRejectBlock)reject) {
1516
NSInteger result = [self.audioDeviceModule startPlayout];
1617
if (result == 0) {
1718
resolve(@{@"success" : @YES});
@@ -20,8 +21,9 @@ @implementation WebRTCModule (RTCAudioDeviceModule)
2021
}
2122
}
2223

23-
RCT_EXPORT_METHOD(audioDeviceModuleStopPlayout : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)
24-
reject) {
24+
RCT_EXPORT_METHOD(audioDeviceModuleStopPlayout
25+
: (RCTPromiseResolveBlock)resolve rejecter
26+
: (RCTPromiseRejectBlock)reject) {
2527
NSInteger result = [self.audioDeviceModule stopPlayout];
2628
if (result == 0) {
2729
resolve(@{@"success" : @YES});
@@ -30,8 +32,9 @@ @implementation WebRTCModule (RTCAudioDeviceModule)
3032
}
3133
}
3234

33-
RCT_EXPORT_METHOD(audioDeviceModuleStartRecording : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)
34-
reject) {
35+
RCT_EXPORT_METHOD(audioDeviceModuleStartRecording
36+
: (RCTPromiseResolveBlock)resolve rejecter
37+
: (RCTPromiseRejectBlock)reject) {
3538
NSInteger result = [self.audioDeviceModule startRecording];
3639
if (result == 0) {
3740
resolve(@{@"success" : @YES});
@@ -40,8 +43,9 @@ @implementation WebRTCModule (RTCAudioDeviceModule)
4043
}
4144
}
4245

43-
RCT_EXPORT_METHOD(audioDeviceModuleStopRecording : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)
44-
reject) {
46+
RCT_EXPORT_METHOD(audioDeviceModuleStopRecording
47+
: (RCTPromiseResolveBlock)resolve rejecter
48+
: (RCTPromiseRejectBlock)reject) {
4549
NSInteger result = [self.audioDeviceModule stopRecording];
4650
if (result == 0) {
4751
resolve(@{@"success" : @YES});
@@ -50,8 +54,9 @@ @implementation WebRTCModule (RTCAudioDeviceModule)
5054
}
5155
}
5256

53-
RCT_EXPORT_METHOD(audioDeviceModuleStartLocalRecording : (RCTPromiseResolveBlock)
54-
resolve rejecter : (RCTPromiseRejectBlock)reject) {
57+
RCT_EXPORT_METHOD(audioDeviceModuleStartLocalRecording
58+
: (RCTPromiseResolveBlock)resolve rejecter
59+
: (RCTPromiseRejectBlock)reject) {
5560
NSInteger result = [self.audioDeviceModule initAndStartRecording];
5661
if (result == 0) {
5762
resolve(@{@"success" : @YES});
@@ -61,8 +66,9 @@ @implementation WebRTCModule (RTCAudioDeviceModule)
6166
}
6267
}
6368

64-
RCT_EXPORT_METHOD(audioDeviceModuleStopLocalRecording : (RCTPromiseResolveBlock)
65-
resolve rejecter : (RCTPromiseRejectBlock)reject) {
69+
RCT_EXPORT_METHOD(audioDeviceModuleStopLocalRecording
70+
: (RCTPromiseResolveBlock)resolve rejecter
71+
: (RCTPromiseRejectBlock)reject) {
6672
NSInteger result = [self.audioDeviceModule stopRecording];
6773
if (result == 0) {
6874
resolve(@{@"success" : @YES});
@@ -74,8 +80,10 @@ @implementation WebRTCModule (RTCAudioDeviceModule)
7480

7581
#pragma mark - Microphone Control
7682

77-
RCT_EXPORT_METHOD(audioDeviceModuleSetMicrophoneMuted : (BOOL)muted resolver : (RCTPromiseResolveBlock)
78-
resolve rejecter : (RCTPromiseRejectBlock)reject) {
83+
RCT_EXPORT_METHOD(audioDeviceModuleSetMicrophoneMuted
84+
: (BOOL)muted resolver
85+
: (RCTPromiseResolveBlock)resolve rejecter
86+
: (RCTPromiseRejectBlock)reject) {
7987
NSInteger result = [self.audioDeviceModule setMicrophoneMuted:muted];
8088
if (result == 0) {
8189
resolve(@{@"success" : @YES, @"muted" : @(muted)});
@@ -90,8 +98,10 @@ @implementation WebRTCModule (RTCAudioDeviceModule)
9098

9199
#pragma mark - Voice Processing
92100

93-
RCT_EXPORT_METHOD(audioDeviceModuleSetVoiceProcessingEnabled : (BOOL)enabled resolver : (RCTPromiseResolveBlock)
94-
resolve rejecter : (RCTPromiseRejectBlock)reject) {
101+
RCT_EXPORT_METHOD(audioDeviceModuleSetVoiceProcessingEnabled
102+
: (BOOL)enabled resolver
103+
: (RCTPromiseResolveBlock)resolve rejecter
104+
: (RCTPromiseRejectBlock)reject) {
95105
NSInteger result = [self.audioDeviceModule setVoiceProcessingEnabled:enabled];
96106
if (result == 0) {
97107
resolve(@{@"success" : @YES, @"enabled" : @(enabled)});
@@ -140,8 +150,10 @@ @implementation WebRTCModule (RTCAudioDeviceModule)
140150

141151
#pragma mark - Advanced Features
142152

143-
RCT_EXPORT_METHOD(audioDeviceModuleSetMuteMode : (NSInteger)mode resolver : (RCTPromiseResolveBlock)
144-
resolve rejecter : (RCTPromiseRejectBlock)reject) {
153+
RCT_EXPORT_METHOD(audioDeviceModuleSetMuteMode
154+
: (NSInteger)mode resolver
155+
: (RCTPromiseResolveBlock)resolve rejecter
156+
: (RCTPromiseRejectBlock)reject) {
145157
NSInteger result = [self.audioDeviceModule setMuteMode:(RTCAudioEngineMuteMode)mode];
146158
if (result == 0) {
147159
resolve(@{@"success" : @YES, @"mode" : @(mode)});

ios/RCTWebRTC/WebRTCModule.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#import <React/RCTLog.h>
88
#import <React/RCTUtils.h>
99

10+
#import "AudioDeviceModuleObserver.h"
1011
#import "WebRTCModule+RTCPeerConnection.h"
1112
#import "WebRTCModule.h"
1213
#import "WebRTCModuleOptions.h"
13-
#import "AudioDeviceModuleObserver.h"
1414

1515
@interface WebRTCModule ()
1616
@end
@@ -72,18 +72,18 @@ - (instancetype)init {
7272
RCTLogInfo(@"Using video decoder factory: %@", NSStringFromClass([decoderFactory class]));
7373

7474
if (audioDevice == nil) {
75-
RCTLogInfo(@"Using audio processing module: %@", NSStringFromClass([audioProcessingModule class]));
76-
_peerConnectionFactory =
77-
[[RTCPeerConnectionFactory alloc] initWithAudioDeviceModuleType:RTCAudioDeviceModuleTypeAudioEngine
78-
bypassVoiceProcessing:NO
79-
encoderFactory:encoderFactory
80-
decoderFactory:decoderFactory
81-
audioProcessingModule:audioProcessingModule];
75+
RCTLogInfo(@"Using audio processing module: %@", NSStringFromClass([audioProcessingModule class]));
76+
_peerConnectionFactory =
77+
[[RTCPeerConnectionFactory alloc] initWithAudioDeviceModuleType:RTCAudioDeviceModuleTypeAudioEngine
78+
bypassVoiceProcessing:NO
79+
encoderFactory:encoderFactory
80+
decoderFactory:decoderFactory
81+
audioProcessingModule:audioProcessingModule];
8282
} else {
83-
RCTLogInfo(@"Using audio device: %@", NSStringFromClass([audioDevice class]));
84-
_peerConnectionFactory = [[RTCPeerConnectionFactory alloc] initWithEncoderFactory:encoderFactory
85-
decoderFactory:decoderFactory
86-
audioDevice:audioDevice];
83+
RCTLogInfo(@"Using audio device: %@", NSStringFromClass([audioDevice class]));
84+
_peerConnectionFactory = [[RTCPeerConnectionFactory alloc] initWithEncoderFactory:encoderFactory
85+
decoderFactory:decoderFactory
86+
audioDevice:audioDevice];
8787
}
8888

8989
_peerConnections = [NSMutableDictionary new];

src/AudioDeviceModule.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export enum AudioEngineMuteMode {
1515
*/
1616
export class AudioDeviceModule {
1717
/**
18-
* Start audio playback
19-
*/
18+
* Start audio playback
19+
*/
2020
static async startPlayout(): Promise<{ success: boolean }> {
2121
if (Platform.OS === 'android') {
2222
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -26,8 +26,8 @@ export class AudioDeviceModule {
2626
}
2727

2828
/**
29-
* Stop audio playback
30-
*/
29+
* Stop audio playback
30+
*/
3131
static async stopPlayout(): Promise<{ success: boolean }> {
3232
if (Platform.OS === 'android') {
3333
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -37,8 +37,8 @@ export class AudioDeviceModule {
3737
}
3838

3939
/**
40-
* Start audio recording
41-
*/
40+
* Start audio recording
41+
*/
4242
static async startRecording(): Promise<{ success: boolean }> {
4343
if (Platform.OS === 'android') {
4444
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -48,8 +48,8 @@ export class AudioDeviceModule {
4848
}
4949

5050
/**
51-
* Stop audio recording
52-
*/
51+
* Stop audio recording
52+
*/
5353
static async stopRecording(): Promise<{ success: boolean }> {
5454
if (Platform.OS === 'android') {
5555
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -59,8 +59,8 @@ export class AudioDeviceModule {
5959
}
6060

6161
/**
62-
* Initialize and start local audio recording (calls initAndStartRecording)
63-
*/
62+
* Initialize and start local audio recording (calls initAndStartRecording)
63+
*/
6464
static async startLocalRecording(): Promise<{ success: boolean }> {
6565
if (Platform.OS === 'android') {
6666
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -70,8 +70,8 @@ export class AudioDeviceModule {
7070
}
7171

7272
/**
73-
* Stop local audio recording
74-
*/
73+
* Stop local audio recording
74+
*/
7575
static async stopLocalRecording(): Promise<{ success: boolean }> {
7676
if (Platform.OS === 'android') {
7777
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -81,8 +81,8 @@ export class AudioDeviceModule {
8181
}
8282

8383
/**
84-
* Mute or unmute the microphone
85-
*/
84+
* Mute or unmute the microphone
85+
*/
8686
static async setMicrophoneMuted(muted: boolean): Promise<{ success: boolean; muted: boolean }> {
8787
if (Platform.OS === 'android') {
8888
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -92,8 +92,8 @@ export class AudioDeviceModule {
9292
}
9393

9494
/**
95-
* Check if microphone is currently muted
96-
*/
95+
* Check if microphone is currently muted
96+
*/
9797
static isMicrophoneMuted(): boolean {
9898
if (Platform.OS === 'android') {
9999
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -103,8 +103,8 @@ export class AudioDeviceModule {
103103
}
104104

105105
/**
106-
* Enable or disable voice processing (requires engine restart)
107-
*/
106+
* Enable or disable voice processing (requires engine restart)
107+
*/
108108
static async setVoiceProcessingEnabled(enabled: boolean): Promise<{ success: boolean; enabled: boolean }> {
109109
if (Platform.OS === 'android') {
110110
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -114,8 +114,8 @@ export class AudioDeviceModule {
114114
}
115115

116116
/**
117-
* Check if voice processing is enabled
118-
*/
117+
* Check if voice processing is enabled
118+
*/
119119
static isVoiceProcessingEnabled(): boolean {
120120
if (Platform.OS === 'android') {
121121
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -125,8 +125,8 @@ export class AudioDeviceModule {
125125
}
126126

127127
/**
128-
* Temporarily bypass voice processing without restarting the engine
129-
*/
128+
* Temporarily bypass voice processing without restarting the engine
129+
*/
130130
static setVoiceProcessingBypassed(bypassed: boolean): void {
131131
if (Platform.OS === 'android') {
132132
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -136,8 +136,8 @@ export class AudioDeviceModule {
136136
}
137137

138138
/**
139-
* Check if voice processing is currently bypassed
140-
*/
139+
* Check if voice processing is currently bypassed
140+
*/
141141
static isVoiceProcessingBypassed(): boolean {
142142
if (Platform.OS === 'android') {
143143
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -147,8 +147,8 @@ export class AudioDeviceModule {
147147
}
148148

149149
/**
150-
* Enable or disable Automatic Gain Control (AGC)
151-
*/
150+
* Enable or disable Automatic Gain Control (AGC)
151+
*/
152152
static setVoiceProcessingAGCEnabled(enabled: boolean): { success: boolean; enabled: boolean } {
153153
if (Platform.OS === 'android') {
154154
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -158,8 +158,8 @@ export class AudioDeviceModule {
158158
}
159159

160160
/**
161-
* Check if AGC is enabled
162-
*/
161+
* Check if AGC is enabled
162+
*/
163163
static isVoiceProcessingAGCEnabled(): boolean {
164164
if (Platform.OS === 'android') {
165165
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -169,8 +169,8 @@ export class AudioDeviceModule {
169169
}
170170

171171
/**
172-
* Check if audio is currently playing
173-
*/
172+
* Check if audio is currently playing
173+
*/
174174
static isPlaying(): boolean {
175175
if (Platform.OS === 'android') {
176176
throw new Error('AudioDeviceModule is only available on iOS/macOS');
@@ -180,8 +180,8 @@ export class AudioDeviceModule {
180180
}
181181

182182
/**
183-
* Check if audio is currently recording
184-
*/
183+
* Check if audio is currently recording
184+
*/
185185
static isRecording(): boolean {
186186
if (Platform.OS === 'android') {
187187
throw new Error('AudioDeviceModule is only available on iOS/macOS');

0 commit comments

Comments
 (0)