Browse Source

Fixed bug that caused wrong colors to be displayed when a timer was in use when selecting a sound device

Thomas Buck 8 years ago
parent
commit
01d01aa33d
2 changed files with 23 additions and 1 deletions
  1. 22
    0
      CaseLights/AppDelegate.m
  2. 1
    1
      CaseLights/Info.plist

+ 22
- 0
CaseLights/AppDelegate.m View File

@@ -773,6 +773,12 @@
773 773
     
774 774
     // Check if it is an audio input device
775 775
     if ((found == NO) && ([sender tag] == MENU_ITEM_TAG_AUDIO)) {
776
+        // Stop previous timer setting
777
+        if (animation != nil) {
778
+            [animation invalidate];
779
+            animation = nil;
780
+        }
781
+        
776 782
         found = YES;
777 783
         BOOL foundDev = NO;
778 784
         NSArray *audioDevices = [EZAudioDevice inputDevices];
@@ -794,9 +800,25 @@
794 800
                 break;
795 801
             }
796 802
         }
803
+        
797 804
         if (foundDev == NO) {
798 805
             NSLog(@"Couldn't find device \"%@\"\n", [sender title]);
799 806
             [sender setState:NSOffState];
807
+            
808
+            // List available audio input devices and add menu items
809
+            NSArray *inputDevices = [EZAudioDevice inputDevices];
810
+            [menuAudio removeAllItems];
811
+            for (int i = 0; i < [inputDevices count]; i++) {
812
+                EZAudioDevice *dev = [inputDevices objectAtIndex:i];
813
+                NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[dev name] action:@selector(selectedVisualization:) keyEquivalent:@""];
814
+                [item setTag:MENU_ITEM_TAG_AUDIO];
815
+                if ([[dev name] isEqualToString:[sender title]]) {
816
+                    // Found the device the user really wanted
817
+                    [self selectedVisualization:item];
818
+                }
819
+                [menuAudio addItem:item];
820
+            }
821
+            
800 822
             return; // Don't store new mode
801 823
         }
802 824
     }

+ 1
- 1
CaseLights/Info.plist View File

@@ -21,7 +21,7 @@
21 21
 	<key>CFBundleSignature</key>
22 22
 	<string>????</string>
23 23
 	<key>CFBundleVersion</key>
24
-	<string>404</string>
24
+	<string>405</string>
25 25
 	<key>LSApplicationCategoryType</key>
26 26
 	<string>public.app-category.utilities</string>
27 27
 	<key>LSMinimumSystemVersion</key>

Loading…
Cancel
Save