🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #377

Re: Retrieve audio volume of TMediaPlayer component

#377
From: Marcelo R. Lopez, Jr.
Date: Fri, 08 Oct 2004 18:44
64 lines
2548 bytes
Mario Sernicola wrote:

>Hi,
>
>To set volume of a TMediaPlayer Component I've used this code:
>
>//----------------------------------------------------------------
>
>MCI_DGV_SETAUDIO_PARMS p;
>      p.dwCallback = 0;
>      p.dwItem = MCI_DGV_SETAUDIO_VOLUME;
>      p.dwValue = volume;
>      p.dwOver = 0;
>      p.lpstrAlgorithm = NULL;
>      p.lpstrQuality = NULL;
>
>mciSendCommand(MediaPLayer1->DeviceID, MCI_SETAUDIO,MCI_DGV_SETAUDIO_VALUE |
>MCI_DGV_SETAUDIO_ITEM, Cardinal(&p));
>
>How can I retrieve te value of a TMediaPlayer component to implement (for
>example) a fade out effect?
>
>Thanks
>
>Mario Sernicola
>
>
>
>  
>
I think what you're looking for is the:   MCI_DGV_STATUS_VOLUME field of 
the MCI_STATUS command.

re ( the MMAPI reference )

Think of something like this:

DWORD dwTheVolume = 0;
MCI_STATUS_PARMS theParms;

theParms.dwCallback = 0;
theParms.dwReturn = MCI_SUCCESS;
theParms.dwItem = MCI_DGV_STATUS_VOLUME;
theParms.dwTrack = 0;

MCIERROR mciRC = mciSendCommand(MediaPLayer1->DeviceID, MCI_STATUS,
                                                             
MCI_STATUS_ITEM, (DWORD) (LPMCI_STATUS_PARMS) &theParms);

if ( mciRC == MCI_SUCCESS )
    dwTheVolume = theParms.dwReturn;  
else {
    // Handle the error.....
}

 From the MMAPI reference:

MCI_DGV_STATUS_VOLUME
The dwReturn member returns the average of the volume to the left and 
right speakers. Use MCI_DGV_STATUS_NOMINAL with this flag to obtain the 
nominal level.


Marcelo
Technical Details
Message-ID: <4166e18c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <413632fe@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10d0fc,2d755ae3c87e9bfd
X-Google-Attributes: gid10d0fc,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 08 Oct 2004 14:44:58 -0400
From: "Marcelo R. Lopez, Jr." <mlopez@voicerite.com>
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.multimedia
Subject: Re: Retrieve audio volume of TMediaPlayer component
References: <413632fe@newsgroups.borland.com>
In-Reply-To: <413632fe@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 66.80.150.32
Message-ID: <4166e18c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1097261452 66.80.150.32 (8 Oct 2004 11:50:52 -0700)
Lines: 64
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail