Board index » delphi » MCI-calls & notify

MCI-calls & notify

I'm wondering if it is possible to disable (drop) the next notify
callback that the MMSystem has been told to give?

Specifically, I would like to start CD playback with both start- and
endpoints given (an A-B function), and if the user presses Play while
this is going on, forget about the previous command and just continue
playing past the previously given endpoint. I have only been able to
continue playing by catching the notify from the 'play(a to b)' function
and then calling 'play to end' wich results in a break in the music.

Is what I want to do possible?

--

<<<<<<------------->>>>>>>
Eivind Bakkestuen was here
           ***
"I was the second gunman
 on the grassy knoll."

 

Re:MCI-calls & notify


I was wondering if anybody was able to control the WAV sound volume?  I
realize that the volume variable is a combination  of left and right volumes
(lower part is left, and higher part is right I think).  But anyhow, I've
not even got to that point.  I've got an app that only plays WAV files, and
this is an example of how I've tried to control the volume:

uses [...],MMSystem;

procedure TForm1.Button1Click(Sender: TObject);
var UD,Vol: Integer;
begin
  UD := 1; Vol := 0;
  waveoutsetvolume(UD, Vol);
end;

Although I expected this to kill the sound, it had no apparent effect on the
volume.  What is it I'm doing wrong?

I'd greatly appreciate any input.

Thanks in advance,
              Bristen Bourque

Re:MCI-calls & notify


In article <63sr9b$q5...@agate.nbnet.nb.ca>, "Bryce (Bristen Bourque)"

Quote
<br...@NOSPAMeve.info.umoncton.ca> writes:
>procedure TForm1.Button1Click(Sender: TObject);
>var UD,Vol: Integer;
>begin
>  UD := 1; Vol := 0;
>  waveoutsetvolume(UD, Vol);
>end;

>Although I expected this to kill the sound, it had no apparent effect on the
>volume.  What is it I'm doing wrong?

Try casting Vol as a longint (ie WaveOutSetVolume(UD, longint(Vol))) - the
volume setting is a DWORD with the left volume in the low order word and
the right volume in  the high order word.

Below are procedures I wrote for a similar activity on Aux volumes,
together with some error handling, like looking for the next audio device..

Alan Lloyd
alangll...@aol.com

type
  TVolType = (vtLeft, vtRight);
  TVol = array[vtLeft..vtRight] of word;

procedure TForm1.GetVolumes(var DevId : word;
                            var VolLeft, VolRight : word);
{volume is returned as a pointer to a DWord with the most
 significant word for the left channel. The channels are
 extracted by treating the DWord as a two element array and
 accessing the two array elements for the Lt and Rt volumes}
var
  Error : integer;
  MsgResponse : word;
  TempVol : TVol;
begin
  Error := AuxGetVolume(DevId, @TempVol);
  if Error <> 0 then begin
    Timer1.Enabled := false;
    MsgResponse := MessageDlg('Error Reading Volume : ' + IntToStr(Error)
+ chr(13)
                              + 'DevId : ' + IntToStr(DevId) + chr(13)
                              + chr(13)
                              + 'Set Next Device ?',
                              mtError, [mbYes, mbCancel], 0);
    if MsgResponse = mrYes then
      DevId := DevId + 1
    else begin
      DevId := 0;
      PChangeType := Nil;
    end; {else MsgResponse = mrCancel}
    Exit;
  end; {if Error <> 0}
  VolLeft := TempVol[vtLeft];
  VolRight := TempVol[vtRight];
end;

procedure TForm1.SetVolumes(DevId : word;
                            var VolLeft, VolRight : word);
{volume is set by passing a DWord value with the most
 significant word set for the left channel, and the least
 significant word set for the right channel. The channels are
 set by treating the DWord as a two element  array and
 setting the two array elements for the Lt and Rt volumes}
var
  Error : integer;
  TempVol : TVol;
begin
  TempVol[vtLeft] := VolLeft;
  TempVol[vtRight] := VolRight;
  Error := AuxSetVolume(DevId, longint(TempVol));
  if Error <> 0 then
    MessageDlg('Error Setting Volume : ' + IntToStr(Error),
               mtError, [mbOK], 0);
end;

Other Threads