ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Pellow <n...@cortexebusiness.com.au>
Subject Re: [submit] A build sound alert Task
Date Mon, 04 Dec 2000 02:42:37 GMT


Diane Holt wrote:
> 
> Nick,
> 
> Is there a write-up for this? I grabbed the two source-files, but I didn't
> see any documentation. Do you need to specify the -listener flag to ant in
> order for this to work?

No, the code itself adds itself as a Listener during its execute()
method.
Just ensure that wherever you build the files to, ( i have a seperate
directory outside the ant tree )
is in your CLASSPATH.
Also ensure that you are using at least jdk1.3 by doing a "java
-version" on the command line.
If you are not then you will need to install the Java Media Framework
packages somewhere on your system.
I developed the AntSound task using jdk1.3.

Then all that is needed is a 
  <taskdef name="sound" classname="SoundTask"/>
in your build file and at the top of the first Target 
     <sound>
       <success source="laser1.aif" loops="0"/>
       <fail source="ohno.wav" loops="2"/>
    </sound>
, say.

This kicks off a new thread, listenening for build events!

> 
> I'd love to try using this (some things can use all the fun'ing up they
> can get). I'd like to see if I can do something random, with my .wav files
> separted into "success"/"fail" dirs, rather than having to hard-code in
> specific files. 

Could be very easily done during the SoundTasks exectue() method?

> And I guess have a SOUND env var people can set, since not
> everyone's gonna want fun'ing up (no matter how much they could use some).

Knock yourself out! 
eg:
<taskdef name="fun" classname="FunTask"/>
...
<fun funFactor="HIGH">
	<bells volume="10"/> 
	<whistles random="true"/>
</fun>


cheers, 
Nick

> 
> Diane
> 
> --- Nick Pellow <nick@cortexebusiness.com.au> wrote:
> >
> >
> > KC Baltz wrote:
> > >
> > > I'm a bit confused as to the usage. (BTW, I love the fact that you can
> > have
> > > a continuous background sound for your build.
> >
> > Sorry, I do have the code for that, but I did not send it as I thought
> > it not as
> > important/useful as the build alert! (I must have left the comment in
> > though)
> >
> > I'm going to look for a .wav
> > > with construction noises like saws and hammers :)
> > >
> > > Here you say it can only play sounds when the <b>build</b> is
> > successful.
> > >
> > > > Attached is a new Task that provides a sound alert for the user
> > > > for certain BuildEvents. Currently, it can play sounds
> > > > (I have only tested it with .aiff and .wav formats) when a build is
> > > > succesful or a different one when a build fails.
> > > >
> > >
> > > But here, it's inside a <target>, which makes me think the sound
> > depends on
> > > the success of the <target>, not the <project>.
> >
> > Nope,
> > I add it to the project:
> > getProject().addBuildListener(soundPlayer);
> >
> > then I start a new Thread, which runs until
> > public void buildFinished(BuildEvent event)
> > is called.
> >
> > As long as the <sound> task is defined in a target somewhere, it's
> > thread
> > will run until the end of the build to alert the user.
> >
> > > > an example:
> > > > <target name="code">
> > > >     <sound>
> > > >        <success source="laser1.aif" loops="0"/>
> > > >        <fail source="ohno.wav" loops="2"/>
> > > >     </sound>
> > >
> > > Thanks for writing this;  it should help me get back to work sooner
> > after a
> > > build finishes.
> > >
> > > K.C.
> 
> =====
> (holtdl@yahoo.com)
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/

Mime
View raw message