[ create a new paste ] login | about

Link: http://codepad.org/wkhpSkEz    [ raw code | output | fork ]

C++, pasted on Nov 10:
DWORD getMasterVolume()
{
	HMIXER mixer;

	if (mixerOpen(&mixer, 0, 0, 0, 0) != MMSYSERR_NOERROR) {
		return 0;
	}

	MIXERLINE line = { sizeof(MIXERLINE) };

	line.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;

	if (mixerGetLineInfo(reinterpret_cast<HMIXEROBJ>(mixer), &line, MIXER_GETLINEINFOF_COMPONENTTYPE | MIXER_OBJECTF_HMIXER) != MMSYSERR_NOERROR) {
		return 0;
	}

	MIXERCONTROL      ctrl  = { sizeof(MIXERCONTROL)      };
	MIXERLINECONTROLS ctrls = { sizeof(MIXERLINECONTROLS) };

	ctrls.dwLineID      = line.dwLineID;
	ctrls.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME;
	ctrls.cControls     = 1;
	ctrls.cbmxctrl      = sizeof(MIXERCONTROL);
	ctrls.pamxctrl      = &ctrl;

	if (mixerGetLineControls(reinterpret_cast<HMIXEROBJ>(mixer), &ctrls, MIXER_GETLINECONTROLSF_ONEBYTYPE | MIXER_OBJECTF_HMIXER) != MMSYSERR_NOERROR) {
		return 0;
	}

	MIXERCONTROLDETAILS          details  = { sizeof(MIXERCONTROLDETAILS) };
	MIXERCONTROLDETAILS_UNSIGNED detailsu = { 0 };

	details.dwControlID = ctrl.dwControlID;
	details.cChannels   = line.cChannels;
	details.cbDetails   = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
	details.paDetails   = &detailsu;

	if (mixerGetControlDetails(reinterpret_cast<HMIXEROBJ>(mixer), &details, MIXER_GETCONTROLDETAILSF_VALUE | MIXER_OBJECTF_HMIXER) != MMSYSERR_NOERROR) {
		return 0;
	}

	return detailsu.dwValue;
}


Output:
1
2
Line 1: error: 'DWORD' does not name a type
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: