caute.
potreboval by som zistit velkost signalu z mikrofonu, asi je to line in vstup do zvukovej karty. upresnim:
zapichnem do pc mikrofon, nieco do neho kecnem a ja chcem vediet aky je ten signal velky. nepotrebujem vediet ze mi to bude treba vzorkovat napriklad s periodov 50ms, to mam vsetko spravene. ja len uz tyzden hladam a skusam, ako sa dopracovat k tej hodnote. z codeproject som pozrel hadam 20 podobnych programov, ale ani jeden nerobi co potrebujem. napr.:
http://www.codeproject.com/KB/winsdk/SoundRecord.aspx
http://www.codeguru.com/cpp/g-m/multimedia/article.php/c1575/
(mimochodom ten druhy odkaz, tak to ani nefunguje)
trochu sa to podoba, ale vobec to nie je co potrebujem :-). pouzival som nato funkcie mixer s roznymi parametrami, neviem ci sa to sem zmesti, dam tu jednu variantu. pozeral som celu dokumentaciu SDL_mixer, OpenAL, ani tam nic podobne, alebo som mental, preto som uz donuteny sa opytat. dx som pozrel len tak zbezne, pretoze robim s opengl, tak zasadne odmietam dsound, ale ak by mi vedel niekto poradit aj pomocou dx, aj tak budem velmi rad!
bool ZistiHlasitost() {
UINT pocet;
HMIXER hMixer;
MIXERCAPS mCaps;
memset(&mCaps, 0, sizeof(mCaps));
if ((pocet = waveInGetNumDevs()) == 0) {
return false;
}
if (mixerOpen(&hMixer, 0, 0, 0, MIXER_OBJECTF_WAVEIN) != MMSYSERR_NOERROR)
return false;
if (mixerGetDevCaps((UINT)hMixer, &mCaps, sizeof(mCaps)) != MMSYSERR_NOERROR)
return false;
MIXERLINE mxLine;
MIXERCONTROL mxControl;
MIXERLINECONTROLS mxLiCo;
// cast mixer line
mxLine.cbStruct = sizeof(MIXERLINE);
mxLine.dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE;
if (mixerGetLineInfo((HMIXEROBJ)hMixer, &mxLine,
MIXER_GETLINEINFOF_COMPONENTTYPE | MIXER_OBJECTF_MIXER) != MMSYSERR_NOERROR)
return false;
// cast mixer line control
mxLiCo.cbStruct = sizeof(MIXERLINECONTROLS);
mxLiCo.dwLineID = mxLine.dwLineID;
mxLiCo.dwControlType = MIXERCONTROL_CONTROLTYPE_PEAKMETER;
mxLiCo.cControls = 1;
mxLiCo.cbmxctrl = sizeof(MIXERCONTROL);
mxLiCo.pamxctrl = & mxControl;
if (mixerGetLineControls((HMIXEROBJ)hMixer, &mxLiCo,
MIXER_GETLINECONTROLSF_ONEBYTYPE | MIXER_OBJECTF_HMIXER) != MMSYSERR_NOERROR)
return false;
// zbieranie dat
CString nazov = mxControl.szName;
long minHod = mxControl.Bounds.dwMinimum;
long maxHod = mxControl.Bounds.dwMaximum;
MIXERCONTROLDETAILS mxDetail;
MIXERCONTROLDETAILS_SIGNED volMic;
mxDetail.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxDetail.dwControlID = mxControl.dwControlID;
mxDetail.cChannels = mxLine.cChannels;
mxDetail.cMultipleItems = 0;
mxDetail.cbDetails = sizeof(MIXERCONTROLDETAILS_SIGNED);
mxDetail.paDetails = &volMic;
if (mixerGetControlDetails((HMIXEROBJ)hMixer, &mxDetail,
MIXER_GETCONTROLDETAILSF_VALUE | MIXER_OBJECTF_HMIXER) != MMSYSERR_NOERROR)
return false;
nazov.Format(L"nazov: %s\npocet: %d\nmax: %d\nmin: %d\nhodnota: %d",
mxControl.szName, pocet, maxHod, minHod, volMic.lValue);
MessageBox(0, nazov.GetBuffer(), L"mixer", MB_ICONINFORMATION);
mixerClose(hMixer);
return true;
}
v tom kode je viac zbytocnych veci, to som mal na kontrolu ci to vobec pojde, ale bohuzial.
tak keby ma niekto vedel nakopnut spravnym smerom ;-)