Hi folks.

I have a java application which plays a audio file . SO before the audio file or sound is played by my java application , i want to mute all other application sounds like Windows media player , VLC player (etc) if those are currently playing at that time.

After my java application completes playing the audio file , i would like to un-mute them again .

I know that java cant perform out-of-box stuff. but still are there any ways to do that?

Thanks

Recommended Answers

All 4 Replies

Hi folks.

I have a java application which plays a audio file . SO before the audio file or sound is played by my java application , i want to mute all other application sounds like Windows media player , VLC player (etc) if those are currently playing at that time.

After my java application completes playing the audio file , i would like to un-mute them again .

I know that java cant perform out-of-box stuff. but still are there any ways to do that?

Thanks

well maybe use JNI? here is code in c# for creating something like the windows volume mixer which will allow specific apps to be controlled:http://www.dreamincode.net/forums/topic/45693-controlling-sound-volume-in-c%23/

Although its in C# it shows what API's to use etc so can be ported to c or c++.

i guess though if you dont want all that create it in c# and make it work on command line that your java app can interact with via input and outputstreams.

but in my honest opinion just check what processes are active and if its any used to play music/sound just bring a message that asks them to exit the program and then you can carry on. because if i'm using vlc and i open something in wmp it doesnt even mute it for me! so doing it in java ? and for what reason if top apps dont even?

Well, i guess, i cant turn to C# and make things complex because i need to learn C# from starting.

I'll try to see what players are mostly used and running in the system and i try to control them via commands from the java app.
Eventhough Asking the users to mute the players manually doesn't looks nice , i'll try any alternative if any.

But i am open to other ideas :)

Well, i guess, i cant turn to C# and make things complex because i need to learn C# from starting.

I'll try to see what players are mostly used and running in the system and i try to control them via commands from the java app.
Eventhough Asking the users to mute the players manually doesn't looks nice , i'll try any alternative if any.

But i am open to other ideas :)

check here:http://docs.oracle.com/javase/1.5.0/docs/guide/sound/programmer_guide/chapter6.html im not sure if this means you can get any line on the PC and mute it or what but worth a read maybe this too:http://www.velocityreviews.com/forums/t389921-java-api-sound.html and maybe here for a little bit of extra info:http://www.java.net/node/649302 and now i found this:http://www.coderanch.com/t/492931/java/java/Adjusting-master-volume-Windows-XP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.