This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Head First Java - BeatBox Code

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am currently having some difficulty with the following code. The code is from Bert and Kathy's Head First Book. The Beatbox compiles fine, however, when I run the program the beatbox only plays one loop instead of a continuous loop as suggested in the book. Any help would be greatly appreciated.

Regards,

Tom



//JAM -- added code tags.
[ May 09, 2005: Message edited by: Joel McNary ]
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

Did you ever get this figured out? I'm having the identical problem...

Thanks!

Mike
 
Tom Shanks
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike,

I've never figured it out. Could be that the code does not loop. It would be nice to find a way to loop the code. Kathy or Bert please help!

Regards,

Tom
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked the erata

HFJ Erata

There is something in there about a thread in the beat box, not sure if its what your lookin for.
 
author
Posts: 8998
19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I'm guessing that you've got the old version of HF Java, and you're using Tiger... For some strange reason, javax.sound.midi changed a bit with Tiger, and the old code doesn't loop anymore

The easiest thing to do is to go to wickedlysmart.com and get the new code kitchen source code. If you want to try to wade thru the API, and crack this on your own, you'll have to make changes in the buildTrackAndStart method ( add a call to sequencer.LOOP_CONTNUOUSLY), after the setSequencer call. You'll also want to use a tempo factor rather than BPM thru-out the code... arghh!

I'd recommend getting the code

HTH,

Bert
 
Tom Shanks
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bert and Bob,

Thanks for your replies, this Java Greenhorn will follow your advice once I get a bit of time from my hectic work schedule. Keep up the good work guys!

Regards,

Tom Shanks :
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have downloaded the code from wickedlysmart and chapter 13 still does not run right. I compiles fine but I get the HourGlass and no events are generated when mouse click is performed. I'm using java (build 1.5.0_03-b07) on win xp.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange, I entered the code as presented in HFJ and had no problems getting it to run.

Maybe I did something unconsciously that corrected the problem...?

*goes to review code*

Okay, on review, I see I have the 2nd edition, and the line

does exist. This tells me I'm in a potential pitfall when it comes to reviewing someone else's code: don't presume everyone is working from the same version, be it of a text or of a JDK.

Just my two cents' worth...save up the change for a milk shake or something.
[ June 13, 2005: Message edited by: Alan Jump ]
 
Did you just should on me? You should read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!