WaveIn Volume
-
Hallo,
ich würde gerne das volume level verschiedener vorhandener wave in geräte über die windows api setzen. ( win 2k - xp )
Leider finde ich dort nur waveOutSetVolume, kennt jemand eine möglichkeit ?
-
ich hab es jetzt so probiert.
#include <iostream> #include <windows.h> #include <Mmsystem.h> // Remeber to Link WinMM.lib! // Written by Letters using namespace std; int main() { UINT MDevNum = mixerGetNumDevs(); cout << MDevNum << " Mixer Devices\n"; MIXERCAPS MCapabilities; HMIXER hMixer; for ( UINT i = 0; i < MDevNum; i++ ){ fill( (char*)&MCapabilities, (char*)&MCapabilities + sizeof( MIXERCAPS ), 0 ); if ( mixerGetDevCaps( i, &MCapabilities, sizeof( MIXERCAPS ) ) == MMSYSERR_NOERROR ){ cout << "Information for Dev: " << i << endl; cout << MCapabilities.szPname << endl; if ( mixerOpen( &hMixer, i, 0, 0, MIXER_OBJECTF_WAVEIN ) == MMSYSERR_NOERROR ){ cout << "Device Opened\n"; MIXERLINE ML; fill( (char*)&ML, (char*)&ML + sizeof( MIXERLINE ), 0 ); ML.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN; ML.cbStruct = sizeof( MIXERLINE ); if ( mixerGetLineInfo( (HMIXEROBJ)hMixer, &ML, MIXER_GETLINEINFOF_COMPONENTTYPE ) == MMSYSERR_NOERROR ){ cout << "Recieved Mixer Line\n"; cout << "Has " << ML.cConnections << " Connections\n"; MIXERLINECONTROLS MLC; MIXERCONTROL MC; for ( UINT n = 0; n < ML.cConnections; n++ ){ fill( (char*)&MLC, (char*)&MLC + sizeof( MIXERLINECONTROLS ), 0 ); fill( (char*)&MC, (char*)&MC + sizeof( MIXERCONTROL ), 0 ); cout << "Setting Mixer Line: " << n << endl; MLC.cbStruct = sizeof( MIXERLINECONTROLS ); MLC.dwLineID = ML.dwLineID; MLC.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME; MLC.cControls = 1; MLC.pamxctrl = &MC; MLC.cbmxctrl = sizeof( MIXERCONTROL ); if ( mixerGetLineControls( (HMIXEROBJ)hMixer, &MLC, MIXER_GETLINECONTROLSF_ONEBYTYPE) == MMSYSERR_NOERROR ){ MIXERCONTROLDETAILS MCD; MIXERCONTROLDETAILS_UNSIGNED Volume; fill( (char*)&MCD, (char*)&MCD + sizeof( MIXERCONTROLDETAILS ), 0 ); fill( (char*)&Volume, (char*)&Volume + sizeof( MIXERCONTROLDETAILS_UNSIGNED ), 0 ); MCD.dwControlID = MLC.dwControlID; MCD.cbStruct = sizeof( MIXERCONTROLDETAILS ); MCD.cMultipleItems = 0; MCD.cbDetails = sizeof( MIXERCONTROLDETAILS_UNSIGNED ); MCD.paDetails = &Volume; MCD.cChannels = 1; Volume.dwValue = 32000; //if ( mixerSetControlDetails( (HMIXEROBJ)hMixer, &MCD, MIXER_SETCONTROLDETAILSF_VALUE ) == MMSYSERR_NOERROR ) int Ret = mixerSetControlDetails( (HMIXEROBJ)hMixer, &MCD, MIXER_SETCONTROLDETAILSF_VALUE ); if ( Ret == MMSYSERR_NOERROR ) cout << "\tVolume successfuly set\n"; else cout << "\tCouldn't set volume Error: 0x" << hex << Ret << endl; }else cout << "\tCouldn't retrieve one by type\n"; } }else cout << "\tCouldn't recieve Mixer Line\n"; mixerClose( hMixer ); }else cout << "\tCouldn't open Mixer\n"; }else cout << "\tCouldn't retrieve Mixer capabilities\n"; } return 0; }leider endet das mit einem "Couldn't set volume" und dem error code 401h