Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Computer Volume

Tags:

java

volume

I want to make a java program that

  1. Reads a line from a file (ex.File text is : "Hello")
  2. if the Line = "Hello" then
  3. get computer volume if computer volume is > 1 then Volume=volume / 2

I don't know how do the volume part, of this program. I have looked online for the past hour and I can't seem to get an idea on how to do this, or if it is even possible.

I forgot to add (I'm using windows 7)

like image 424
Caleb Guidos Avatar asked Feb 11 '11 02:02

Caleb Guidos


People also ask

How do I adjust the volume on Windows 10?

Here's how: In the search box on the taskbar, type control panel, then select it from the results. Select Hardware and Sound from the Control Panel, and then select Sound. On the Playback tab, select and hold (or right-click) the listing for your audio device, select Set as Default Device, and then select OK.

How do I turn the volume down on my desktop?

In Windows, click the sound icon in the Windows Notification Area of the Taskbar that looks like a speaker. In the small window that appears, drag the volume down to turn down the sound. You can follow the same procedure and drag the slider up to the desired volume level to turn it back up later.


1 Answers

I have written an utility class for controlling volume which is used like that:

Audio.setMasterOutputVolume(0.5f);

Source code is here: https://github.com/Kunagi/ilarkesto/blob/master/src/main/java/ilarkesto/media/Audio.java

You can copy and use the code.

like image 179
Witek Avatar answered Sep 24 '22 20:09

Witek