Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.09.18;
Скачать: CL | DM;

Вниз

Как изменить громкость звука?   Найти похожие ветки 

 
Шишкин Илья ©   (2003-07-17 14:27) [0]

Сабж. Какое максимальное значение и минимальное?


 
AlexRush ©   (2003-07-17 15:48) [1]

См. waveOutGetVolume и waveOutSetVolume.

Пример из MSDN:

// Link with mmsystem.lib for 16-bit applications and
// link with winmm.lib for 32-bit applications.

#include <mmsystem.h>
#include <stdlib.h>

void ShowVolume(void); //Prototype the function early in the app

void ShowVolume(void)
{
// This is the function that can be added to the Generic Sample to
// illustrate the use of waveOutGetVolume() and waveOutSetVolume().

char buffer[40];
char printbuf[80];
UINT uRetVal, uNumDevs;
DWORD volume;
long lLeftVol, lRightVol;

WAVEOUTCAPS waveCaps;

// Make sure there is at least one
// wave output device to work with.
if (uNumDevs = waveOutGetNumDevs())
{
itoa((int)uNumDevs, buffer, 10);
wsprintf(printbuf, "Number of devices is %s\n", (LPSTR)buffer);
MessageBox(GetFocus(), printbuf, "NumDevs", MB_OK);
}

// This sample uses a hard-coded 0 as the device ID, but retail
// applications should loop on devices 0 through N-1, where N is the
// number of devices returned by waveOutGetNumDevs().
if (!waveOutGetDevCaps(0,(LPWAVEOUTCAPS)&waveCaps,
sizeof(WAVEOUTCAPS)))

{
// Verify the device supports volume changes
if(waveCaps.dwSupport & WAVECAPS_VOLUME)
{
// The low word is the left volume, the high word is the right.
// Set left channel: 2000h is one-eighth volume (8192 base ten).
// Set right channel: 4000h is quarter volume (16384 base ten).
uRetVal = waveOutSetVolume(0, (DWORD)0x40002000UL);

// Now get and display the volumes.
uRetVal = waveOutGetVolume(0, (LPDWORD)&volume);

lLeftVol = (long)LOWORD(volume);
lRightVol = (long)HIWORD(volume);

ltoa(lLeftVol, buffer, 10);
wsprintf(printbuf, "Left Volume is %s\n", (LPSTR)buffer);
MessageBox(GetFocus(), printbuf, "Left Volume", MB_OK);

ltoa(lRightVol, buffer, 10);
wsprintf(printbuf, "Right Volume is %s\n", (LPSTR)buffer);
MessageBox(GetFocus(), printbuf, "Right Volume", MB_OK);

// The low word is the left volume, the high word is the right.
// Set left channel: 8000h is half volume (32768 base ten).
// Set right channel: 4000h is quarter volume (16384 base ten).
uRetVal = waveOutSetVolume(0, (DWORD)0x40008000UL);

// Now get and display the volumes.
uRetVal = waveOutGetVolume(0, (LPDWORD)&volume);

lLeftVol = (long)LOWORD(volume);
lRightVol = (long)HIWORD(volume);

ltoa(lLeftVol, buffer, 10);
wsprintf(printbuf, "Left Volume is %s\n", (LPSTR)buffer);
MessageBox(GetFocus(), printbuf, "Left Volume", MB_OK);

ltoa(lRightVol, buffer, 10);
wsprintf(printbuf, "Right Volume is %s\n", (LPSTR)buffer);
MessageBox(GetFocus(), printbuf, "Right Volume", MB_OK);

}
}
}



 
AlexRush ©   (2003-07-17 15:49) [2]

И еще топик из MSDN:

How to Use Wave Audio Volume Control APIs
ID: Q139098


 
Clipper Chip   (2003-07-17 15:55) [3]

>Какое максимальное значение и минимальное?
Вообще-то FFFFFFFF и 0 соответственно (если это о чем-то говорит).
>Как изменить громкость звука?
загляни ко мне на сайт www.clippersoft.narod.ru раздел delphi
программа N2 шуточная программка jokeCC в модуле thread.pas
в конце найдешь. Там и получение громкости и ее изменение.
Удачи.


 
Е-Моё имя ©   (2003-07-17 16:00) [4]

вроде 0 - максимальное...



Страницы: 1 вся ветка

Текущий архив: 2003.09.18;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.027 c
1-58768
boets
2003-09-06 09:15
2003.09.18
Russian copy/paste in English Windows 2000


1-58743
alextim
2003-09-06 18:29
2003.09.18
интерфейс как в outlook


3-58572
alex-ran
2003-08-27 11:23
2003.09.18
Построение агрегатной функции SQL для нечисловых знач.


8-58792
Shadowofman
2003-05-19 13:33
2003.09.18
Как повернуть картинку на любой угол?


1-58660
Tornado
2003-09-05 08:16
2003.09.18
Ресурсы в DLL