discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PlayingSound


From: Stefan Bidi
Subject: Re: PlayingSound
Date: Thu, 30 Aug 2012 18:33:14 -0500

On Thu, Aug 30, 2012 at 5:22 PM, Steve Van Voorst <svanvoorst@hughes.net> wrote:
>  1) I'm new to GNUstep/Linux, coming from MacOS.
>  2) Current Operating System = Ubuntu 12.04
>  3) When I run the following code:
>
> #import <Foundation/Foundation.h>
> #import <AppKit/AppKit.h>
>
>  int main()
>  {
>   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
>   [NSApplication sharedApplication];
>
>   NSMenu *menu = [[NSMenu new]autorelease];
>   [menu addItemWithTitle: @"Quit"
>         action: @selector (terminate:)
>         keyEquivalent: @"q"];
>   [NSApp setMainMenu: menu];
>
>   NSSound *sound = [NSSound soundNamed:@"Basso"];
>   [sound play];
>   [NSApp run];
>   [pool drain];
>   return 0;
>  }
>
> I get this ominous message:
>
> WARNING your program is becoming multi-threaded, but you are using an
> ObjectiveC runtime library which does not have a thread-safe implementation
> of the +initialize method.  This means that any classes not already used may
> be incorrectly initialised, potentially causing strange behaviors and
> crashes.
> To put this into context, the runtime bug has been knoown for several years
> and only rarely causes problems ... the easy workaround being to ensure that
> any classes used by a new thread have already been used in the main thread
> before the new thread starts.
> If you are worried, please build/run GNUstep with a runtime which supports
> the +initialize method. The GNUstep stable runtime (libobjc) and
> experimental runtime (libobjc2), available from the GNUstep website and
> subversion repository, should both work.
> To disable this warning (eg. for an application which does not suffer any
> problems caused by this runtime bug), please set the
> GSSilenceInitializeWarning user default to YES.
>
> How serious is this?  It runs without error on the Mac.  I am unable to tell
> if I am running libobjc2; it has been installed.  Where would I set
> GSSilenceInitializeWarning to YES?

Not very serious at all, unless you have a really unusual use case.
To silence it type "defaults write NSGlobalDomain
GSSilenceInitializeWarning YES" on the command line.  Alternatively,
you could set it in SystemPreferences (the app) or in your application
using NSUserDefault (not the best idea, but still an option).

> I'm also curious what happened to NSBeep().  I hear nothing.  The above code
> does produce a sound.

My experience has been that most computers no longer have a PC speaker
and so beeps just don't work.  I took a quick look at the code in back
and it simply uses XBeep() for this functionality.  It's possible your
computer doesn't support it.

> Thanks for any help.
>
> Steve Van Voorst
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]