kyleneideck / BackgroundMusic

Background Music, a macOS audio utility: automatically pause your music, set individual apps' volumes and record system audio.
GNU General Public License v2.0
16.27k stars 676 forks source link

Not working with Java applications #651

Open caelansimms opened 1 year ago

caelansimms commented 1 year ago

I have a game that runs off Java and when I open it up, BGM does not recognize the application.

I attempt to turn on BGM after closing while the Java app is running and it will crash - attempted it multiple times, no change.

magicus commented 1 year ago

I have the same problem, when trying to modify the sound of Minecraft (which is run using Java). I get this output when running the program from the command line:

2023-04-05 16:31:53.357 Background Music[44412:5805506] BGMApp version: 0.4.0, BGMApp build number: 1.0.0
2023-04-05 16:32:23.172 Background Music[44412:5805506] Uncaught CAException. Error code: 'iote' (1768911973).
libc++abi: terminating with uncaught exception of type CAException
Abort trap: 6
magicus commented 1 year ago

To clarify the original poster: BGM does not detect that the Java application has started. In contrast to other apps, it does not appear on the list when it is started. It does not even appear on the "More Apps" list, which I assume is all processes without an open Window.

However, it does detect the Java app if it is already running when BGM is started. But then it crashes if you try to either change the volume or fading for Java.

I tried to look through the code a bit, but did not find anything obviously wrong, nor any references to iote, either in the code or on the web. My gut feeling is that Java is somehow not behaving like a proper macOS app. This leads to BGM to fail to recognize the app when it is starting, but it might also lead BGM to assume e.g. some app information to be available, when it is not.

I am not really that familiar with C++ (am more of a Java guy), but if it were possible to e.g. output the stack trace when you see an uncaught exception, it might help debugging.