Revision: 106
Author:
t...@electrotap.com
Date: Fri Mar 12 10:30:02 2010
Log: SoundflowerBed: fix for googlecode issue #18 -- problem where SFB
would be silent after waking the computer from sleep. Thanks to Morton
Heller for submitting the code to fix this problem.
http://code.google.com/p/soundflower/source/detail?r=106
Modified:
/trunk/SoundflowerBed/AppController.mm
=======================================
--- /trunk/SoundflowerBed/AppController.mm Wed Sep 2 09:43:11 2009
+++ /trunk/SoundflowerBed/AppController.mm Fri Mar 12 10:30:02 2010
@@ -184,7 +184,7 @@
case kIOMessageSystemHasPoweredOn:
//printf("kIOMessageSystemHasPoweredOn\n");
-//crashing? [NSThread detachNewThreadSelector:@selector(resume)
toTarget:app withObject:nil];
+ [NSTimer scheduledTimerWithTimeInterval:0.0 target:app
selector:@selector(resume) userInfo:nil repeats:NO];
break;
@@ -209,18 +209,19 @@
- (IBAction)resume
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
+ //NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (mSuspended2chDevice) {
[self outputDeviceSelected:mSuspended2chDevice];
+ mCur2chDevice = mSuspended2chDevice;
mSuspended2chDevice = NULL;
}
if (mSuspended16chDevice) {
[self outputDeviceSelected:mSuspended16chDevice];
+ mCur16chDevice = mSuspended16chDevice;
mSuspended16chDevice = NULL;
}
-
- [pool release];
+
+ //[pool release];
}
@@ -331,9 +332,7 @@
[self buildDeviceList];
- if (menuItemVisible) {
- [mSbItem setMenu:nil];
- }
+ [mSbItem setMenu:nil];
[mMenu dealloc];
[self buildMenu];
@@ -652,15 +651,13 @@
item = [mMenu addItemWithTitle:@"About Soundflowerbed..."
action:@selector(doAbout) keyEquivalent:@""];
[item setTarget:self];
- item = [mMenu addItemWithTitle:@"Hide Soundflowerbed"
action:@selector(hideMenuItem) keyEquivalent:@""];
- [item setTarget:self];
+ // item = [mMenu addItemWithTitle:@"Hide Soundflowerbed"
action:@selector(hideMenuItem) keyEquivalent:@""];
+ // [item setTarget:self];
item = [mMenu addItemWithTitle:@"Quit Soundflowerbed"
action:@selector(doQuit) keyEquivalent:@""];
[item setTarget:self];
- if (menuItemVisible) {
- [mSbItem setMenu:mMenu];
- }
+ [mSbItem setMenu:mMenu];
}
- (void)buildDeviceList
@@ -691,30 +688,6 @@
}
}
}
-
-- (void)showMenuItem
-{
- if (!menuItemVisible) {
- mSbItem = [[NSStatusBar systemStatusBar]
statusItemWithLength:NSVariableStatusItemLength];
- [mSbItem retain];
- [mSbItem setImage:[NSImage imageNamed:@"menuIcon"]];
- [mSbItem setHighlightMode:YES];
- [mSbItem setMenu:mMenu];
- menuItemVisible = YES;
- }
-}
-
-- (void)hideMenuItem
-{
- [[mSbItem statusBar] removeStatusItem:mSbItem];
- [mSbItem release];
- menuItemVisible = NO;
-}
-
-- (void)applicationWillBecomeActive: (NSNotification*)aNotification
-{
- [self showMenuItem];
-}
- (void)awakeFromNib
{
@@ -722,6 +695,13 @@
[self buildDeviceList];
+ mSbItem = [[NSStatusBar systemStatusBar]
statusItemWithLength:NSVariableStatusItemLength];
+ [mSbItem retain];
+
+ //[sbItem setTitle:@"¥¥"];
+ [mSbItem setImage:[NSImage imageNamed:@"menuIcon"]];
+ [mSbItem setHighlightMode:YES];
+
[self buildMenu];
if (mSoundflower2Device && mSoundflower16Device) {
@@ -741,8 +721,6 @@
// now read prefs
[self readGlobalPrefs];
}
-
- [self showMenuItem];
// ask to be notified on system sleep to avoid a crash
IONotificationPortRef notify;