• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

MIDI Beep, and synchronizarion

 
Bartender
Posts: 11107
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not being satisfied with the Toolkit.getDefaultToolkit().beep() sound I played around with some MIDI code till I got a sound I was happy with. All was well and good until I tried to make it multi-threaded. My app that uses it launches a couple of threads and I play a Beep when they end. It is highly unlikely that any two threads would Beep at the same time but I thought I should take that into consideration so I introduced
into the beep() method. This caused the beep() to no longer work. Can anyone tell me why?
 
Sheriff
Posts: 28413
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it make a difference if you synchronize on a different object? I.e.

 
Carey Brown
Bartender
Posts: 11107
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
YES! How insightful. Is there something I should learn from this when it comes to synchronize ?
 
Carey Brown
Bartender
Posts: 11107
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could it be that the MIDI library was already using that to sync on?
 
Carey Brown
Bartender
Posts: 11107
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the working version.
 
Carey Brown
Bartender
Posts: 11107
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A programmable version. Pick your own instrument and settings.
 
Paul Clapham
Sheriff
Posts: 28413
102
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:Could it be that the MIDI library was already using that to sync on?



That was my (lucky) guess.
 
Saloon Keeper
Posts: 28718
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BEEP!
You have committed a grave offence:

Silently eating Exceptions is a REALLY bad practice. Yes, I know, this is a "safe" case, but at a minimum you should print a "thread interrupted" message or something. If you just swallow Exceptions, they can become Mysteries. Really, really frustrating Mysteries.
 
reply
    Bookmark Topic Watch Topic
  • New Topic