Bläddra i källkod

Fixed crash when changing audio input with FFT debug window

Thomas Buck 8 år sedan
förälder
incheckning
e1d56f0f11
3 ändrade filer med 3 tillägg och 11 borttagningar
  1. 2
    8
      CaseLights/AppDelegate.m
  2. 0
    2
      CaseLights/AudioVisualizer.m
  3. 1
    1
      CaseLights/Info.plist

+ 2
- 8
CaseLights/AppDelegate.m Visa fil

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

+ 0
- 2
CaseLights/AudioVisualizer.m Visa fil

13
 //  Copyright © 2016 xythobuz. All rights reserved.
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
 #ifdef DEBUG
16
 #ifdef DEBUG
19
 #define DEBUG_PLOT_FFT
17
 #define DEBUG_PLOT_FFT
20
 //#define DEBUG_PLOT_FFT_RAW
18
 //#define DEBUG_PLOT_FFT_RAW

+ 1
- 1
CaseLights/Info.plist Visa fil

21
 	<key>CFBundleSignature</key>
21
 	<key>CFBundleSignature</key>
22
 	<string>????</string>
22
 	<string>????</string>
23
 	<key>CFBundleVersion</key>
23
 	<key>CFBundleVersion</key>
24
-	<string>388</string>
24
+	<string>391</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>

Laddar…
Avbryt
Spara