Browse Source

Fixed crash when changing audio input with FFT debug window

Thomas Buck 8 years ago
parent
commit
e1d56f0f11
3 changed files with 3 additions and 11 deletions
  1. 2
    8
      CaseLights/AppDelegate.m
  2. 0
    2
      CaseLights/AudioVisualizer.m
  3. 1
    1
      CaseLights/Info.plist

+ 2
- 8
CaseLights/AppDelegate.m View File

@@ -337,7 +337,6 @@
337 337
     // Stop previous audio data retrieval
338 338
     if (microphone != nil) {
339 339
         [microphone stopFetchingAudio];
340
-        microphone = nil;
341 340
     }
342 341
     
343 342
     // Remove display callback
@@ -398,7 +397,6 @@
398 397
     // Stop previous audio data retrieval
399 398
     if (microphone != nil) {
400 399
         [microphone stopFetchingAudio];
401
-        microphone = nil;
402 400
     }
403 401
     
404 402
     // Turn off all other LED menu items
@@ -543,7 +541,6 @@
543 541
         // Stop previous audio data retrieval
544 542
         if (microphone != nil) {
545 543
             [microphone stopFetchingAudio];
546
-            microphone = nil;
547 544
         }
548 545
 
549 546
         // Turn off all other LED menu items
@@ -633,7 +630,6 @@
633 630
     // Stop previous audio data retrieval
634 631
     if (microphone != nil) {
635 632
         [microphone stopFetchingAudio];
636
-        microphone = nil;
637 633
     }
638 634
     
639 635
     // Schedule next invocation for this animation...
@@ -678,7 +674,6 @@
678 674
     // Stop previous audio data retrieval
679 675
     if (microphone != nil) {
680 676
         [microphone stopFetchingAudio];
681
-        microphone = nil;
682 677
     }
683 678
     
684 679
     // Schedule next invocation for this animation...
@@ -737,9 +732,9 @@
737 732
                 foundDev = YES;
738 733
                 if (microphone != nil) {
739 734
                     [microphone stopFetchingAudio];
740
-                    microphone = nil;
735
+                } else {
736
+                    microphone = [EZMicrophone microphoneWithDelegate:self];
741 737
                 }
742
-                microphone = [EZMicrophone microphoneWithDelegate:self];
743 738
                 [microphone setDevice:dev];
744 739
                 [microphone startFetchingAudio];
745 740
                 break;
@@ -773,7 +768,6 @@
773 768
                 // Stop previous audio data retrieval
774 769
                 if (microphone != nil) {
775 770
                     [microphone stopFetchingAudio];
776
-                    microphone = nil;
777 771
                 }
778 772
                 
779 773
                 NSColor *color = [staticColors valueForKey:key];

+ 0
- 2
CaseLights/AudioVisualizer.m View File

@@ -13,8 +13,6 @@
13 13
 //  Copyright © 2016 xythobuz. All rights reserved.
14 14
 //
15 15
 
16
-// Enabling this will cause crashes when changing audio input
17
-// devices while the app is running. Select it before enabling.
18 16
 #ifdef DEBUG
19 17
 #define DEBUG_PLOT_FFT
20 18
 //#define DEBUG_PLOT_FFT_RAW

+ 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>388</string>
24
+	<string>391</string>
25 25
 	<key>LSApplicationCategoryType</key>
26 26
 	<string>public.app-category.utilities</string>
27 27
 	<key>LSMinimumSystemVersion</key>

Loading…
Cancel
Save