@@ -68,9 +68,8 @@ - (id)init
6868 [defaults setObject: defaultSound forKey: @" NXSystemBeep" ];
6969 }
7070
71- soundsList = [[NSDictionary alloc ]
72- initWithDictionary: [self loadSoundList ]];
73-
71+ soundsList = [[NSDictionary alloc ] initWithDictionary: [self loadSoundList ]];
72+
7473 return self;
7574}
7675
@@ -104,18 +103,17 @@ - (NSDictionary *)loadSoundList
104103- (void )awakeFromNib
105104{
106105 NSString *beepType;
107-
106+
108107 [view retain ];
109108 [window release ];
110109
111110 // 1. Connect to PulseAudio on locahost
112111 soundServer = [SNDServer sharedServer ];
113112 // 2. Wait for server to be ready
114- [[NSNotificationCenter defaultCenter ]
115- addObserver: self
116- selector: @selector (serverStateChanged: )
117- name: SNDServerStateDidChangeNotification
118- object: soundServer];
113+ [[NSNotificationCenter defaultCenter ] addObserver: self
114+ selector: @selector (serverStateChanged: )
115+ name: SNDServerStateDidChangeNotification
116+ object: soundServer];
119117 // 3. Create connection to PulseAudio server
120118 if (soundServer.status == SNDServerNoConnnectionState) {
121119 [soundServer connect ];
@@ -125,14 +123,13 @@ - (void)awakeFromNib
125123 [beepBrowser loadColumnZero ];
126124 if (defSoundRow >= 0 ) {
127125 [beepBrowser selectRow: defSoundRow inColumn: 0 ];
128- [beepBrowser scrollRowToVisible: defSoundRow+ 3 inColumn: 0 ];
126+ [beepBrowser scrollRowToVisible: defSoundRow + 3 inColumn: 0 ];
129127 }
130128
131129 [[beepAudioRadio cellWithTag: 0 ] setRefusesFirstResponder: YES ];
132130 [[beepAudioRadio cellWithTag: 1 ] setRefusesFirstResponder: YES ];
133131 beepType = [defaults objectForKey: @" NXSystemBeepType" ];
134- [beepAudioRadio
135- selectCellWithTag: ([beepType isEqualToString: @" Audio" ] == NO )];
132+ [beepAudioRadio selectCellWithTag: ([beepType isEqualToString: @" Audio" ] == NO )];
136133}
137134
138135// --- Protocol
@@ -163,11 +160,14 @@ - (void)_updateControls
163160 soundServer.name, soundServer.version,
164161 soundServer.userName, soundServer.hostName];
165162 [soundInfo setStringValue: info];
163+
166164 if (soundOut) {
167165 [muteButton setEnabled: YES ];
168166 [volumeLevel setEnabled: YES ];
169167 [volumeBalance setEnabled: YES ];
170168 [muteButton setState: [soundOut isMute ]];
169+ NSLog (@" soundOut volume: %lu " , [soundOut volume ]);
170+ // [soundOut printDescription];
171171 [volumeLevel setIntegerValue: [soundOut volume ]];
172172 [volumeBalance setFloatValue: [soundOut balance ]];
173173 }
@@ -202,12 +202,14 @@ - (void)serverStateChanged:(NSNotification *)notif
202202 if (soundServer.status == SNDServerReadyState) {
203203 soundOut = [[soundServer defaultOutput ] retain ];
204204 soundIn = [[soundServer defaultInput ] retain ];
205-
205+
206206 if (soundOut) {
207- [volumeLevel setMaxValue: [soundOut volumeSteps ]-1 ];
207+ [volumeLevel setMaxValue: PA_VOLUME_NORM];
208+ [volumeLevel setIntValue: soundOut.volume];
208209 }
209210 if (soundIn) {
210- [micLevel setMaxValue: [soundIn volumeSteps ]-1 ];
211+ [micLevel setMaxValue: PA_VOLUME_NORM];
212+ [micLevel setIntValue: soundIn.volume];
211213 }
212214 [[NSNotificationCenter defaultCenter ]
213215 addObserver: self
0 commit comments