Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Carbon Component warning on runtime - OS X

Tags:

java

audio

I recently learnt how to add sound into a small snake game i am creating. The sound plays when the snake eats the apple. The problem i have is every time the snake eats an apple i get this warning in the cosole (but the program continues to run):

015-10-13 10:00:16.922 java[39731:970632] 10:00:16.922 WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.

What does this mean, and what would i need to do to fix this error?

Here is my method to play the sound:

 private static void playSound(File Sound){

    try{
        Clip clip = AudioSystem.getClip();
        clip.open(AudioSystem.getAudioInputStream(Sound));
        clip.start();

        Thread.sleep(clip.getMicrosecondLength()/1000);

    }catch(Exception e){

    }

}
like image 528
Volken Avatar asked Sep 26 '22 12:09

Volken


1 Answers

TL;DR:

This is a console warning intended for the developers in charge of your sound handler, which in this case looks like AudioSystem. Your program should work, but it'll keep throwing these warnings. Are you using an older version of Java? That might explain the issue.

Longform:

I came across this question because I got the same warning (with a different time and process stamp) working with SimpleCV in Python. I did a little digging and I think I can at least elaborate on the issue, if not solve it.

First, this is an Apple-specific issue. The warning we're seeing is actually a console log note, which you can see if you open up your Console and look for the timestamp. The Carbon Component Manager is a deprecated way that Macs handles sound, and is being phased out for a newer way that uses AudioComponent.h. It looks like AudioSystem is still going about its business the older way. This note is a signal to the developers that they need to update AudioSystem to interface with the new API. It's possible this has already been resolved in newer Java versions. Your program should work fine if you just ignore it, but you could try using a newer Java version to see if that helps.

I'd recommend editing your question to include your system specs and Java version.

More info on Carbon Core Deprecation:

https://developer.apple.com/library/mac/releasenotes/General/CarbonCoreDeprecations/

In case anyone else runs into this from SimpleCV/Python, and for completeness:

I'm running OSX El Capitan on a Macbook Pro (Late 2011), using Python 3.5 and SimpleCV 1.3. My console warning (I'm guessing) stems from the shutter sound that is played when Camera() is used to take a picture in SimpleCV.

like image 128
Cody Schindler Avatar answered Sep 30 '22 07:09

Cody Schindler