|
@@ -19,6 +19,7 @@
|
19
|
19
|
#define PREF_LED_MODE @"LEDMode"
|
20
|
20
|
#define PREF_BRIGHTNESS @"Brightness"
|
21
|
21
|
#define PREF_COLOR @"ManualColor"
|
|
22
|
+#define PREF_SENSITIVITY @"Sensitivity"
|
22
|
23
|
|
23
|
24
|
#define TEXT_MANUAL @"Select..."
|
24
|
25
|
#define TEXT_CPU_USAGE @"CPU Usage"
|
|
@@ -73,12 +74,15 @@
|
73
|
74
|
@property (weak) IBOutlet NSMenuItem *menuItemAudio;
|
74
|
75
|
@property (weak) IBOutlet NSMenu *menuAudio;
|
75
|
76
|
@property (weak) IBOutlet NSMenu *menuPorts;
|
76
|
|
-
|
77
|
77
|
@property (weak) IBOutlet NSMenuItem *buttonOff;
|
78
|
78
|
@property (weak) IBOutlet NSMenuItem *brightnessItem;
|
79
|
79
|
@property (weak) IBOutlet NSSlider *brightnessSlider;
|
80
|
80
|
@property (weak) IBOutlet NSMenuItem *brightnessLabel;
|
81
|
81
|
@property (weak) IBOutlet NSMenuItem *buttonLights;
|
|
82
|
+@property (weak) IBOutlet NSMenuItem *sensitivityItem;
|
|
83
|
+@property (weak) IBOutlet NSSlider *sensitivitySlider;
|
|
84
|
+@property (weak) IBOutlet NSMenuItem *sensitivityLabel;
|
|
85
|
+@property (weak) IBOutlet NSMenuItem *sensitivityMenu;
|
82
|
86
|
|
83
|
87
|
@property (strong) NSMenuItem *menuItemColor;
|
84
|
88
|
|
|
@@ -99,6 +103,7 @@
|
99
|
103
|
@synthesize menuItemAudio, menuAudio;
|
100
|
104
|
@synthesize buttonOff, buttonLights;
|
101
|
105
|
@synthesize brightnessItem, brightnessSlider, brightnessLabel;
|
|
106
|
+@synthesize sensitivityItem, sensitivitySlider, sensitivityLabel, sensitivityMenu;
|
102
|
107
|
@synthesize statusItem, statusImage;
|
103
|
108
|
@synthesize staticColors, animation;
|
104
|
109
|
@synthesize serial, lastLEDMode, microphone;
|
|
@@ -126,6 +131,7 @@
|
126
|
131
|
[appDefaults setObject:[NSNumber numberWithBool:NO] forKey:PREF_LIGHTS_STATE];
|
127
|
132
|
[appDefaults setObject:@"" forKey:PREF_LED_MODE];
|
128
|
133
|
[appDefaults setObject:[NSNumber numberWithFloat:50.0] forKey:PREF_BRIGHTNESS];
|
|
134
|
+ [appDefaults setObject:[NSNumber numberWithFloat:100.0] forKey:PREF_SENSITIVITY];
|
129
|
135
|
[store registerDefaults:appDefaults];
|
130
|
136
|
[store synchronize];
|
131
|
137
|
NSString *savedPort = [store stringForKey:PREF_SERIAL_PORT];
|
|
@@ -133,6 +139,7 @@
|
133
|
139
|
NSString *lastMode = [store stringForKey:PREF_LED_MODE];
|
134
|
140
|
float brightness = [store floatForKey:PREF_BRIGHTNESS];
|
135
|
141
|
NSData *lastColorData = [store dataForKey:PREF_COLOR];
|
|
142
|
+ float sensitivity = [store floatForKey:PREF_SENSITIVITY];
|
136
|
143
|
NSColor *lastColor = nil;
|
137
|
144
|
if (lastColorData != nil) {
|
138
|
145
|
lastColor = (NSColor *)[NSUnarchiver unarchiveObjectWithData:lastColorData];
|
|
@@ -324,6 +331,13 @@
|
324
|
331
|
}
|
325
|
332
|
if ([inputDevices count] > 0) {
|
326
|
333
|
[menuItemAudio setHidden:NO];
|
|
334
|
+
|
|
335
|
+ // Prepare sensitivity menu
|
|
336
|
+ sensitivityItem.view = sensitivitySlider;
|
|
337
|
+ [sensitivitySlider setFloatValue:sensitivity];
|
|
338
|
+ [sensitivityLabel setTitle:[NSString stringWithFormat:@"Value: %.0f%%", sensitivity]];
|
|
339
|
+ [sensitivityMenu setHidden:NO];
|
|
340
|
+ [AudioVisualizer setSensitivity:sensitivity];
|
327
|
341
|
}
|
328
|
342
|
}
|
329
|
343
|
|
|
@@ -512,6 +526,16 @@
|
512
|
526
|
[self setLightsColor:[sender color]];
|
513
|
527
|
}
|
514
|
528
|
|
|
529
|
+- (IBAction)sensitivityMoved:(NSSlider *)sender {
|
|
530
|
+ [sensitivityLabel setTitle:[NSString stringWithFormat:@"Value: %.0f%%", [sender floatValue]]];
|
|
531
|
+ [AudioVisualizer setSensitivity:[sender floatValue]];
|
|
532
|
+
|
|
533
|
+ // Store changed value in preferences
|
|
534
|
+ NSUserDefaults *store = [NSUserDefaults standardUserDefaults];
|
|
535
|
+ [store setObject:[NSNumber numberWithFloat:[sender floatValue]] forKey:PREF_SENSITIVITY];
|
|
536
|
+ [store synchronize];
|
|
537
|
+}
|
|
538
|
+
|
515
|
539
|
- (IBAction)brightnessMoved:(NSSlider *)sender {
|
516
|
540
|
[brightnessLabel setTitle:[NSString stringWithFormat:@"Value: %.0f%%", [sender floatValue]]];
|
517
|
541
|
|
|
@@ -728,6 +752,9 @@
|
728
|
752
|
for (int i = 0; i < [audioDevices count]; i++) {
|
729
|
753
|
EZAudioDevice *dev = [audioDevices objectAtIndex:i];
|
730
|
754
|
if ([[dev name] isEqualToString:[sender title]]) {
|
|
755
|
+ // Send command to turn off LEDs
|
|
756
|
+ [self setLightsR:0 G:0 B:0];
|
|
757
|
+
|
731
|
758
|
// Found device
|
732
|
759
|
foundDev = YES;
|
733
|
760
|
if (microphone != nil) {
|