Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  4 034

•  TDictionary Custom Sort  6 138

•  Fast Watermark Sources  5 937

•  3D Designer  8 796

•  Sik Screen Capture  6 265

•  Patch Maker  6 688

•  Айболит (remote control)  6 685

•  ListBox Drag & Drop  5 537

•  Доска для игры Реверси  95 751

•  Графические эффекты  6 908

•  Рисование по маске  6 136

•  Перетаскивание изображений  5 068

•  Canvas Drawing  5 442

•  Рисование Луны  5 155

•  Поворот изображения  4 701

•  Рисование стержней  3 314

•  Paint on Shape  2 551

•  Генератор кроссвордов  3 446

•  Головоломка Paletto  2 758

•  Теорема Монжа об окружностях  3 559

•  Пазл Numbrix  2 329

•  Заборы и коммивояжеры  3 019

•  Игра HIP  1 972

•  Игра Go (Го)  1 890

•  Симулятор лифта  2 245

•  Программа укладки плитки  1 955

•  Генератор лабиринта  2 405

•  Проверка числового ввода  2 085

•  HEX View  2 414

•  Физический маятник  2 044

 
скрыть

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Delphi Sources

Контроль звука



Оформил: DeeCo

uses
   MMSystem;

 function GetWaveVolume(var LVol: DWORD; var RVol: DWORD): Boolean;
 var
   WaveOutCaps: TWAVEOUTCAPS;
   Volume: DWORD;
 begin
   Result := False;
   if WaveOutGetDevCaps(WAVE_MAPPER, @WaveOutCaps, SizeOf(WaveOutCaps)) = MMSYSERR_NOERROR then
     if WaveOutCaps.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then
     begin
       Result := WaveOutGetVolume(WAVE_MAPPER, @Volume) = MMSYSERR_NOERROR;
       LVol   := LoWord(Volume);
       RVol   := HiWord(Volume);
     end;
 end;


 { 
  The waveOutGetDevCaps function retrieves the capabilities of 
  a given waveform-audio output device. 

  The waveOutGetVolume function retrieves the current volume level 
  of the specified waveform-audio output device. 
}


 function SetWaveVolume(const AVolume: DWORD): Boolean;
 var
   WaveOutCaps: TWAVEOUTCAPS;
 begin
   Result := False;
   if WaveOutGetDevCaps(WAVE_MAPPER, @WaveOutCaps, SizeOf(WaveOutCaps)) = MMSYSERR_NOERROR then
     if WaveOutCaps.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then
       Result := WaveOutSetVolume(WAVE_MAPPER, AVolume) = MMSYSERR_NOERROR;
 end;

 { 
  AVolume: 
  The low-order word contains the left-channel volume setting, 
  and the high-order word contains the right-channel setting. 
  A value of 65535 represents full volume, and a value of 0000 is silence. 
  If a device does not support both left and right volume control, 
  the low-order word of dwVolume specifies the volume level, 
  and the high-order word is ignored. 
}


 { *** How to Use: ***}

 // SetWaveVolume: 

procedure TForm1.Button1Click(Sender: TObject);
 var
   LVol: Word;
   RVol: Word;
 begin
   LVol := SpinEdit1.Value;  // max. is 65535 
  RVol := SpinEdit2.Value;  // max. is 65535 
  SetWaveVolume(MakeLong(LVol, RVol));
 end;


 // GetWaveVolume: 

procedure TForm1.Button2Click(Sender: TObject);
 var
   LVol: DWORD;
   RVol: DWORD;
 begin
   if GetWaveVolume(LVol, RVol) then
   begin
     SpinEdit1.Value := LVol;
     SpinEdit2.Value := RVol;
   end;
 end;




Похожие по теме исходники

Рисование кривой звука




Copyright © 2004-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте