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
     
773
     
774
     // Check if it is an audio input device
774
     // Check if it is an audio input device
775
     if ((found == NO) && ([sender tag] == MENU_ITEM_TAG_AUDIO)) {
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
         found = YES;
782
         found = YES;
777
         BOOL foundDev = NO;
783
         BOOL foundDev = NO;
778
         NSArray *audioDevices = [EZAudioDevice inputDevices];
784
         NSArray *audioDevices = [EZAudioDevice inputDevices];
794
                 break;
800
                 break;
795
             }
801
             }
796
         }
802
         }
803
+        
797
         if (foundDev == NO) {
804
         if (foundDev == NO) {
798
             NSLog(@"Couldn't find device \"%@\"\n", [sender title]);
805
             NSLog(@"Couldn't find device \"%@\"\n", [sender title]);
799
             [sender setState:NSOffState];
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
             return; // Don't store new mode
822
             return; // Don't store new mode
801
         }
823
         }
802
     }
824
     }

+ 1
- 1
CaseLights/Info.plist View File

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

Loading…
Cancel
Save