discuss-gnustep
[Top][All Lists]
Advanced

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

Re: fix for startup of AClock


From: Sebastian Reitenbach
Subject: Re: fix for startup of AClock
Date: Thu, 12 May 2011 23:51:14 +0200
User-agent: Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.9.2.14) Gecko/20110404 Thunderbird/3.1.8

On 05/12/11 20:14, Stefan Bidi wrote:
> So this works for you?  That's great.
>
> Just one thing, not that it really matters, but you don't need to call
> -stop from -sound:didFinishPlaying:.  At this point the the code in
> NSSound would have already stopped and cleaned up.  As a matter of
> fact, you should get NO from the call to -stop.
Ah, yeah, I remove them, if someone else has suggestions for
improvements, let me know ;)

What I noticed while looking how to get it working, I found here:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSSound_Class/Reference/Reference.html

That I should use:
- (void)setDelegate:(id < NSSoundDelegate
<http://developer.apple.com/library/mac/documentation/MusicAudio/Reference/NSSoundDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSSoundDelegate>
>)/delegate
to set the delegate, but then when compiling, I got the error message
that it was unable to find the Protocol definition of NSSoundDelegate.
In GNUstep it seems, NSSoundDelegate is "only" a Category, not a Protocol.

Sebastian
/


>
> On Thu, May 12, 2011 at 12:55 PM, Sebastian Reitenbach
> <sebastia@l00-bugdead-prods.de <mailto:sebastia@l00-bugdead-prods.de>>
> wrote:
>
>     Hi,
>
>     On 05/06/11 16:09, Stefan Bidi wrote:
>     > FYI, that patch is incorrect and will probably not work as intended.
>     > You need to wait for NSSound to finish playing the sound before you
>     > can send -play again or else it just doesn't do anything.  For
>     this to
>     > work you'll need to setup a delegate that responds to
>     > -sound:didFinishPlaying: to find out when the sound is done and send
>     > -play again from there.  Looping won't work here.
>     >
>     > I haven't look at the rest of the file, but it also looks like
>     you're
>     > leaking the NSSound instance.  You call -initWithContentsOfFile:,
>     > -retain, -play and than -release.  The init method returns an
>     instance
>     > with retainCount == 1.  It's been a while since I look at the
>     NSSound
>     > but if I remember correct the instance isn't retained when you call
>     > -play, so you can't call -release immediately after it either.  You
>     > must setup the delegate correctly and release the object from there.
>
>     Attached a new try to work with NSSound. This time I use the
>     sound:didFinishPlaying delegate. Now it also plays the cuckoo in
>     the loop.
>     It work now for me, but anyways, there still maybe sth. wrong with it,
>     so beware. In case there is still sth. wrong with it, I'd like to
>     know ;)
>
>     cheers,
>     Sebastian
>
>
>     >
>     > On Fri, May 6, 2011 at 8:30 AM, Sebastian Reitenbach
>     > <sebastia@l00-bugdead-prods.de
>     <mailto:sebastia@l00-bugdead-prods.de>
>     <mailto:sebastia@l00-bugdead-prods.de
>     <mailto:sebastia@l00-bugdead-prods.de>>>
>     > wrote:
>     >
>     >     Hi,
>     >
>     >     On Friday, May 6, 2011 01:43 CEST, Riccardo Mottola
>     >     <riccardo.mottola@libero.it
>     <mailto:riccardo.mottola@libero.it>
>     <mailto:riccardo.mottola@libero.it
>     <mailto:riccardo.mottola@libero.it>>>
>     >     wrote:
>     >
>     >     > Hi Fred,
>     >     >
>     >     > I cleaned up some of the old apps that way, but only recently
>     >     discovered
>     >     > that the apps do not start up at all if written that way.
>     Sebastian
>     >     > essentially confirms this.
>     >     >
>     >     > Even if the fix is quite simple, I don't understand why it
>     broke. It
>     >     > doesn't work for me on plain 32biit x86 and sparc on linux
>     or NetBSD
>     >     > iwth the gcc runtime. Thus it is not at all libobjc2 or clang.
>     >
>     >     attached diff includes the change i sent before, but removes
>     even
>     >     more compilation warnings, regarding unused variables and
>     the like.
>     >     only one warning left, where it uses a private method of
>     NSColor,
>     >     +colorFromString:. Don't know how to replace this with sth.
>     better.
>     >     Further, instead of using this playsound command, I changed
>     it to
>     >     use NSSound, which works for me so far so good. I only see one
>     >     problem yet, where the cuckoo sound is played in a loop. I here
>     >     the sound only once, but don't know why, maybe someone can
>     tell me
>     >     what is wrong there?
>     >
>     >     cheers,
>     >     Sebastian
>     >
>     >
>     >     >
>     >     > Riccardo
>     >     >
>     >     > Fred Kiefer wrote:
>     >     > > All these patches are nice and fine and should be
>     applied. But
>     >     there
>     >     > > seems to be an underlying issue with libobjc2 that should be
>     >     fixed as
>     >     > > well. The old code is sub-optimal but I cannot see an
>     obvious
>     >     bug in
>     >     > > it, it should actually work. And if it doesn't then it
>     is the
>     >     runtime
>     >     > > that is at fault here.
>     >     > >
>     >     > > David, could you please look into this? And if it isn't the
>     >     runtime
>     >     > > that is wrong here, please explain why the old code was
>     wrong.
>     >     We or
>     >     > > at least I could learn a bit more about the details of
>     >     Objective-C here.
>     >     > >
>     >     > > On 05.05.2011 16:39, Sebastian Reitenbach wrote:
>     >     > >> attached a similar fix to get AClock from gap CVS to
>     start up.
>     >     > >> Actually the same as for LapisPuzzle.
>     >     > >> Further the URL in the Info... window points to a
>     nonexistent
>     >     host,
>     >     > >> but since there is no special page on GAP for it (yet)
>     I did not
>     >     > >> updated it too.
>     >     > >> Anyone knows what this playsound binary is, which is
>     used to
>     >     play the
>     >     > >> sounds?
>     >     > >
>     >     > >
>     >     > > _______________________________________________
>     >     > > Discuss-gnustep mailing list
>     >     > > Discuss-gnustep@gnu.org <mailto:Discuss-gnustep@gnu.org>
>     <mailto:Discuss-gnustep@gnu.org <mailto:Discuss-gnustep@gnu.org>>
>     >     > > https://lists.gnu.org/mailman/listinfo/discuss-gnustep
>     >     >
>     >     >
>     >     > _______________________________________________
>     >     > Discuss-gnustep mailing list
>     >     > Discuss-gnustep@gnu.org <mailto:Discuss-gnustep@gnu.org>
>     <mailto:Discuss-gnustep@gnu.org <mailto:Discuss-gnustep@gnu.org>>
>     >     > https://lists.gnu.org/mailman/listinfo/discuss-gnustep
>     >
>     >
>     >
>     >
>     >
>     >     _______________________________________________
>     >     Discuss-gnustep mailing list
>     >     Discuss-gnustep@gnu.org <mailto:Discuss-gnustep@gnu.org>
>     <mailto:Discuss-gnustep@gnu.org <mailto:Discuss-gnustep@gnu.org>>
>     >     https://lists.gnu.org/mailman/listinfo/discuss-gnustep
>     >
>     >
>
>




reply via email to

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