|
|
@ -51,11 +51,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
|
|
// //
|
|
|
|
// //
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "hsTypes.h" |
|
|
|
#include "hsTypes.h" |
|
|
|
#include "plWinMicLevel.h" |
|
|
|
#include "plWinMicLevel.h" |
|
|
|
#include "hsWindows.h" |
|
|
|
#include "hsWindows.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
#include <mmsystem.h> |
|
|
|
#include <mmsystem.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -81,7 +82,7 @@ MIXERLINE *IGetLineByType( DWORD type ); |
|
|
|
MIXERLINE *IGetLineByID( DWORD id ); |
|
|
|
MIXERLINE *IGetLineByID( DWORD id ); |
|
|
|
MIXERCONTROL *IGetControlByType( MIXERLINE *line, DWORD type ); |
|
|
|
MIXERCONTROL *IGetControlByType( MIXERLINE *line, DWORD type ); |
|
|
|
MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type ); |
|
|
|
MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type ); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
//// The Publics /////////////////////////////////////////////////////////////
|
|
|
|
//// The Publics /////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
@ -90,11 +91,15 @@ hsScalar plWinMicLevel::GetLevel( void ) |
|
|
|
if( !CanSetLevel() ) |
|
|
|
if( !CanSetLevel() ) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
DWORD rawValue; |
|
|
|
DWORD rawValue; |
|
|
|
if( !IGetControlValue( rawValue ) )
|
|
|
|
if( !IGetControlValue( rawValue ) )
|
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
return (hsScalar)( rawValue - sMinValue ) / (hsScalar)( sMaxValue - sMinValue ); |
|
|
|
return (hsScalar)( rawValue - sMinValue ) / (hsScalar)( sMaxValue - sMinValue ); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plWinMicLevel::SetLevel( hsScalar level ) |
|
|
|
void plWinMicLevel::SetLevel( hsScalar level ) |
|
|
@ -102,9 +107,11 @@ void plWinMicLevel::SetLevel( hsScalar level ) |
|
|
|
if( !CanSetLevel() ) |
|
|
|
if( !CanSetLevel() ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
DWORD rawValue = (DWORD)(( level * ( sMaxValue - sMinValue ) ) + sMinValue); |
|
|
|
DWORD rawValue = (DWORD)(( level * ( sMaxValue - sMinValue ) ) + sMinValue); |
|
|
|
|
|
|
|
|
|
|
|
ISetControlValue( rawValue ); |
|
|
|
ISetControlValue( rawValue ); |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hsBool plWinMicLevel::CanSetLevel( void ) |
|
|
|
hsBool plWinMicLevel::CanSetLevel( void ) |
|
|
@ -112,7 +119,11 @@ hsBool plWinMicLevel::CanSetLevel( void ) |
|
|
|
// Just to init
|
|
|
|
// Just to init
|
|
|
|
plWinMicLevel &instance = IGetInstance(); |
|
|
|
plWinMicLevel &instance = IGetInstance(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
return ( sMixerHandle != nil ) ? true : false; |
|
|
|
return ( sMixerHandle != nil ) ? true : false; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -126,6 +137,7 @@ plWinMicLevel &plWinMicLevel::IGetInstance( void ) |
|
|
|
|
|
|
|
|
|
|
|
plWinMicLevel::plWinMicLevel() |
|
|
|
plWinMicLevel::plWinMicLevel() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
sMixerHandle = nil; |
|
|
|
sMixerHandle = nil; |
|
|
|
memset( &sMixerCaps, 0, sizeof( sMixerCaps ) ); |
|
|
|
memset( &sMixerCaps, 0, sizeof( sMixerCaps ) ); |
|
|
|
|
|
|
|
|
|
|
@ -159,6 +171,7 @@ plWinMicLevel::plWinMicLevel() |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
plWinMicLevel::~plWinMicLevel() |
|
|
|
plWinMicLevel::~plWinMicLevel() |
|
|
@ -168,12 +181,15 @@ plWinMicLevel::~plWinMicLevel() |
|
|
|
|
|
|
|
|
|
|
|
void plWinMicLevel::IShutdown( void ) |
|
|
|
void plWinMicLevel::IShutdown( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
if( sMixerHandle != nil ) |
|
|
|
if( sMixerHandle != nil ) |
|
|
|
::mixerClose( sMixerHandle ); |
|
|
|
::mixerClose( sMixerHandle ); |
|
|
|
|
|
|
|
|
|
|
|
sMixerHandle = nil; |
|
|
|
sMixerHandle = nil; |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
//// IGetMuxMicVolumeControl /////////////////////////////////////////////////
|
|
|
|
//// IGetMuxMicVolumeControl /////////////////////////////////////////////////
|
|
|
|
// Tries to get the volume control of the microphone subline of the MUX or
|
|
|
|
// Tries to get the volume control of the microphone subline of the MUX or
|
|
|
|
// mixer control of the WaveIn destination line of the audio system (whew!)
|
|
|
|
// mixer control of the WaveIn destination line of the audio system (whew!)
|
|
|
|