Re: iOS when is my app launched

2010-12-08 Thread Jason Bobier
Hey Dave,

I'm talking about the Carbon equivalent of processLaunchDate in the 
ProcessInfoExtendedRec. This is the actual date  time that the process 
launched.

I want to use it to give my game's splash screen a consistent amount of time on 
screen. Here's how:

I set the Default.png to the splash screen and immediately show the same image 
when my app launches. I then check the launch date to determine how much time 
it has shown and add x number of seconds to that.

I know that this information is available via the ps command, so I could just 
resort to that, but I was hoping for a nice, clean, api way of doing it.

Thanks,

Jason


On Dec 8, 2010, at 3:57 AM, Dave Keck wrote:

 How do I find the date and time when my application launched? I've done this 
 before on OS X, but it was a while ago and I've forgotten how. :)
 
 I'm not sure what you mean exactly, but [NSDate date] will return the
 current date/time. Tuck that instance in memory when your application
 launches and you'll have that information for later, or alternatively
 store it to disk using NSKeyedArchiver.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS when is my app launched

2010-12-08 Thread Jason Bobier
Hi Glenn, 

This is for a game, which is an exception to this rule.

Jason

On Dec 8, 2010, at 9:27 AM, glenn andreas wrote:

 
 On Dec 8, 2010, at 7:38 AM, Jason Bobier wrote:
 
 Hey Dave,
 
 I'm talking about the Carbon equivalent of processLaunchDate in the 
 ProcessInfoExtendedRec. This is the actual date  time that the process 
 launched.
 
 I want to use it to give my game's splash screen a consistent amount of time 
 on screen. Here's how:
 
 I set the Default.png to the splash screen and immediately show the same 
 image when my app launches. I then check the launch date to determine how 
 much time it has shown and add x number of seconds to that.
 
 Don't do that.
 
 From 
 http://developer.apple.com/library/safari/#documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html%23//apple_ref/doc/uid/TP40006556-CH14-SW1:
 
 
 Supply a launch image to improve user experience; avoid using it as an 
 opportunity to provide:
 
   • An “application entry experience,” such as a splash screen
   • An About window
   • Branding elements, unless they are a static part of your 
 application’s first screen
 Because users are likely to switch among applications frequently, you should 
 make every effort to cut launch time to a minimum, and you should design a 
 launch image that downplays the experience rather than drawing attention to 
 it.
 
 
 
 
 
 So Default.png is not suppose to be a splash screen, and you're suppose to 
 strive to make it go away as fast as possible - not figure out ways to 
 display it for longer...
 
 
 Glenn Andreas  gandr...@gandreas.com 
 The most merciful thing in the world ... is the inability of the human mind 
 to correlate all its contents - HPL
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


iOS when is my app launched

2010-12-07 Thread Jason Bobier
How do I find the date and time when my application launched? I've done this 
before on OS X, but it was a while ago and I've forgotten how. :)

Thanks so much!

Jason

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Jason Bobier
As many of you know, saving and restoring complex navigation hierarchies on the 
iPhone can be a real chore. So, I had this brilliant idea of setting up my app 
delegate like this:

applicationDidFinishLaunching
if userdefaults contains an archived navcontroller
unarchive controller and retain
else
load nib with controller and retain
add navcontroller view to window

applicationWillTerminate
archive nav controller and save to user defaults

and then make all of my view controllers NSCoding compliant

In theory, the archived navcontroller should contain my complex view controller 
hierarchy and all of the related views, so this should work.

However, when I unarchive and add to view to the window, the subviews rarely 
have all of their values set correctly despite being supposedly NSCoding 
compliant. (For example, I have a button that fails to have it's target and 
action set)

Am I missing something here or is this just buggy NSCoding compliant code on 
apple's part?

Thanks,

Jason

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Jason Bobier
This is separate from my model. This is the restoration of the view and 
controller hierarchy that is expected of iPhone apps when they startup. 
Restoring this can be incredibly complex when you have lots of view controllers 
including nav controllers, tab bar controllers, and modal controllers all 
stacked up.

All of these are NSCoding compliant, which means that if I archive it, I should 
be able to unarchive it and get the exact state back (subject to conditional 
archiving, etc...) as long as I archive a complete object graph.

Clearly, if there are any connections in your nib that connect to proxy objects 
(or the file's owner), you'd have to restore them yourself since you aren't 
loading from the nib.

Storing the version of the app that saved the hierarchy would solve any issues 
related to that.

Note, I've written tons of code to manually restore the hierarchy for other 
apps, I'm just trying to be clever and to save myself a bunch of complex coding 
(that easily gets out of sync with how your hierarchies can be stacked) this 
time... :)

Jason


On Feb 10, 2010, at 3:12 PM, Jens Alfke wrote:

 
 On Feb 10, 2010, at 10:40 AM, Jason Bobier wrote:
 
 In theory, the archived navcontroller should contain my complex view 
 controller hierarchy and all of the related views, so this should work.
 However, when I unarchive and add to view to the window, the subviews rarely 
 have all of their values set correctly despite being supposedly NSCoding 
 compliant. (For example, I have a button that fails to have it's target and 
 action set)
 
 There's more to nib loading than just unarchiving views. I don't think this 
 is unlikely to work.
 
 I don't think it should be necessary, either: it's a violation of MVC. The 
 persistent data is the model; that's what you want to save. The views are 
 configured at runtime to reflect the state of the model.
 
 One practical problem with your approach would be if you ever change the 
 design of your view hierarchy in a future release. Now you have a complex 
 schema-migration problem when existing users launch the new version of the 
 app and load an obsolete view hierarchy.
 
 —Jens

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Jason Bobier
Yes, you have to account for any references into the unarchived graph that 
objects not included in the graph hold. In my case, this should be as simple as 
removing the navcontroller view from it's superview.

Jason

On Feb 10, 2010, at 4:19 PM, Kyle Sluder wrote:

 On Wed, Feb 10, 2010 at 12:54 PM, Jason Bobier ja...@prismatix.com wrote:
 All of these are NSCoding compliant, which means that if I archive it, I 
 should be able to unarchive it and get the exact state back (subject to 
 conditional archiving, etc...) as long as I archive a complete object graph.
 
 Not true. You have no idea what other objects have references to the
 ones you've archives, and these external references might be crucial
 to the functionality of your object graph.
 
 --Kyle Sluder

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Jason Bobier
Hey Ricky,

I'm strictly attempting to archive the controllers and views hierarchy starting 
from the navcontroller. My data model is quite separate from all of this.

I've often done similar things to what you recommend, but complex interfaces 
often include tab controllers, nav controllers, modal views, etc..., storing 
the precise order of all of these along with the related metadata of all of the 
controls is a pain and prone to error.

This idea came about because I was annoyed at having to do it again and 
realized that everything that I wanted to store was NSCoding compliant, which 
means that it should be archivable. It appears that some of the NSCoding 
compliant objects aren't completely restorable tho. :-/

Jason


On Feb 10, 2010, at 4:53 PM, Ricky Sharp wrote:

 
 On Feb 10, 2010, at 12:40 PM, Jason Bobier wrote:
 
 You don't want to take this approach at all.
 
 The proper thing to do is to archive model data (as others have pointed out). 
  Note that this will now also be faster too since it will be a much smaller 
 data set.
 
 For nav-based apps, this set of data often includes a screen ID of what 
 screen the user left off at.  Upon app launch, you can basically just push 
 whatever screen you need to on the nav controller's stack.
 
 This is exactly what I do in my own iPhone OS apps.  I also have an 
 infrastructure to pass an NSDictionary filled with parameters as users hop 
 from screen to screen.
 
 This allowed me to do stuff like this:
 
 In MyScreenA...
 
 - (IBAction)someAction:(id)sender
 {
NSDictionary* = parameters = ...;
 
[self pushScreen:MyScreenBID withParameters:parameters animated:YES];
 }
 
 If users exit the app while on Screen B, I simply store the fact that I was 
 on that screen (and any other metadata I need to preserve selections, scroll 
 position, etc.)
 
 Then, on app launch, if such a freeze-dried state exists, I ultimately build 
 up a set of parameters just like I did in the action method above.  Then push 
 the appropriate screen with those parameters (and set animated flag to NO).  
 This will give the appearance of the app launching directly to the screen the 
 user left off.
 
 But, under the covers, this is what actually occurs on app launch:
 
 - app launch routines
 - nav controller created; main nib loaded and set as top view
 - code that senses you have a saved state
 - push appropriate view controller to go to last used screen
 
 All the standard nib-loading occurs and things just work.
 
 
 
 ___
 Ricky A. Sharp mailto:rsh...@instantinteractive.com
 Instant Interactive(tm)   http://www.instantinteractive.com
 
 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


RegisterEventHotKey still the best way for global hotkeys

2009-02-21 Thread Jason Bobier
Hey there, before I use RegisterEventHotKey, I just wanted to make  
sure that it was still the only way to add a global hotkey to a  
machine? All that I really want to do is to cause my application to  
open when a hotkey is pressed if there happens to be a better way to  
do that.


Thanks,

Jason

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


unable to break out of runloop because timers are fired and then the loop waits

2008-09-24 Thread Jason Bobier

Hey folks, I have a runloop on a thread that looks like this:

while (! _cancelled) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

	[runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate  
distantFuture]];

[pool release];
}

And I put a timer in the loop that sets _cancelled to true, the  
runloop never stops. What's the proper way to do this?


Thanks,

Jason
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: unable to break out of runloop because timers are fired and then the loop waits

2008-09-24 Thread Jason Bobier
Thanks Nick. I'm trying to avoid polling tho (since that is the whole  
point of runloops and mach ports).


Jason

On Sep 24, 2008, at 3:38 PM, Nick Zitzmann wrote:



On Sep 24, 2008, at 1:15 PM, Jason Bobier wrote:


Hey folks, I have a runloop on a thread that looks like this:

while (! _cancelled) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

	[runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate  
distantFuture]];

[pool release];
}

And I put a timer in the loop that sets _cancelled to true, the  
runloop never stops. What's the proper way to do this?



Don't run it until the distant future; that'll cause the call to  
block until some time in 400X, by which time you probably won't be  
using your current Mac anymore. :) Instead, you should run shorter  
intervals (like a second from now), and if you need NSEvents to  
trigger during the time, then you should probably use - 
[NSApplication nextEventMatchingMask:...] instead with dequeueing.  
That method also runs the specified run loop.


Nick Zitzmann
http://www.chronosnet.com/



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: best way to determine if portion of window is visible?

2008-08-19 Thread Jason Bobier

Hey Andy,

It's not really the cpu cycles that I'm worried about. It's how  
quickly a large number of windows closes. I'm fading each window for  
1/2 second, in order of appearance. It looks really nice, but there  
isn't really a need to fade the windows that aren't visible and in  
fact, causes it to appear as if nothing is happening if a large number  
of non-exposed windows are faded before the exposed ones are.


Jason

On Aug 15, 2008, at 5:09 PM, Andy Lee wrote:


On Aug 15, 2008, at 2:18 PM, Jason Bobier wrote:
I'd like to fade my window out if any portion of it is visible to  
the user, otherwise I simply want to close it for speed. Is there  
an easy way to determine if some portion of the window is visible?


Offhand I'd say if they can't see it, they can't tell how long it's  
taking to fade away, and I suspect the few extra CPU cycles used for  
the fade would be negligible.


--Andy




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: best way to determine if portion of window is visible?

2008-08-19 Thread Jason Bobier

Hi Mike,

I'm using an NSViewAnimation to fade the windows, which I suspect uses  
the alpha channel. A window close is nearly instantaneous, so I'm not  
worried about the tiny window between when I check to see if the  
window is exposed and when it closes.


Of course, because of the transparency of the covering windows, it is  
even more difficult to know whether the window is exposed or not. :-)


Jason

On Aug 15, 2008, at 6:07 PM, Michael Ash wrote:


On Fri, Aug 15, 2008 at 2:18 PM, Jason Bobier [EMAIL PROTECTED] wrote:

Hey folks,

I'd like to fade my window out if any portion of it is visible to  
the user,
otherwise I simply want to close it for speed. Is there an easy way  
to

determine if some portion of the window is visible?


If you're fading out the window using setAlphaValue: then it's likely
the window server will realize when your window can't be seen anywhere
and will be smart enough not to redraw anything, saving you from
having to do any work. I don't know if any way to find out for
yourself, and indeed it's kind of tough because the user could easily
expose your window in between your check and the action you take based
on it.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jbobier%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: controlling system muting ?

2008-07-08 Thread Jason Bobier

Thanks for the pointers. I'll take a look.

I should note that this isn't an computer emergency, this is a real  
emergency, i.e. there is a hurricane coming and you need to be here.  
Part of the requirements from the emergency first responders is that  
this unmute any muted computers.


Jason

On Jul 8, 2008, at 12:24 AM, Phil wrote:


On Tue, Jul 8, 2008 at 3:25 PM, Jason Bobier [EMAIL PROTECTED] wrote:
Has anyone figured out how to control a machine's volume level  
(specifically
muting) from code? I know that you can do it from Applescript, but  
running

an applescript from code seems to be a rather clunky approach.

This is for emergency notification, so I have to be able to crank  
the volume

on the system and then restore it afterwards.



Take a read of QA1016:
http://developer.apple.com/qa/qa2006/qa1016.html

Also, TN2102, if you haven't already:
http://developer.apple.com/technotes/tn2002/tn2102.html

However, I would urge you not to mess around with the user's volume
control, even you think it is an emergency---the user may feel very
differently. Your application should play an alert sound, and trust
that the user's system output volume and alert volume are correct for
what they want to hear (although, I have no idea what your application
does; but in the general case, messing around with user settings when
they don't expect it isn't good).

-Phil


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: controlling system muting ?

2008-07-08 Thread Jason Bobier
lol.. I knew I should have specified that this is a product  
requirement from users to avoid all of the worrying people are doing  
about my app. :-)


Jason

On Jul 8, 2008, at 7:52 AM, Andreas Mayer wrote:



Am 08.07.2008 um 12:46 Uhr schrieb [EMAIL PROTECTED]:

2. Bring up an alert and after a set amount of time without the  
user responding to it, then start making things louder.


Don't.

If I mute the sound, I don't want to hear a thing, even if this  
machine is going to blow up.


Should I ever encounter an app that does otherwise, it will land in  
the trash faster than you can say 'mute'. ;-)


(Of course you may add a preference for that - as long as it is  
disabled by default.)



Andreas
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jbobier%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: controlling system muting ?

2008-07-08 Thread Jason Bobier
I also need to determine the user's current mute and volume settings  
and restore them after my alert plays, which is the other reason that  
I was looking for something other than AppleScript.


Jason

On Jul 8, 2008, at 4:02 PM, I. Savant wrote:


But that isn't what the OP asked. The OP asks *how* to do it without
AppleScript - not *whether* to do it without AppleScript.  
Furthermore, the
OP is right that running an AppleScript from within Cocoa/Objective- 
C is

noticeably slower than going thru CoreAudio. m.


 Actually, the OP said, running an applescript from code seems to be
a rather clunky approach. Nothing about it being 'noticeably slower'.
I've not compared the two directly but I notice no pause whatsoever
with a button wired to a create and run a 'mute volume' AppleScript
method run on my first revision MBP.

 Regardless, I wasn't suggesting he not use CoreAudio, merely that
there's nothing inherently wrong with using AS if all you want to do
is a one-off toggle of mute/unmute. Does it *really* have to happen in
under 5 nanoseconds when 5 milliseconds is practically imperceptible
as it is?

 All I'm saying (and I'll keep saying it) is that in this situation,
AS works just fine.

--
I.S.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


NSSound won't play wave files???

2008-07-07 Thread Jason Bobier
Has anyone else had issues playing wave files with NSSound? Not only  
does it refuse to play the file (even tho I can open it with the  
Quicktime Player and play it), but it fails to error. It simply  
doesn't make a sound. AIFF files seem to play just fine. Here is the  
code in a generic project.


@implementation TestController
- (void)awakeFromNib
{
BOOL success;

	NSSound *sound = [[NSSound alloc] initWithContentsOfFile:@/Users/ 
jason/Desktop/306.wav byReference:YES];
//	NSSound *sound = [[NSSound alloc] initWithContentsOfFile:@/Users/ 
jason/Desktop/306.aif byReference:YES];


success = [sound play];

NSLog(@%d, (int)success);
}
@end

Very straight forward. The sound allocs and inits just fine and  
success is YES after play is called. Not only does it fail to make a  
sound, but it also fails to call my sound finished delegate.


Looking in the Console, I get this mysterious error:

7/7/08 2:41:51 AM Test[29698] com.apple.console Warning 1

whenever the sound is played.

Any ideas???

Thanks!

Jason
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSSound won't play wave files???

2008-07-07 Thread Jason Bobier

BTW, this:

- (void)awakeFromNib
{
BOOL success;
NSError *error = nil;

	QTMovie *sound = [[QTMovie movieWithFile:@/Users/jason/Desktop/ 
306.wav error:error] retain];


[sound play];

NSLog(@%d, (int)success);
}


works fine.


On Jul 7, 2008, at 2:53 AM, Jason Bobier wrote:

Has anyone else had issues playing wave files with NSSound? Not only  
does it refuse to play the file (even tho I can open it with the  
Quicktime Player and play it), but it fails to error. It simply  
doesn't make a sound. AIFF files seem to play just fine. Here is the  
code in a generic project.


@implementation TestController
- (void)awakeFromNib
{
BOOL success;

	NSSound *sound = [[NSSound alloc] initWithContentsOfFile:@/Users/ 
jason/Desktop/306.wav byReference:YES];
//	NSSound *sound = [[NSSound alloc] initWithContentsOfFile:@/Users/ 
jason/Desktop/306.aif byReference:YES];


success = [sound play];

NSLog(@%d, (int)success);
}
@end

Very straight forward. The sound allocs and inits just fine and  
success is YES after play is called. Not only does it fail to make a  
sound, but it also fails to call my sound finished delegate.


Looking in the Console, I get this mysterious error:

7/7/08 2:41:51 AM Test[29698] com.apple.console Warning 1

whenever the sound is played.

Any ideas???

Thanks!

Jason
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jbobier%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSSound won't play wave files???

2008-07-07 Thread Jason Bobier

Hey Charles,

I just did and that worked fine, so at least I have a work around. :-)

Jason

On Jul 7, 2008, at 3:01 AM, Charles Srstka wrote:


On Jul 7, 2008, at 1:53 AM, Jason Bobier wrote:

Has anyone else had issues playing wave files with NSSound? Not  
only does it refuse to play the file (even tho I can open it with  
the Quicktime Player and play it), but it fails to error. It simply  
doesn't make a sound. AIFF files seem to play just fine. Here is  
the code in a generic project.


@implementation TestController
- (void)awakeFromNib
{
BOOL success;

	NSSound *sound = [[NSSound alloc] initWithContentsOfFile:@/Users/ 
jason/Desktop/306.wav byReference:YES];
//	NSSound *sound = [[NSSound alloc] initWithContentsOfFile:@/ 
Users/jason/Desktop/306.aif byReference:YES];


success = [sound play];

NSLog(@%d, (int)success);
}
@end

Very straight forward. The sound allocs and inits just fine and  
success is YES after play is called. Not only does it fail to make  
a sound, but it also fails to call my sound finished delegate.


Looking in the Console, I get this mysterious error:

7/7/08 2:41:51 AM Test[29698] com.apple.console Warning 1

whenever the sound is played.

Any ideas???


Since it works in QuickTime Player, have you tried using QTMovie  
instead of NSSound to play the file?


Charles


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


controlling system muting ?

2008-07-07 Thread Jason Bobier

Hey folks,

Has anyone figured out how to control a machine's volume level  
(specifically muting) from code? I know that you can do it from  
Applescript, but running an applescript from code seems to be a rather  
clunky approach.


This is for emergency notification, so I have to be able to crank the  
volume on the system and then restore it afterwards.


Thanks for any insight!

Jason
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


NSTask(syslog)-NSPipe-NSFileHandle-readInBackgroundAndNotify buffers

2008-06-11 Thread Jason Bobier
Hey folks, I know that this has been discussed here before, but after  
spending hours reading cocoa-dev posts, I have yet to find the solution.


The issue that I'm having is that I'm using NSTask to create a syslog  
process with the -w option to continually parse specific syslog  
entries. The problem is that if there are too few entries, I never  
receive the notification.


I understand that along the way, something is buffering the data. How  
do I turn that off?


Here's some more info:
it works fine if I don't use the -w with syslog(i.e. I allow the task  
to complete)

syslog appears to linebuffer to the terminal

Here's what I've tried:
fcntl F_NOCACHE on the fileHandleForReading file descriptor returns -1
adding NSUnbufferedIO to the environment of the NSTask doesn't appear  
to do anything


Thanks greatly for the help,

Jason
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSTask(syslog)-NSPipe-NSFileHandle-readInBackgroundAndNotify buffers

2008-06-11 Thread Jason Bobier

Hey Ken,

I was originally going to use the ASL api, but it seems to require  
polling. Looking through the asl code, I noticed that the syslog  
command didn't poll on Leopard and between that and the different  
ASL_KEY_TIME formats on Tiger and Leopard, I decided to use the


syslog -w 5000 -F raw -u -k mykey

command and just parse the output. Polling the syslog database seems  
rather horrendous even if I was able to filter out the previously  
received entries (which doesn't seem possible because Tiger's  
ASL_KEY_TIME isn't comparable and ASL_KEY_MSG_ID only appears in  
Leopard).


Any other thoughts?

Jason

PS, I read the Domain of the Bored ASL stuff before I started and it  
saved me countless headaches. :-)


On Jun 11, 2008, at 5:05 PM, Ken Thomases wrote:


On Jun 11, 2008, at 3:10 PM, Jason Bobier wrote:

The issue that I'm having is that I'm using NSTask to create a  
syslog process with the -w option to continually parse specific  
syslog entries. The problem is that if there are too few entries, I  
never receive the notification.


I understand that along the way, something is buffering the data.  
How do I turn that off?


I believe that this is out of the control of your Cocoa process.   
It's under the control of the child syslog process.  It might be  
changing its behavior based on whether its output is going to a tty  
device, but I'm not sure.


You should consider using the ASL (Apple System Log) API, instead.   
It's Apple's more modern replacement for syslog.  For backward  
compatibility, I believe it's hooked into syslogd, but ASL is the  
native logging facility.  There's a great series of blog posts  
about ASL here: http://boredzo.org/blog/archives/2008-01-19/next-week-apple-system-logger 
.


Good luck,
Ken


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Unvending a distributed object

2008-06-11 Thread Jason Bobier

Yes, that is how you do it.

Jason

On Jun 11, 2008, at 7:09 PM, Ken Thomases wrote:


On Jun 11, 2008, at 6:05 PM, Mike Manzano wrote:

Does anyone know how to unvend an object? I found this thread on  
the list:


http://lists.apple.com/archives/Cocoa-dev/2002/Mar/msg00710.html

but it didn't seem to have any definitive answer.

Am I missing something obvious?


Contrary to that linked post, I would expect that setRootObject:nil  
would do it.  However, I haven't investigated with any rigor.


Have you tried it and found it to not work?

Regards,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jbobier%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]