How can I control system's volume with java?

Hi, I'm trying to make a remote audio control and I need a way to set current volume by code.
After looking at java sound APIs I came up with this:
line = mixer.getLine(lineInfo);
boolean opened = line.isOpen() || line instanceof Clip;
if(!opened){
     System.out.println("Line is not open, trying to open it...");
     line.open();
     opened = true;
if(line.isControlSupported(FloatControl.Type.VOLUME)){
          FloatControl volumeCtrl = (FloatControl)line.getControl(FloatControl.Type.VOLUME);
               System.out.println("Current volume is: "+volumeCtrl.getValue());
}I tried this code with every mixer I have (althought I think it's the "SPEAKER" one...) but I always get 1.0 as current volume, no matter what.
So, I'm getting something wrong..can you help me?:(

Late but just to make it clear, the answer to these kind of questions is the same 999/1000 times. As soon as your question takes this form:
"how do I do SOMETHING in OPERATING SYSTEM using Java",
the answer is:
"You need to write a native library that can do it and call that using JNI or JNA from Java."
Because Java is cross-platform, it cannot do platform-specific stuff like changing the volume or whatever you want to do to control the OS. You need to use the operating system's unique API layer to do it.

Similar Messages

  • How can i control my mini mac with my ipad on diferent wifi networks?

    How can i control my mini mac with my ipad on diferent wifi networks?

    Go to my pc, splashtop, team viewer or any of the several remote desktop apps in the store.

  • I plug my computer into my stereo and use the remote app on my iPhone to control it. How can I control my wires iPad with the remote app on my iphone when it is plugged into the stereo? they are different iTunes accounts.

    I plug my computer into my stereo and use the remote app on my iPhone to control it. How can I control my wires iPad with the remote app on my iphone when it is plugged into the stereo? they are different iTunes accounts.

    I think this is probably a sign that your network could be better than it is.
    Intermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
    You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
    Refer to your router manual for instructions on changing your wifi channel or adjusting your multicast rate.
    There are other types of problems that can affect networks, but this is by far the most common, hence worth mentioning first.

  • How can I compact a MSAccess database with java?

    Hi.
    I have a question (Please Help!!!):
    How can I compact a MSAccess database with java-jdbc? Is it posible?
    Thanks

    MS Access database has a max length limitation of 2.14GB for Access 2000( 1.07G for Access 97), and won't recycle basically space for update/delete sql so tha it's a good idea to use MS Access database for program, which need update/delete frequent ly data. The programmers of HXTT Access(www.hxtt.net) are writing code for CREATE TABLE/DATABASE sql now. If you need a pure Java solution for PACK TABLE/DATABSE urgently in your project, you should send such a requirement to the Support page of www.hxtt.net so that they can schedule complementing such a fucntion. Otherwise, you should pack your databae manually or visit C++ code for Compact an Access Database Programmatically at
    http://www.codeguru.com/Cpp/data/mfc_database/microsoftaccess/article.php/c4327/ , or use Easy Microsoft Access MDB MDE Compactor at http://www.easyhr.com.au/software/easy_mdb_mde_compactor.htm.

  • How can i control the I2C bus with Labview

    Hi
    How can i control the k8000 from http://www.velleman.be ( I2C bus) with
    Labview.
    all info is welcome.
    [email protected]

    if you are using Linux (and the Linux version of LabVIE W) it should be
    fairly easy to use the lm_sensors ( http://www.netroedge.com/~lm78/ )
    libraries and source code to control a device connected to a PC's I2C bus.
    Go here http://www.netroedge.com/~lm78/hardhack.html to see how to tap into
    the I2C bus of your PC. You may be able to apply info here to roll-your-own
    on a MS Windows 98 / 2000 OS.
    Chris
    "Wouters V" wrote in message
    news:39fff2de$0$4493$[email protected]..
    > Hi
    >
    > How can i control the k8000 from http://www.velleman.be ( I2C bus)
    with
    > Labview.
    > all info is welcome.
    >
    > [email protected]
    >
    >
    >
    >
    >

  • How can I control the delay pedal with a MIDI keyboard?

    Okay, I'm looking to perform the song 'Are You In?' by Incubus with some friends, and here's what I want to do...
    I have my guitar plugged into a Behringer UCG102 Guitar Link
    The link is then plugged into my MacBook running GarageBand
    I have an amp preset saved in the program with the 'Blue Echo' delay pedal
    While playing, I want to be able to use my external MIDI USB keyboard (Akai MPK25) to control the 'Time' and 'Repeats' knobs on the virtual pedal.
    Otherwise, i'm gonna have to keep switching between playing guitar and clicking on the screen and then moving the mouse around frantically.
    How can I do this? And is it even possible in GarageBand?
    If not in GarageBand, is it possible to do the same in Logic Pro?
    My Akai keyboard did come with a piece of software to control the keyboard from the computer. It allows me to save different presets and upload them to it. For the knobs on my keyboard, the software has the option to enter numbers next to each knob for 'CC', 'Low' and 'Hi'
    Sorry if i'm not very clear or I don't make much sense, not really sure how to explain everything.

    There are two types of sustain pedal... One's with  + polarity and ones with - polarity
    The sustain pedal you are using, has the oppostie polarity from the standard.. which means when you press it it acts as if it is not pressed and vice versa...
    Unfortunately, unlike a lot of keyboards...  the Launchkey doesn't provide a setting that allows you to correct this issue... which means that unless the pedal you are using has a built in polarity switch...(In which case power down your keyboard, unplug the pedal and select the opposite setting to what is set now and then plug it back in and power up your keyboard) your sustain pedal is the wrong type and is not compatible with the Launchkey....
    Failing that, here is an example of a sustain pedal that has a polarity switch so you can use it with any keyboard....
    http://www.amazon.com/gp/product/B00063678K/ref=oh_aui_search_detailpage?ie=UTF8 &psc=1

  • Can't control external monitor volume with macbook keyboard

    I just picked up a new LG display that I am connected to my haswell rMBP through Thunderbolt. Everything is working great but I can't control the volume of the monitor with the macbook keys, it is all grayed out.
    I have set up an multi-output device in audio midi setup and so I am getting volume from the monitor and the macbook at the same time for great sound, but I would love to be able to control it from the volume keys on my rMBP.
    I have googled and tried soundflower but there doesn't seem to be a current app for Mavericks.
    I can command click on the volume icon and divert back to rMBP to bump volume down, but that is more steps than I need.
    Any help would be appreciated.

    I have the same problem.

  • How can i control a sensor CNY70 with labview?

     i am taking a mechatronics course and they ask me as homework to control a sensor but i don not understando what can i control from this sensor, i expect you could help me

    i would start with working out the system, datasheets on the cny70, work out exactly what is required from the question. spec out the hardware, then start writing out rough ideas. Keep looking back at the question and it will all slowly make sense. I wouldnt dive straight into coding until i understand exactly what i need to be trying to achieve.
    once you understand exactly what you need to achieve and with what hardware you can look into planning the code and taking it from there. If you get stuck with coding feel free to ask for help and post the code you have as most people on here will heppily pass contructive critisism as well as help you through the parts your struggling with  
    Please remember to accept any solutions and give kudos, Thanks
    LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7

  • How can i control my iPad 2 with a interactive projecter?

    we are buying a epson interactinve projecter, and i was wondering if i can control my ipad by just swiping on the projecter screen.
    i know you can control a normal computer by left & right-clicking on the screen, but can you control an iPad?
    BTW, yes the projecter is compatable with. the iPad.

    Assuming it works the same as an interactive whiteboard and Epson has not made an interactive whiteboard app (and I haven't heard of such a thing, I likely would have from a distributor source I have), all you can do is view the iPad through the projector. There is no way that I know of to control it from the projector. I would contact Epson or the source you're ordering the projector from to find out for sure - ask very specifically what you're looking for (i.e. more than being able to view the ipad through the projector).

  • How Can I Get The Cpu State With Java?

    are there any method to use??
    what's more,I also wanna to know how can I get
    the current ram that the System is using
    and the threads the System are running?
    Will you please share your knowledge here or
    write to tell me at [email protected]?
    Thanks!!

    if you know how to do this in c++, you can write native methods and use them in java.
    native methods forum:
    http://forum.java.sun.com/forum.jsp?forum=52
    tobias

  • How can I create a web server with Java?

    I was interested in working on a program that runs through it's own port on the server similar to webmin.. Basically I'd like a light-weight no thrills web-server for the base of my program I can tweak it later. How can I do this?

    -I agree! but you dont have to re-invent the
    wheel.....Sometimes it is fun to...You only say that because you are a (lovely) nerd :)I got promoted from a "geek" to a "nerd" :)
    I agree that it is fun to implement application
    servers etc, but you also have to think about the
    cost (if some one else than you is paying for your
    time)I get lots of "paid" free time occasionally. But I haven't got as far as implementing web servers (or application servers).

  • How can i create a printable format with Java

    Hello....
    First, my english is not good, but this is possibly my last hope!! I have a program with EJB's, JBoos and a MySql database! The program shows the data from the database and you can do something with these data. Now my problem to print this data. I want create a formular which will be print! I've treid ut with docbook and the javax.print library.
    The first problem is: with linux docbook works very fine. I transform the sgml-file in many formats with "db2pdf or db2ps......"
    but the javax.print library don't find any printservice! I've J2EE 1.4.1 where the bug canceld from the earlier version!
    So the next problem is: with windows the javax.print library works fine! I find the printservices and can print *.ps or *.pdf! But i can't transform the sgml-file in Postscipt or PDF!
    I've tried to solve this problem for two weeks now, but without any success.
    Now my Question is: have somebody experiences with this problem and can help me or is there another possibility to solve my problem!!!
    Thanks
    FIPS

    seems to be important!
    k, do this.
    1. ur english is wonderful for a programmer, are u US :)
    2. i will suggest u create an XML file.
    then u can print it and do the hell with it.
    so : java ==> XML ==> what ever u want.
    and if u can also what ever u want ==> XML ==> java.
    this works also fine.

  • How can I pass system commands from a java program? Urgent!

    hi,
    I have been trying this out since a long time. How do I send system commands to command.com or cmd.exe from a java program and an output of the executed command back to the java application.
    If u have any idea, or have any information about the kind os application reply back.
    Thanks
    Deepa Datar

    This is the code which I tried, but it displays only the title of MS-DOS, something like " Microsoft Corp...etc ". But doesn't take any input, and the subprocess(cmd.exe) hangs.
    import java.io.*;
    public class cmddemo2
    public static void main(String arg[])
    try
    System.out.println("cmd");
    Process p=Runtime.getRuntime().exec("cmd.exe");
    DataInputStream din=new DataInputStream(p.getInputStream());
    DataOutputStream dout=new DataOutputStream(p.getOutputStream());
    System.out.println("after streams");
    String s;
    dout.writeChars("type cmddemo2.java");
    while((s=din.readLine())!="\n")
    System.out.println(s);
    dout.writeChars("dir");
    String s1;
    while((s1=din.readLine())!="\n")
    System.out.println(s1);
    System.out.println("over");
    catch(Exception e)
    { System.out.println("Exception : "+e);

  • How can I control the visual affect with Camera class?

    I've checked the document:
    http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/media/Camera.html
    But still don't find info on how to control the visual affect(like lightness, saturation and so on) of my pc camera.
    Is that kind of job possible with actionscript?

    Andrei1 , I'm worried I won't be able to see anything in the dark without setting the camera directly.
    Will BitmapData manipulations manage to brighten the darkness exactly?

  • How can i control the Tektronix AFG3022 with LabView 7.0

    I am trying to control the Tektronix AFG3022 Function Generator with LabView 7.0. Is there a premade program I can download and use?

    If it is not in 7.0 make new thread and ask nice if someone can convert to labview 7.0.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

Maybe you are looking for

  • How can I correct an iCloud ID? I have a valid Apple ID.

    For an iPod 8 touch, how can I change an incorrect iCloud ID?  It has one missing letter. My apple ID is correct.  Since the iCloud email is an incorrect one I cannot put in a password to verify it.  So how do I correct the wrong iCloud ID?

  • How to obtain current location with in a flow

    Hi, This might be very basic level query, but i cant figure it out. I want to extract the location with in a flow. ie in my proxy service i have multiple stages and with in each stage i am using some log actions to print some statements. I can see th

  • Is there any way to share music from my itunes library with a iphone not synced with my mac?

    I use my itunes with my Iphone, But my husband has an iphone also and wants some music from my library to be put on his phone. How can i do this without transfrring his iphone to my itunes and visa versa?

  • Network work connection timed out?????? What?

    I updated my windows, and ever since, I have not been able to get into the Itunes store to buy music. The error says. Network Connection Timed out. Make sure connection settings are correct and your network connection is active. Please help. I have d

  • SHOW ALL in sqlplus

    Hi, http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12041.htm#i2699447 SQL*Plus® User's Guide and Reference Release 11.1 Part Number B31189-01 SHOW ALL Lists the settings of all SHOW options, except ERRORS and SGA, in alphabetical or