JNI , . , , - , , , , JNI . ++, , :
#include <WinSDKVer.h>
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#include <SDKDDKVer.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <mmdeviceapi.h>
#include <endpointvolume.h>
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
double newVolume = _ttof(lpCmdLine);
CoInitialize(NULL);
IMMDeviceEnumerator* deviceEnumerator = NULL;
if(CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IMMDeviceEnumerator), (LPVOID *)&deviceEnumerator) == S_OK) {
IMMDevice* defaultDevice = NULL;
if(deviceEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &defaultDevice) == S_OK) {
IAudioEndpointVolume* endpointVolume = NULL;
if(defaultDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL, (LPVOID *)&endpointVolume) == S_OK) {
endpointVolume->SetMasterVolumeLevelScalar((float)newVolume, NULL);
endpointVolume->Release();
}
defaultDevice->Release();
}
deviceEnumerator->Release();
}
CoUninitialize();
return 0;
}
, .