{---------------------------------------------------------------------}
{    Projeto DOSVOX - NCE/UFRJ
{    Interface para controle de volume
{    Autor: José Antonio Borges
{    Em 18/04/99
{---------------------------------------------------------------------}

{$M 16384, 8192}
program tmix;

uses dvcrt, dvwin, dvmacro, dvexec, winprocs, wintypes;

var s: string;
    f: longint;
    i, volume: integer;
    j, minhaJan: hwnd;
    rectg: TRect;
    c: char;

begin
    j := getActiveWindow;
    screenSize.y := 4;
    clrscr;

    sintInic (0, sintAmbiente('HOOKUTIL','DIRHOOKUTIL'));
    write ('Volume de 1 a 5  ');
    if existeArqSom ('TMVOLUME') then
        sintSom ('TMVOLUME');
    c := sintReadkey;
    writeln (c);
    sintFim;

    volume := ord (c) - ord ('0');
    if (volume <= 0) or (volume > 5) then doneWinCrt;

    minhaJan := getActiveWindow;

    calaBoca;
    executaProg ('sndvol32', '.', '');
    repeat keypressed until getActiveWindow <> minhaJan;

    getWindowRect (getActiveWindow, rectg);
    mouseClick (rectg.left + 50, rectg.top + 200);

    playInit (100);
    for i := 1 to 6 do
        playVirtKey (VK_NEXT, false, false, false, 1);
    for i := 1 to volume do
        playVirtKey (VK_PRIOR, false, false, false, 1);
    playAltKey ('O', 1);
    playKey ('r', 1);
    playStart;
    while  playIsActive do;

    setActiveWindow (j);
    doneWinCrt;
end.
