MPlayer
所属分类:视频捕捉采集剪辑
开发工具:Visual C++
文件大小:2223KB
下载次数:2
上传日期:2013-12-05 09:20:01
上 传 者:
sweetyi
说明: 这是一个基于mci的音乐视频播放软件,有前进,后退,下一首,添加等功能。界面简洁,适用于初学者
(This is a music video player software mci with forward, backward, Next, add other functions. Interface is simple and suitable for beginners)
文件列表:
MPlayer\AlexfMixer.cpp (5349, 2010-11-20)
MPlayer\AlexfMixer.h (3801, 2010-11-20)
MPlayer\AlexfVolume doc.txt (1956, 2010-11-20)
MPlayer\BtnST.cpp (59344, 2010-11-20)
MPlayer\BtnST.h (9852, 2010-11-20)
MPlayer\ClassMembers-MatrixStatic.txt (11660, 2010-11-20)
MPlayer\Debug\BtnST.obj (83780, 2013-11-28)
MPlayer\Debug\MatrixStatic.obj (34368, 2013-11-28)
MPlayer\Debug\Media.obj (27367, 2013-11-28)
MPlayer\Debug\MPlayer.exe (434273, 2013-11-28)
MPlayer\Debug\MPlayer.ilk (457192, 2013-11-28)
MPlayer\Debug\MPlayer.obj (13318, 2013-11-28)
MPlayer\Debug\MPlayer.pch (6005776, 2013-11-28)
MPlayer\Debug\MPlayer.pdb (443392, 2013-11-28)
MPlayer\Debug\MPlayer.res (225872, 2013-11-28)
MPlayer\Debug\MPlayerDlg.obj (77981, 2013-11-28)
MPlayer\Debug\MySliderControl.obj (19046, 2013-11-28)
MPlayer\Debug\StdAfx.obj (118980, 2013-11-28)
MPlayer\Debug\vc60.idb (222208, 2013-11-28)
MPlayer\Debug\vc60.pdb (389120, 2013-11-28)
MPlayer\IVolume.h (796, 2010-11-20)
MPlayer\MatrixStatic.cpp (11478, 2010-11-20)
MPlayer\MatrixStatic.h (5149, 2010-11-20)
MPlayer\Media.cpp (8790, 2010-11-20)
MPlayer\Media.h (1820, 2010-11-20)
MPlayer\MPlayer.aps (246144, 2013-11-28)
MPlayer\MPlayer.clw (2869, 2013-11-28)
MPlayer\MPlayer.cpp (2113, 2010-11-20)
MPlayer\MPlayer.dsp (5127, 2010-11-20)
MPlayer\MPlayer.dsw (537, 2010-11-20)
MPlayer\MPlayer.h (1335, 2010-11-20)
MPlayer\MPlayer.mdr (197, 2013-11-28)
MPlayer\MPlayer.ncb (115712, 2013-11-28)
MPlayer\MPlayer.opt (55808, 2013-11-28)
MPlayer\MPlayer.plg (2357, 2013-11-28)
MPlayer\MPlayer.rc (7802, 2010-11-20)
MPlayer\MPlayerDlg.cpp (18805, 2010-11-20)
MPlayer\MPlayerDlg.h (3548, 2010-11-20)
MPlayer\MySliderControl.cpp (7690, 2010-11-20)
MPlayer\MySliderControl.h (4220, 2010-11-20)
... ...
Many times my applications required audio volume manipulation.
To make the volume-enabled application development easier I decided to
create a few C++ classes that would allow me to easily regulate and track
the changes of such volume controls as Output Master Volume, WaveOut Volume and
Input (WaveIn) Volume.
Here I provide such classes that share a common interface (defined in IVolume.h):
bool IsAvailable() - Says whether the volume controling is possible
void Enable() - Enables the line of the volume control
void Disable() - Disables the line of the volume control
DWORD GetVolumeMetric() - Retrieves the granularity of volume
DWORD GetMinimalVolume() - Retrieves the minimal volume that can be set
DWORD GetMaximalVolume() - Retrieves the maximal volume that can be set
DWORD GetCurrentVolume() - Retrieve the current volume
void SetCurrentVolume( DWORD dwValue ) - Set the volume
And the last function allows to register a user-implemented callback that
will be called as a notification of volume changes:
void RegisterNotificationSink( PONMICVOULUMECHANGE, DWORD )
This interface is implemented by CVolumeOutMaster (VolumeOutMaster.h/cpp),
CVolumeOutWave (VolumeOutWave.h/cpp) and CVolumeInXXX (VolumeInXXX.h/cpp) classes.
The usage of the classes is very simple:
In your StdAfx.h include "mmSystem.h" and make sure you link to the "winmm.lib"
( #pragma comment(lib, "winmm.lib") ).
Then, if you are going to use Output Mater volume control, include "VolumeOutMaster.h",
say, to the StdAfx.h
The IVolume.h, VolumeInXXX.h, VolumeInXXX.cpp are to be inserted as your project files.
...
void CALLBACK MasterVolumeChanged( DWORD dwCurrentVolume, DWORD dwUserValue );
...
// Volume control Initialization
IVolume* pMasterVolume = (IVolume*)new CVolumeOutMaster();
if ( !pMasterVolume || !pMasterVolume->IsAvailable() )
{
// handle error
}
pMasterVolume->Enable();
pMasterVolume->RegisterNotificationSink( MasterVolumeChanged, dwAnyUserValue );
...
pMasterVolume->SetCurrentVolume( dwVolumeToSet );
...
DWORD dwCurrentVolume = pMasterVolume->SetCurrentVolume();
...
void CALLBACK MasterVolumeChanged( DWORD dwCurrentVolume, DWORD dwUserValue )
{
// handle the volume change
}
...
Very simple, isn't it?
Yet, the CVolumeInXXX class requires more explanation. In order to manipulate
the Input volume, the source line index is to be passed to the constructor.
Confused? Please, be not. CVolumeInXXX class provides a static function to
enumerate those lines:
bool EnumerateInputLines( PINPUTLINEPROC, DWORD dwUserValue );
This allows you to manipulate the volume of any WaveIn-based lines.
Say, you want to manipulate the microphone volume:
...
bool CALLBACK EnumInputLineProc( UINT uLineIndex, MIXERLINE* pLineInfo, DWORD dwUserValue );
...
// Initialization
UINT uMicrophoneLineIndex = (UINT)-1;
if ( !CVolumeInXXX::EnumerateInputLines( EnumInputLineProc, (DWORD)&uMicrophoneLineIndex ) )
{
// handle error
}
if ( uMicrophoneLineIndex == (UINT)-1 )
{
// Error: mic volume'ing is not available.
}
IVolume* pMicrophoneVolume = (IVolume*)new CVolumeInXXX( uMicrophoneLineIndex );
if ( !pMicrophoneVolume || !pMicrophoneVolume->IsAvailable() )
{
// handle error
}
// Go on and use pMicrophoneVolume to manipulate the volume
...
bool CALLBACK EnumInputLineProc( UINT uLineIndex, MIXERLINE* pLineInfo, DWORD dwUserValue )
{
if ( pLineInfo->dwComponentType == MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE )
{
*((UINT*)dwUserValue) = uLineIndex;
return false;
}
return true;
}
...
Be aware, that for performance reasons it is better to have a single instance
of a given class per application. So don't rush to create lots of CVolumeInXXX
objects, better share the only one through your code.
Conclusion:
The proposed classes do not encapsulate all the abilities exposed by the mixers.
However, working with a mixer just to add a pretty simple functionality is quite boring.
That's why, as I think, the proposed classes might be of some help to you.
近期下载者:
相关文件:
收藏者: