PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Control system volume?

Hello,

does anybody know how to control the system volume?
(changing the waveOut volume doesn't seem to work)

Regards
I got this code a while back (from here I think). It works on the PDA's I've tried, but it does have one small problem... When I get the initial system volume and it is muted, when I restore the volume on exit it sets it to 0% - but doesn't re-mute it. There must be some other trick to sensing and setting the mute.

Code:

void setVolume(DWORD dwVolume)
{
WAVEFORMATEX wf;
wf.wFormatTag = WAVE_FORMAT_PCM;
wf.nChannels = 1;
wf.nSamplesPerSec = 8000;
wf.wBitsPerSample = 8;
wf.nBlockAlign = wf.nChannels * wf.wBitsPerSample / 8;
wf.nAvgBytesPerSec = wf.nSamplesPerSec * wf.nBlockAlign;
wf.cbSize = 0;

HWAVEOUT hwo;
UINT devs = waveOutGetNumDevs();
for (UINT id = 0; id < devs; id++) {
MMRESULT mmr = waveOutOpen(&hwo, id, &wf, 0, 0, CALLBACK_NULL);

hwo=0;
if (mmr == MMSYSERR_NOERROR) {
waveOutSetVolume(hwo, dwVolume);
waveOutClose(hwo);
break;
}
}
}

void GetVolume(LPDWORD dwVolume)
{
WAVEFORMATEX wf;
wf.wFormatTag = WAVE_FORMAT_PCM;
wf.nChannels = 1;
wf.nSamplesPerSec = 8000;
wf.wBitsPerSample = 8;
wf.nBlockAlign = wf.nChannels * wf.wBitsPerSample / 8;
wf.nAvgBytesPerSec = wf.nSamplesPerSec * wf.nBlockAlign;
wf.cbSize = 0;

HWAVEOUT hwo;
UINT devs = waveOutGetNumDevs();
for (UINT id = 0; id < devs; id++) {
MMRESULT mmr = waveOutOpen(&hwo, id, &wf, 0, 0, CALLBACK_NULL);

//hwo=0;
if (mmr == MMSYSERR_NOERROR) {
waveOutGetVolume(hwo, dwVolume);
waveOutClose(hwo);
break;
}
}
}