Java的声音API来访问系统/主音量控制在Vista和Win 7的 [英] Java Sound API to access the system/master volume control in Vista and Win 7

查看:507
本文介绍了Java的声音API来访问系统/主音量控制在Vista和Win 7的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

历史和放大器;现状:

我目前正在更新这是为客户在几年前开发的Java应用程序(将在WinXP运行),用于测试和培训的人具有一定的听力障碍。谁买了这个应用程序的用户提供了与特定的USB音频设备和耳机。

I'm currently working on updating a Java application that was developed for a client several years ago (to run on WinXP) and is used for testing and training people with certain hearing impairments. Users who bought this application were provided with a particular USB sound device and headphones.

之一此软件的最重要的要求是,所述音频必须起到在特定分贝的声级的用户。使用Java声音的API,应用程序的开发是为了动态地调整Windows卷到计算数量(基于校准的USB声音设备与放大器时进行的测量;在开发过程中的耳机)。

One of the most important requirements for this software is that the audio must be played to the user at specific decibel sound levels. Using the Java Sound API, the application was developed to dynamically adjust the Windows Volume to calculated levels (based on measurements made when calibrating the USB sound device & headphones during development).

问题:

现在,应用程序需要升级到支持Windows Vista和Windows 7,但是由于Windows的每个新的应用架构的声音,我一直无法找到任何方式来访问使用Java声音的主/系统卷API。

The application now needs to be upgraded to support Windows Vista and Windows 7, however due to Windows' new per-app sound architecture, I've been unable to find any way to access the Master/System volume using the Java Sound API.

单独的应用程序的窗口音量控制不削减它,因为它是相对于系统卷,有没有办法可以保证用户将听到的音频输出在特定的,已知的水平。

The application's windows volume control alone doesn't cut it since it's relative to the system volume and there's no way to guarantee that the user will hear the output audio at a specific, known level.

是否有人知道,甚至有可能做到这一点在Java中,如果这样的话怎么办?如果这是不可能的,那么您能不能给上什么可能是实现这一目标的最简单方法的任何指导? (JNI和C也许 - 虽然我以前从未使用JNI ......任何陷阱要注意的)

Does anybody know if it is even possible to do this in Java and if so then how? If it's not possible, then can you give any guidance on what might be the simplest way to achieve it? (JNI and C perhaps - though I've never used JNI before... any gotchas to be aware of?)

推荐答案

如果您在Windows XP兼容模式下运行你的应用程序,它应该工作(这取决于Java声音API如何与硬件音量交互)。

If you run your application in Windows XP compatibility mode, it should work (it depends on how the Java Sound API interacts with the hardware volume).

如果你想使用Vista的(外)声音API,你想看看IAudioEndpointVolume API。

If you want to use the Vista (and beyond) sound APIs, you want to look at the IAudioEndpointVolume API.

这篇关于Java的声音API来访问系统/主音量控制在Vista和Win 7的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆