From 449cc186d5b8117d74ba22d6173497d00939f5f1 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sat, 28 Apr 2012 17:53:17 +0200 Subject: Source files split into modules --- src/old/mixer.txt | 486 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 486 insertions(+) create mode 100644 src/old/mixer.txt (limited to 'src/old/mixer.txt') diff --git a/src/old/mixer.txt b/src/old/mixer.txt new file mode 100644 index 0000000..2009c2a --- /dev/null +++ b/src/old/mixer.txt @@ -0,0 +1,486 @@ +Several people have asked me for the sample code I use to program +the mixer in Windows. Since it's a fairly short sample and there's +clearly some interest, I thought I'd post it directly to the newsgroup. +Here it is ... enjoy! (?) + +Julian + +// Example routine that manipulates the mixer controls for Win32 +// This code is not a stand-alone application ... +// +// It's also not very pretty ... +// +// But then, neither is the API ... +// +// Julian Bunn, 1998, julianb@altavista.net + + +#include +#include + + +MIXERCONTROLDETAILS mixDetailsMic,mixDetailsSpk,mixDetailsLin; +LONG +lMaximumSpk,lMaximumMic,lMaximumLin,lMinimumMic,lMinimumSpk,lMinimumLin; + +int nMixerDevs; +int nMicMixID; + +LPHMIXER hMixer; +UINT IdMixer; + + +/**************************************************************************** + + Function: ProgramInitMixer() + + PURPOSE : Initialises the mixer +*****************************************************************************/ + +LONG WINAPI ProgramInitMixer() +{ + UINT iS,iD,iDC,iC, itype; + UINT volume; + MMRESULT mmres; + MIXERCAPS mixCaps; + MIXERLINE mixLine; + MIXERLINECONTROLS mixControls; + MIXERCONTROL mixClist[50]; + MIXERCONTROLDETAILS mixDetails; + MIXERCONTROLDETAILS_UNSIGNED mixValue; + MIXERCONTROLDETAILS_BOOLEAN mixMute; + MIXERCONTROLDETAILS_BOOLEAN mixBoolean[50]; + MIXERCONTROLDETAILS_LISTTEXT mixList[50]; + BOOL bDoneMike = FALSE; + BOOL bDoneSpkr = FALSE; + UINT LineID = 0; + + if(!bMixerOpened) { +// check first if we have a mixer + if((nMixerDevs = mixerGetNumDevs()) < 1) { + return (Program_ERROR); + } + +// really need to pop up a chooser for which mixer device, in +// cases where there is more than one. +// In the meantime, I select the last one listed + + IdMixer = nMixerDevs-1; + + mmres = mixerOpen((LPHMIXER) &hMixer, IdMixer, (DWORD) 0, (DWORD) +NULL, + MIXER_OBJECTF_MIXER); + if(mmres != MMSYSERR_NOERROR) { + return (Program_ERROR); + } + + bMixerOpened = TRUE; + } + + mmres = mixerGetDevCaps(IdMixer, (LPMIXERCAPS) &mixCaps, +sizeof(MIXERCAPS)); + if(mmres != MMSYSERR_NOERROR) { + return (Program_ERROR); + } +// Set the manufacturer's name for the mixer ... + SetDlgItemText(hWndDialogBox,IDC_MIXERNAME,mixCaps.szPname); + if(nMixerDevs>1) { + DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INFOMESSAGE1), +hWndDialogBox, DialogBoxCallback); + } + + +// Loop over the destination mixer lines + for (iD=0;iD