-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix microphone volume level control.
Previously, the "My Voice" control in the options GUI did nothing. The old plWinMicLevel code was originally for the WinMM library from 1991 (!!!). This rewrites all that junk to use the Windows Core Audio library upon which WinMM sits as of Windows Vista. When using OpenAL Soft, the primary backend is WASAPI, a Core Audio component. Further, when adjusting the level in Uru, you can observe the level changing in the Windows mixer as well.
- Loading branch information
Showing
9 changed files
with
506 additions
and
464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,6 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
#include "plSurface/plLayerOr.h" | ||
#include "plAudio/plAudioSystem.h" | ||
#include "plAudio/plVoiceChat.h" | ||
#include "plAudio/plWinMicLevel.h" | ||
#include "plPipeline/plFogEnvironment.h" | ||
#include "plPipeline/plPlates.h" | ||
#include "plPipeline/plDynamicEnvMap.h" | ||
|
@@ -3429,11 +3428,8 @@ PF_CONSOLE_CMD( Audio, IsolateSound, | |
|
||
PF_CONSOLE_CMD( Audio, SetMicVolume, "float volume", "Sets the microphone volume, in the range of 0 to 1" ) | ||
{ | ||
if( !plWinMicLevel::CanSetLevel() ) | ||
PrintString( "Unable to set microphone level" ); | ||
else | ||
{ | ||
plWinMicLevel::SetLevel( (float)params[ 0 ] ); | ||
if (!plgAudioSys::SetCaptureVolume((float)params[0])) { | ||
PrintString("Unable to set microphone level"); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,6 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
|
||
#include "plAudio/plAudioSystem.h" | ||
#include "plAudio/plVoiceChat.h" | ||
#include "plAudio/plWinMicLevel.h" | ||
|
||
// Sets the master volume of a given audio channel | ||
void pyAudioControl::SetSoundFXVolume(float volume) | ||
|
@@ -252,26 +251,19 @@ bool pyAudioControl::IsMuted() const | |
//------------------------ | ||
// Voice Settings | ||
|
||
// Sets the microphone volume, in the range of 0 to 1 | ||
bool pyAudioControl::CanSetMicLevel() const | ||
{ | ||
return plWinMicLevel::CanSetLevel(); | ||
return plgAudioSys::CanChangeCaptureVolume(); | ||
} | ||
|
||
void pyAudioControl::SetMicLevel(float level) | ||
{ | ||
// make sure the volume is within range | ||
if( level > 1.f ) | ||
level = 1.f; | ||
else if( level < 0.f ) | ||
level = 0.f; | ||
if( CanSetMicLevel() ) | ||
plWinMicLevel::SetLevel( level ); | ||
plgAudioSys::SetCaptureVolume(level); | ||
} | ||
|
||
float pyAudioControl::GetMicLevel() const | ||
{ | ||
return plWinMicLevel::GetLevel(); | ||
return plgAudioSys::GetCaptureVolume(); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.