Fix Audio and Capture setting retention

Had problems storing ChangeAudioDevice and
SetAudioVolume settings (and the Capture Device
versions) so had to slightly change the way the
settings were stored.
This commit is contained in:
Terry MacDonald 2020-12-12 21:29:38 +13:00
parent f55e2c29be
commit 05bb163312
4 changed files with 1177 additions and 277 deletions

View File

@ -85,8 +85,13 @@ namespace DisplayMagician
private bool _changeAudioDevice; private bool _changeAudioDevice;
private bool _setAudioVolume = false; private bool _setAudioVolume = false;
private decimal _audioVolume = -1; private decimal _audioVolume = -1;
private string _captureDevice;
private bool _changeCaptureDevice;
private bool _setCaptureVolume = false;
private decimal _captureVolume = -1;
private ShortcutPermanence _displayPermanence = ShortcutPermanence.Temporary; private ShortcutPermanence _displayPermanence = ShortcutPermanence.Temporary;
private ShortcutPermanence _audioPermanence = ShortcutPermanence.Temporary; private ShortcutPermanence _audioPermanence = ShortcutPermanence.Temporary;
private ShortcutPermanence _capturePermanence = ShortcutPermanence.Temporary;
private bool _autoName = true; private bool _autoName = true;
private bool _isPossible; private bool _isPossible;
private List<StartProgram> _startPrograms; private List<StartProgram> _startPrograms;
@ -119,9 +124,16 @@ namespace DisplayMagician
ProfileItem profile, ProfileItem profile,
ShortcutPermanence displayPermanence, ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence, ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath, string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "", string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1, decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null, List<StartProgram> startPrograms = null,
bool autoName = true, bool autoName = true,
string uuid = "" string uuid = ""
@ -132,18 +144,17 @@ namespace DisplayMagician
_name = name; _name = name;
_category = ShortcutCategory.NoGame; _category = ShortcutCategory.NoGame;
_profileToUse = profile; _profileToUse = profile;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -162,29 +173,42 @@ namespace DisplayMagician
} }
public ShortcutItem(string name, string profileUuid, ShortcutPermanence displayPermanence, public ShortcutItem(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, string profileUuid,
bool autoName = true, string uuid = "") : this() ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = ""
) : this()
{ {
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
_uuid = uuid; _uuid = uuid;
_name = name; _name = name;
_profileUuid = profileUuid; _profileUuid = profileUuid;
_category = ShortcutCategory.NoGame; _category = ShortcutCategory.NoGame;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -227,9 +251,16 @@ namespace DisplayMagician
bool gameArgumentsRequired, bool gameArgumentsRequired,
ShortcutPermanence displayPermanence, ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence, ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath, string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "", string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1, decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null, List<StartProgram> startPrograms = null,
bool autoName = true, bool autoName = true,
string uuid = "" string uuid = ""
@ -246,19 +277,17 @@ namespace DisplayMagician
_startTimeout = gameTimeout; _startTimeout = gameTimeout;
_gameArguments = gameArguments; _gameArguments = gameArguments;
_gameArgumentsRequired = gameArgumentsRequired; _gameArgumentsRequired = gameArgumentsRequired;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -277,10 +306,26 @@ namespace DisplayMagician
} }
public ShortcutItem(string name, ProfileItem profile, GameStruct game, ShortcutPermanence displayPermanence, public ShortcutItem(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, ProfileItem profile,
bool autoName = true, string uuid = "") : this() GameStruct game,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = ""
) : this()
{ {
// Create a new UUID for the shortcut if one wasn't created already // Create a new UUID for the shortcut if one wasn't created already
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
@ -294,18 +339,17 @@ namespace DisplayMagician
_startTimeout = game.StartTimeout; _startTimeout = game.StartTimeout;
_gameArguments = game.GameArguments; _gameArguments = game.GameArguments;
_gameArgumentsRequired = game.GameArgumentsRequired; _gameArgumentsRequired = game.GameArgumentsRequired;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -324,10 +368,26 @@ namespace DisplayMagician
public ShortcutItem(string name, string profileUuid, GameStruct game, ShortcutPermanence displayPermanence, public ShortcutItem(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, string profileUuid,
bool autoName = true, string uuid = "") : this() GameStruct game,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = ""
) : this()
{ {
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
_uuid = uuid; _uuid = uuid;
@ -341,18 +401,17 @@ namespace DisplayMagician
_gameArguments = game.GameArguments; _gameArguments = game.GameArguments;
_gameArgumentsRequired = game.GameArgumentsRequired; _gameArgumentsRequired = game.GameArgumentsRequired;
_gameArgumentsRequired = false; _gameArgumentsRequired = false;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -393,9 +452,16 @@ namespace DisplayMagician
bool processNameToMonitorUsesExecutable, bool processNameToMonitorUsesExecutable,
ShortcutPermanence displayPermanence, ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence, ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath, string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "", string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1, decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null, List<StartProgram> startPrograms = null,
bool autoName = true, bool autoName = true,
string uuid = "" string uuid = ""
@ -412,18 +478,17 @@ namespace DisplayMagician
_executableArguments = executableArguments; _executableArguments = executableArguments;
_executableArgumentsRequired = executableArgumentsRequired; _executableArgumentsRequired = executableArgumentsRequired;
_processNameToMonitorUsesExecutable = processNameToMonitorUsesExecutable; _processNameToMonitorUsesExecutable = processNameToMonitorUsesExecutable;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -442,10 +507,26 @@ namespace DisplayMagician
} }
public ShortcutItem(string name, ProfileItem profile, Executable executable, ShortcutPermanence displayPermanence, public ShortcutItem(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, ProfileItem profile,
bool autoName = true, string uuid = "") : this() Executable executable,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = ""
) : this()
{ {
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
_uuid = uuid; _uuid = uuid;
@ -458,18 +539,17 @@ namespace DisplayMagician
_executableArguments = executable.ExecutableArguments; _executableArguments = executable.ExecutableArguments;
_executableArgumentsRequired = executable.ExecutableArgumentsRequired; _executableArgumentsRequired = executable.ExecutableArgumentsRequired;
_processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable; _processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -487,10 +567,26 @@ namespace DisplayMagician
_shortcutBitmap = ToBitmapOverlay(_originalLargeBitmap, _profileToUse.ProfileTightestBitmap, 256, 256); _shortcutBitmap = ToBitmapOverlay(_originalLargeBitmap, _profileToUse.ProfileTightestBitmap, 256, 256);
} }
public ShortcutItem(string name, string profileUuid, Executable executable, ShortcutPermanence displayPermanence, public ShortcutItem(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, string profileUuid,
bool autoName = true, string uuid = "") : this() Executable executable,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = ""
) : this()
{ {
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
_uuid = uuid; _uuid = uuid;
@ -503,18 +599,17 @@ namespace DisplayMagician
_executableArguments = executable.ExecutableArguments; _executableArguments = executable.ExecutableArguments;
_executableArgumentsRequired = executable.ExecutableArgumentsRequired; _executableArgumentsRequired = executable.ExecutableArgumentsRequired;
_processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable; _processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -666,6 +761,19 @@ namespace DisplayMagician
} }
} }
public ShortcutPermanence CapturePermanence
{
get
{
return _capturePermanence;
}
set
{
_capturePermanence = value;
}
}
public ShortcutCategory Category public ShortcutCategory Category
{ {
get get
@ -880,6 +988,58 @@ namespace DisplayMagician
} }
} }
public string CaptureDevice
{
get
{
return _captureDevice;
}
set
{
_captureDevice = value;
}
}
public bool ChangeCaptureDevice
{
get
{
return _changeCaptureDevice;
}
set
{
_changeCaptureDevice = value;
}
}
public decimal CaptureVolume
{
get
{
return _captureVolume;
}
set
{
_captureVolume = value;
}
}
public bool SetCaptureVolume
{
get
{
return _setCaptureVolume;
}
set
{
_setCaptureVolume = value;
}
}
public List<StartProgram> StartPrograms public List<StartProgram> StartPrograms
{ {
get get
@ -971,9 +1131,16 @@ namespace DisplayMagician
ProfileItem profile, ProfileItem profile,
ShortcutPermanence displayPermanence, ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence, ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath, string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "", string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1, decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null, List<StartProgram> startPrograms = null,
bool autoName = true, bool autoName = true,
string uuid = "" string uuid = ""
@ -984,19 +1151,17 @@ namespace DisplayMagician
_name = name; _name = name;
_category = ShortcutCategory.NoGame; _category = ShortcutCategory.NoGame;
_profileToUse = profile; _profileToUse = profile;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -1016,29 +1181,42 @@ namespace DisplayMagician
ReplaceShortcutIconInCache(); ReplaceShortcutIconInCache();
} }
public void UpdateNoGameShortcut(string name, string profileUuid, ShortcutPermanence displayPermanence, public void UpdateNoGameShortcut(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, string profileUuid,
bool autoName = true, string uuid = "") ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = ""
)
{ {
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
_uuid = uuid; _uuid = uuid;
_name = name; _name = name;
_profileUuid = profileUuid; _profileUuid = profileUuid;
_category = ShortcutCategory.NoGame; _category = ShortcutCategory.NoGame;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -1083,9 +1261,16 @@ namespace DisplayMagician
bool gameArgumentsRequired, bool gameArgumentsRequired,
ShortcutPermanence displayPermanence, ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence, ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath, string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "", string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1, decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null, List<StartProgram> startPrograms = null,
bool autoName = true, bool autoName = true,
string uuid = "" string uuid = ""
@ -1102,19 +1287,17 @@ namespace DisplayMagician
_startTimeout = gameTimeout; _startTimeout = gameTimeout;
_gameArguments = gameArguments; _gameArguments = gameArguments;
_gameArgumentsRequired = gameArgumentsRequired; _gameArgumentsRequired = gameArgumentsRequired;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -1134,10 +1317,25 @@ namespace DisplayMagician
ReplaceShortcutIconInCache(); ReplaceShortcutIconInCache();
} }
public void UpdateGameShortcut(string name, ProfileItem profile, GameStruct game, ShortcutPermanence displayPermanence, public void UpdateGameShortcut(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, ProfileItem profile,
bool autoName = true, string uuid = "") GameStruct game,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = "")
{ {
// Create a new UUID for the shortcut if one wasn't created already // Create a new UUID for the shortcut if one wasn't created already
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
@ -1151,19 +1349,17 @@ namespace DisplayMagician
_startTimeout = game.StartTimeout; _startTimeout = game.StartTimeout;
_gameArguments = game.GameArguments; _gameArguments = game.GameArguments;
_gameArgumentsRequired = game.GameArgumentsRequired; _gameArgumentsRequired = game.GameArgumentsRequired;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -1184,10 +1380,26 @@ namespace DisplayMagician
public void UpdateGameShortcut(string name, string profileUuid, GameStruct game, ShortcutPermanence displayPermanence, public void UpdateGameShortcut(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, string profileUuid,
bool autoName = true, string uuid = "") GameStruct game,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = ""
)
{ {
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
_uuid = uuid; _uuid = uuid;
@ -1201,19 +1413,17 @@ namespace DisplayMagician
_gameArguments = game.GameArguments; _gameArguments = game.GameArguments;
_gameArgumentsRequired = game.GameArgumentsRequired; _gameArgumentsRequired = game.GameArgumentsRequired;
_gameArgumentsRequired = false; _gameArgumentsRequired = false;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -1256,9 +1466,16 @@ namespace DisplayMagician
bool processNameToMonitorUsesExecutable, bool processNameToMonitorUsesExecutable,
ShortcutPermanence displayPermanence, ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence, ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath, string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "", string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1, decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null, List<StartProgram> startPrograms = null,
bool autoName = true, bool autoName = true,
string uuid = "" string uuid = ""
@ -1275,19 +1492,17 @@ namespace DisplayMagician
_executableArguments = executableArguments; _executableArguments = executableArguments;
_executableArgumentsRequired = executableArgumentsRequired; _executableArgumentsRequired = executableArgumentsRequired;
_processNameToMonitorUsesExecutable = processNameToMonitorUsesExecutable; _processNameToMonitorUsesExecutable = processNameToMonitorUsesExecutable;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -1307,10 +1522,26 @@ namespace DisplayMagician
ReplaceShortcutIconInCache(); ReplaceShortcutIconInCache();
} }
public void UpdateExecutableShortcut(string name, ProfileItem profile, Executable executable, ShortcutPermanence displayPermanence, public void UpdateExecutableShortcut(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, ProfileItem profile,
bool autoName = true, string uuid = "") Executable executable,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = ""
)
{ {
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
_uuid = uuid; _uuid = uuid;
@ -1323,19 +1554,17 @@ namespace DisplayMagician
_executableArguments = executable.ExecutableArguments; _executableArguments = executable.ExecutableArguments;
_executableArgumentsRequired = executable.ExecutableArgumentsRequired; _executableArgumentsRequired = executable.ExecutableArgumentsRequired;
_processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable; _processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -1355,10 +1584,26 @@ namespace DisplayMagician
ReplaceShortcutIconInCache(); ReplaceShortcutIconInCache();
} }
public void UpdateExecutableShortcut(string name, string profileUuid, Executable executable, ShortcutPermanence displayPermanence, public void UpdateExecutableShortcut(
ShortcutPermanence audioPermanence, string originalIconPath, string name,
string audioDevice = "", decimal audioVolume = -1, List<StartProgram> startPrograms = null, string profileUuid,
bool autoName = true, string uuid = "") Executable executable,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
string originalIconPath,
bool changeAudioDevice = false,
string audioDevice = "",
bool setAudioVolume = false,
decimal audioVolume = -1,
bool changeCaptureDevice = false,
string captureDevice = "",
bool setCaptureVolume = false,
decimal captureVolume = -1,
List<StartProgram> startPrograms = null,
bool autoName = true,
string uuid = ""
)
{ {
if (!String.IsNullOrWhiteSpace(uuid)) if (!String.IsNullOrWhiteSpace(uuid))
_uuid = uuid; _uuid = uuid;
@ -1371,19 +1616,17 @@ namespace DisplayMagician
_executableArguments = executable.ExecutableArguments; _executableArguments = executable.ExecutableArguments;
_executableArgumentsRequired = executable.ExecutableArgumentsRequired; _executableArgumentsRequired = executable.ExecutableArgumentsRequired;
_processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable; _processNameToMonitorUsesExecutable = executable.ProcessNameToMonitorUsesExecutable;
if (String.IsNullOrEmpty(audioDevice)) _changeAudioDevice = changeAudioDevice;
_changeAudioDevice = false;
else
_changeAudioDevice = true;
_audioDevice = audioDevice; _audioDevice = audioDevice;
if (audioVolume >= 0 && audioVolume <= 100) _setAudioVolume = setAudioVolume;
_setAudioVolume = true;
else
_setAudioVolume = false;
_audioVolume = audioVolume; _audioVolume = audioVolume;
_changeCaptureDevice = changeCaptureDevice;
_captureDevice = captureDevice;
_setCaptureVolume = setCaptureVolume;
_captureVolume = captureVolume;
_displayPermanence = displayPermanence; _displayPermanence = displayPermanence;
_audioPermanence = audioPermanence; _audioPermanence = audioPermanence;
_capturePermanence = capturePermanence;
_autoName = autoName; _autoName = autoName;
_startPrograms = startPrograms; _startPrograms = startPrograms;
_originalIconPath = originalIconPath; _originalIconPath = originalIconPath;
@ -1442,6 +1685,7 @@ namespace DisplayMagician
shortcut.ProfileUUID = ProfileUUID; shortcut.ProfileUUID = ProfileUUID;
shortcut.DisplayPermanence = DisplayPermanence; shortcut.DisplayPermanence = DisplayPermanence;
shortcut.AudioPermanence = AudioPermanence; shortcut.AudioPermanence = AudioPermanence;
shortcut.CapturePermanence = CapturePermanence;
shortcut.Category = Category; shortcut.Category = Category;
shortcut.DifferentExecutableToMonitor = DifferentExecutableToMonitor; shortcut.DifferentExecutableToMonitor = DifferentExecutableToMonitor;
shortcut.ExecutableNameAndPath = ExecutableNameAndPath; shortcut.ExecutableNameAndPath = ExecutableNameAndPath;
@ -1464,6 +1708,11 @@ namespace DisplayMagician
shortcut.AudioDevice = AudioDevice; shortcut.AudioDevice = AudioDevice;
shortcut.SetAudioVolume = SetAudioVolume; shortcut.SetAudioVolume = SetAudioVolume;
shortcut.AudioVolume = AudioVolume; shortcut.AudioVolume = AudioVolume;
shortcut.ChangeCaptureDevice = ChangeCaptureDevice;
shortcut.CaptureDevice = CaptureDevice;
shortcut.SetCaptureVolume = SetCaptureVolume;
shortcut.CaptureVolume = CaptureVolume;
// Save the shortcut incon to the icon cache // Save the shortcut incon to the icon cache
shortcut.ReplaceShortcutIconInCache(); shortcut.ReplaceShortcutIconInCache();
@ -1725,6 +1974,24 @@ namespace DisplayMagician
} }
} }
} }
// Check the Capture Device is still valid (if one is specified)
if (ChangeCaptureDevice)
{
CoreAudioController audioController = ShortcutRepository.AudioController;
IEnumerable<CoreAudioDevice> captureDevices = audioController.GetCaptureDevices();
foreach (CoreAudioDevice captureDevice in captureDevices)
{
if (captureDevice.FullName.Equals(CaptureDevice))
{
if (captureDevice.State == AudioSwitcher.AudioApi.DeviceState.Disabled)
return (false, $"The Capture Device {CaptureDevice} is disabled, so the shortcut '{Name}' cannot be used. You need to enable the capture device to use this shortcut, or edit the shortcut to change the capture device.");
if (captureDevice.State == AudioSwitcher.AudioApi.DeviceState.NotPresent)
return (false, $"The Capture Device {CaptureDevice} is not present, so the shortcut '{Name}' cannot be used.");
if (captureDevice.State == AudioSwitcher.AudioApi.DeviceState.Unplugged)
return (false, $"The Capture Device {CaptureDevice} is unplugged, so the shortcut '{Name}' cannot be used. You need to plug in the capture device to use this shortcut, or edit the shortcut to change the capture device.");
}
}
}
// TODO Do all the specified pre-start apps still exist? // TODO Do all the specified pre-start apps still exist?

View File

@ -483,6 +483,38 @@ namespace DisplayMagician
} }
} }
// record the old microphone device
bool needToChangeCaptureDevice = false;
CoreAudioDevice rollbackCaptureDevice = _audioController.DefaultCaptureDevice;
double rollbackCaptureVolume = _audioController.DefaultCaptureDevice.Volume;
if (!rollbackCaptureDevice.FullName.Equals(shortcutToUse.CaptureDevice))
needToChangeCaptureDevice = true;
// Change capture Device (if one specified)
if (shortcutToUse.ChangeCaptureDevice)
{
IEnumerable<CoreAudioDevice> captureDevices = _audioController.GetCaptureDevices();
foreach (CoreAudioDevice captureDevice in captureDevices)
{
if (captureDevice.FullName.Equals(shortcutToUse.CaptureDevice))
{
// use the Audio Device
captureDevice.SetAsDefault();
if (shortcutToUse.SetCaptureVolume)
{
Task myTask = new Task(() =>
{
captureDevice.SetVolumeAsync(Convert.ToDouble(shortcutToUse.CaptureVolume));
});
myTask.Start();
myTask.Wait(2000);
}
}
}
}
// Set the IP Service status back to what it was // Set the IP Service status back to what it was
IPCService.GetInstance().Status = rollbackInstanceStatus; IPCService.GetInstance().Status = rollbackInstanceStatus;
@ -878,6 +910,23 @@ namespace DisplayMagician
} }
// Change Capture Device back (if one specified)
if (needToChangeCaptureDevice)
{
// use the Audio Device
rollbackCaptureDevice.SetAsDefault();
if (shortcutToUse.SetCaptureVolume)
{
Task myTask = new Task(() =>
{
rollbackCaptureDevice.SetVolumeAsync(Convert.ToDouble(rollbackCaptureVolume));
});
myTask.Start();
myTask.Wait(2000);
}
}
// Change back to the original profile only if it is different // Change back to the original profile only if it is different
if (needToChangeProfiles) if (needToChangeProfiles)

View File

@ -44,6 +44,17 @@ namespace DisplayMagician.UIForms
this.ilv_saved_profiles = new Manina.Windows.Forms.ImageListView(); this.ilv_saved_profiles = new Manina.Windows.Forms.ImageListView();
this.dv_profile = new DisplayMagician.Shared.UserControls.DisplayView(); this.dv_profile = new DisplayMagician.Shared.UserControls.DisplayView();
this.tabp_audio = new System.Windows.Forms.TabPage(); this.tabp_audio = new System.Windows.Forms.TabPage();
this.gb_capture_settings = new System.Windows.Forms.GroupBox();
this.gb_capture_volume = new System.Windows.Forms.GroupBox();
this.rb_set_capture_volume = new System.Windows.Forms.RadioButton();
this.rb_keep_capture_volume = new System.Windows.Forms.RadioButton();
this.lbl_capture_volume = new System.Windows.Forms.Label();
this.nud_capture_volume = new System.Windows.Forms.NumericUpDown();
this.btn_rescan_capture = new System.Windows.Forms.Button();
this.cb_capture_device = new System.Windows.Forms.ComboBox();
this.rb_change_capture = new System.Windows.Forms.RadioButton();
this.rb_no_change_capture = new System.Windows.Forms.RadioButton();
this.gb_audio_settings = new System.Windows.Forms.GroupBox();
this.gb_audio_volume = new System.Windows.Forms.GroupBox(); this.gb_audio_volume = new System.Windows.Forms.GroupBox();
this.rb_set_audio_volume = new System.Windows.Forms.RadioButton(); this.rb_set_audio_volume = new System.Windows.Forms.RadioButton();
this.rb_keep_audio_volume = new System.Windows.Forms.RadioButton(); this.rb_keep_audio_volume = new System.Windows.Forms.RadioButton();
@ -117,6 +128,9 @@ namespace DisplayMagician.UIForms
this.clm_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.clm_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.rb_launcher = new System.Windows.Forms.RadioButton(); this.rb_launcher = new System.Windows.Forms.RadioButton();
this.tabp_after = new System.Windows.Forms.TabPage(); this.tabp_after = new System.Windows.Forms.TabPage();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.rb_switch_capture_permanent = new System.Windows.Forms.RadioButton();
this.rb_switch_capture_temp = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rb_switch_audio_permanent = new System.Windows.Forms.RadioButton(); this.rb_switch_audio_permanent = new System.Windows.Forms.RadioButton();
this.rb_switch_audio_temp = new System.Windows.Forms.RadioButton(); this.rb_switch_audio_temp = new System.Windows.Forms.RadioButton();
@ -130,6 +144,10 @@ namespace DisplayMagician.UIForms
this.tabc_shortcut.SuspendLayout(); this.tabc_shortcut.SuspendLayout();
this.tabp_display.SuspendLayout(); this.tabp_display.SuspendLayout();
this.tabp_audio.SuspendLayout(); this.tabp_audio.SuspendLayout();
this.gb_capture_settings.SuspendLayout();
this.gb_capture_volume.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nud_capture_volume)).BeginInit();
this.gb_audio_settings.SuspendLayout();
this.gb_audio_volume.SuspendLayout(); this.gb_audio_volume.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nud_audio_volume)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nud_audio_volume)).BeginInit();
this.tabp_before.SuspendLayout(); this.tabp_before.SuspendLayout();
@ -143,6 +161,7 @@ namespace DisplayMagician.UIForms
this.p_game.SuspendLayout(); this.p_game.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nud_timeout_game)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nud_timeout_game)).BeginInit();
this.tabp_after.SuspendLayout(); this.tabp_after.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.gb_display_after.SuspendLayout(); this.gb_display_after.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -291,11 +310,8 @@ namespace DisplayMagician.UIForms
// tabp_audio // tabp_audio
// //
this.tabp_audio.BackColor = System.Drawing.Color.Black; this.tabp_audio.BackColor = System.Drawing.Color.Black;
this.tabp_audio.Controls.Add(this.gb_audio_volume); this.tabp_audio.Controls.Add(this.gb_capture_settings);
this.tabp_audio.Controls.Add(this.btn_rescan_audio); this.tabp_audio.Controls.Add(this.gb_audio_settings);
this.tabp_audio.Controls.Add(this.cb_audio_device);
this.tabp_audio.Controls.Add(this.rb_change_audio);
this.tabp_audio.Controls.Add(this.rb_no_change_audio);
this.tabp_audio.Location = new System.Drawing.Point(4, 32); this.tabp_audio.Location = new System.Drawing.Point(4, 32);
this.tabp_audio.Name = "tabp_audio"; this.tabp_audio.Name = "tabp_audio";
this.tabp_audio.Padding = new System.Windows.Forms.Padding(3); this.tabp_audio.Padding = new System.Windows.Forms.Padding(3);
@ -303,6 +319,152 @@ namespace DisplayMagician.UIForms
this.tabp_audio.TabIndex = 4; this.tabp_audio.TabIndex = 4;
this.tabp_audio.Text = "2. Choose Audio"; this.tabp_audio.Text = "2. Choose Audio";
// //
// gb_capture_settings
//
this.gb_capture_settings.Controls.Add(this.gb_capture_volume);
this.gb_capture_settings.Controls.Add(this.btn_rescan_capture);
this.gb_capture_settings.Controls.Add(this.cb_capture_device);
this.gb_capture_settings.Controls.Add(this.rb_change_capture);
this.gb_capture_settings.Controls.Add(this.rb_no_change_capture);
this.gb_capture_settings.ForeColor = System.Drawing.Color.White;
this.gb_capture_settings.Location = new System.Drawing.Point(65, 317);
this.gb_capture_settings.Name = "gb_capture_settings";
this.gb_capture_settings.Size = new System.Drawing.Size(953, 256);
this.gb_capture_settings.TabIndex = 21;
this.gb_capture_settings.TabStop = false;
this.gb_capture_settings.Text = "Microphone Settings";
//
// gb_capture_volume
//
this.gb_capture_volume.Controls.Add(this.rb_set_capture_volume);
this.gb_capture_volume.Controls.Add(this.rb_keep_capture_volume);
this.gb_capture_volume.Controls.Add(this.lbl_capture_volume);
this.gb_capture_volume.Controls.Add(this.nud_capture_volume);
this.gb_capture_volume.ForeColor = System.Drawing.Color.White;
this.gb_capture_volume.Location = new System.Drawing.Point(327, 114);
this.gb_capture_volume.Name = "gb_capture_volume";
this.gb_capture_volume.Size = new System.Drawing.Size(429, 128);
this.gb_capture_volume.TabIndex = 20;
this.gb_capture_volume.TabStop = false;
this.gb_capture_volume.Text = "Microphone Volume";
this.gb_capture_volume.Visible = false;
//
// rb_set_capture_volume
//
this.rb_set_capture_volume.AutoSize = true;
this.rb_set_capture_volume.ForeColor = System.Drawing.Color.White;
this.rb_set_capture_volume.Location = new System.Drawing.Point(62, 78);
this.rb_set_capture_volume.Name = "rb_set_capture_volume";
this.rb_set_capture_volume.Size = new System.Drawing.Size(167, 24);
this.rb_set_capture_volume.TabIndex = 13;
this.rb_set_capture_volume.Text = "Set audio volume at";
this.rb_set_capture_volume.UseVisualStyleBackColor = true;
this.rb_set_capture_volume.CheckedChanged += new System.EventHandler(this.rb_set_capture_volume_CheckedChanged);
//
// rb_keep_capture_volume
//
this.rb_keep_capture_volume.AutoSize = true;
this.rb_keep_capture_volume.Checked = true;
this.rb_keep_capture_volume.ForeColor = System.Drawing.Color.White;
this.rb_keep_capture_volume.Location = new System.Drawing.Point(62, 35);
this.rb_keep_capture_volume.Name = "rb_keep_capture_volume";
this.rb_keep_capture_volume.Size = new System.Drawing.Size(203, 24);
this.rb_keep_capture_volume.TabIndex = 12;
this.rb_keep_capture_volume.TabStop = true;
this.rb_keep_capture_volume.Text = "Leave audio volume as is";
this.rb_keep_capture_volume.UseVisualStyleBackColor = true;
this.rb_keep_capture_volume.CheckedChanged += new System.EventHandler(this.rb_keep_capture_volume_CheckedChanged);
//
// lbl_capture_volume
//
this.lbl_capture_volume.AutoSize = true;
this.lbl_capture_volume.ForeColor = System.Drawing.Color.White;
this.lbl_capture_volume.Location = new System.Drawing.Point(299, 80);
this.lbl_capture_volume.Name = "lbl_capture_volume";
this.lbl_capture_volume.Size = new System.Drawing.Size(63, 20);
this.lbl_capture_volume.TabIndex = 11;
this.lbl_capture_volume.Text = "percent";
//
// nud_capture_volume
//
this.nud_capture_volume.Enabled = false;
this.nud_capture_volume.Location = new System.Drawing.Point(233, 78);
this.nud_capture_volume.Name = "nud_capture_volume";
this.nud_capture_volume.Size = new System.Drawing.Size(60, 26);
this.nud_capture_volume.TabIndex = 10;
this.nud_capture_volume.Value = new decimal(new int[] {
100,
0,
0,
0});
this.nud_capture_volume.ValueChanged += new System.EventHandler(this.nud_capture_volume_ValueChanged);
//
// btn_rescan_capture
//
this.btn_rescan_capture.Enabled = false;
this.btn_rescan_capture.FlatAppearance.MouseDownBackColor = System.Drawing.Color.IndianRed;
this.btn_rescan_capture.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown;
this.btn_rescan_capture.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_rescan_capture.ForeColor = System.Drawing.Color.White;
this.btn_rescan_capture.Location = new System.Drawing.Point(760, 73);
this.btn_rescan_capture.Name = "btn_rescan_capture";
this.btn_rescan_capture.Size = new System.Drawing.Size(71, 28);
this.btn_rescan_capture.TabIndex = 19;
this.btn_rescan_capture.Text = "rescan";
this.btn_rescan_capture.UseVisualStyleBackColor = true;
this.btn_rescan_capture.Click += new System.EventHandler(this.btn_rescan_capture_Click);
//
// cb_capture_device
//
this.cb_capture_device.Enabled = false;
this.cb_capture_device.FormattingEnabled = true;
this.cb_capture_device.Location = new System.Drawing.Point(325, 73);
this.cb_capture_device.Name = "cb_capture_device";
this.cb_capture_device.Size = new System.Drawing.Size(429, 28);
this.cb_capture_device.TabIndex = 18;
this.cb_capture_device.SelectedIndexChanged += new System.EventHandler(this.cb_capture_device_SelectedIndexChanged);
//
// rb_change_capture
//
this.rb_change_capture.AutoSize = true;
this.rb_change_capture.ForeColor = System.Drawing.Color.White;
this.rb_change_capture.Location = new System.Drawing.Point(121, 73);
this.rb_change_capture.Name = "rb_change_capture";
this.rb_change_capture.Size = new System.Drawing.Size(192, 24);
this.rb_change_capture.TabIndex = 17;
this.rb_change_capture.Text = "Change microphone to:";
this.rb_change_capture.UseVisualStyleBackColor = true;
this.rb_change_capture.CheckedChanged += new System.EventHandler(this.rb_change_capture_CheckedChanged);
//
// rb_no_change_capture
//
this.rb_no_change_capture.AutoSize = true;
this.rb_no_change_capture.Checked = true;
this.rb_no_change_capture.ForeColor = System.Drawing.Color.White;
this.rb_no_change_capture.Location = new System.Drawing.Point(121, 35);
this.rb_no_change_capture.Name = "rb_no_change_capture";
this.rb_no_change_capture.Size = new System.Drawing.Size(308, 24);
this.rb_no_change_capture.TabIndex = 16;
this.rb_no_change_capture.TabStop = true;
this.rb_no_change_capture.Text = "Don\'t change microphone input settings";
this.rb_no_change_capture.UseVisualStyleBackColor = true;
this.rb_no_change_capture.CheckedChanged += new System.EventHandler(this.rb_no_change_capture_CheckedChanged);
//
// gb_audio_settings
//
this.gb_audio_settings.Controls.Add(this.gb_audio_volume);
this.gb_audio_settings.Controls.Add(this.btn_rescan_audio);
this.gb_audio_settings.Controls.Add(this.cb_audio_device);
this.gb_audio_settings.Controls.Add(this.rb_change_audio);
this.gb_audio_settings.Controls.Add(this.rb_no_change_audio);
this.gb_audio_settings.ForeColor = System.Drawing.Color.White;
this.gb_audio_settings.Location = new System.Drawing.Point(65, 30);
this.gb_audio_settings.Name = "gb_audio_settings";
this.gb_audio_settings.Size = new System.Drawing.Size(953, 272);
this.gb_audio_settings.TabIndex = 0;
this.gb_audio_settings.TabStop = false;
this.gb_audio_settings.Text = "Audio Output Settings";
//
// gb_audio_volume // gb_audio_volume
// //
this.gb_audio_volume.Controls.Add(this.rb_set_audio_volume); this.gb_audio_volume.Controls.Add(this.rb_set_audio_volume);
@ -310,10 +472,10 @@ namespace DisplayMagician.UIForms
this.gb_audio_volume.Controls.Add(this.lbl_audio_volume); this.gb_audio_volume.Controls.Add(this.lbl_audio_volume);
this.gb_audio_volume.Controls.Add(this.nud_audio_volume); this.gb_audio_volume.Controls.Add(this.nud_audio_volume);
this.gb_audio_volume.ForeColor = System.Drawing.Color.White; this.gb_audio_volume.ForeColor = System.Drawing.Color.White;
this.gb_audio_volume.Location = new System.Drawing.Point(392, 240); this.gb_audio_volume.Location = new System.Drawing.Point(325, 113);
this.gb_audio_volume.Name = "gb_audio_volume"; this.gb_audio_volume.Name = "gb_audio_volume";
this.gb_audio_volume.Size = new System.Drawing.Size(429, 147); this.gb_audio_volume.Size = new System.Drawing.Size(429, 133);
this.gb_audio_volume.TabIndex = 10; this.gb_audio_volume.TabIndex = 20;
this.gb_audio_volume.TabStop = false; this.gb_audio_volume.TabStop = false;
this.gb_audio_volume.Text = "Audio Output Volume"; this.gb_audio_volume.Text = "Audio Output Volume";
this.gb_audio_volume.Visible = false; this.gb_audio_volume.Visible = false;
@ -322,7 +484,7 @@ namespace DisplayMagician.UIForms
// //
this.rb_set_audio_volume.AutoSize = true; this.rb_set_audio_volume.AutoSize = true;
this.rb_set_audio_volume.ForeColor = System.Drawing.Color.White; this.rb_set_audio_volume.ForeColor = System.Drawing.Color.White;
this.rb_set_audio_volume.Location = new System.Drawing.Point(38, 84); this.rb_set_audio_volume.Location = new System.Drawing.Point(61, 82);
this.rb_set_audio_volume.Name = "rb_set_audio_volume"; this.rb_set_audio_volume.Name = "rb_set_audio_volume";
this.rb_set_audio_volume.Size = new System.Drawing.Size(167, 24); this.rb_set_audio_volume.Size = new System.Drawing.Size(167, 24);
this.rb_set_audio_volume.TabIndex = 13; this.rb_set_audio_volume.TabIndex = 13;
@ -335,7 +497,7 @@ namespace DisplayMagician.UIForms
this.rb_keep_audio_volume.AutoSize = true; this.rb_keep_audio_volume.AutoSize = true;
this.rb_keep_audio_volume.Checked = true; this.rb_keep_audio_volume.Checked = true;
this.rb_keep_audio_volume.ForeColor = System.Drawing.Color.White; this.rb_keep_audio_volume.ForeColor = System.Drawing.Color.White;
this.rb_keep_audio_volume.Location = new System.Drawing.Point(38, 41); this.rb_keep_audio_volume.Location = new System.Drawing.Point(61, 38);
this.rb_keep_audio_volume.Name = "rb_keep_audio_volume"; this.rb_keep_audio_volume.Name = "rb_keep_audio_volume";
this.rb_keep_audio_volume.Size = new System.Drawing.Size(203, 24); this.rb_keep_audio_volume.Size = new System.Drawing.Size(203, 24);
this.rb_keep_audio_volume.TabIndex = 12; this.rb_keep_audio_volume.TabIndex = 12;
@ -348,7 +510,7 @@ namespace DisplayMagician.UIForms
// //
this.lbl_audio_volume.AutoSize = true; this.lbl_audio_volume.AutoSize = true;
this.lbl_audio_volume.ForeColor = System.Drawing.Color.White; this.lbl_audio_volume.ForeColor = System.Drawing.Color.White;
this.lbl_audio_volume.Location = new System.Drawing.Point(275, 86); this.lbl_audio_volume.Location = new System.Drawing.Point(298, 84);
this.lbl_audio_volume.Name = "lbl_audio_volume"; this.lbl_audio_volume.Name = "lbl_audio_volume";
this.lbl_audio_volume.Size = new System.Drawing.Size(63, 20); this.lbl_audio_volume.Size = new System.Drawing.Size(63, 20);
this.lbl_audio_volume.TabIndex = 11; this.lbl_audio_volume.TabIndex = 11;
@ -357,7 +519,7 @@ namespace DisplayMagician.UIForms
// nud_audio_volume // nud_audio_volume
// //
this.nud_audio_volume.Enabled = false; this.nud_audio_volume.Enabled = false;
this.nud_audio_volume.Location = new System.Drawing.Point(209, 84); this.nud_audio_volume.Location = new System.Drawing.Point(232, 82);
this.nud_audio_volume.Name = "nud_audio_volume"; this.nud_audio_volume.Name = "nud_audio_volume";
this.nud_audio_volume.Size = new System.Drawing.Size(60, 26); this.nud_audio_volume.Size = new System.Drawing.Size(60, 26);
this.nud_audio_volume.TabIndex = 10; this.nud_audio_volume.TabIndex = 10;
@ -366,6 +528,7 @@ namespace DisplayMagician.UIForms
0, 0,
0, 0,
0}); 0});
this.nud_audio_volume.ValueChanged += new System.EventHandler(this.nud_audio_volume_ValueChanged);
// //
// btn_rescan_audio // btn_rescan_audio
// //
@ -374,10 +537,10 @@ namespace DisplayMagician.UIForms
this.btn_rescan_audio.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown; this.btn_rescan_audio.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown;
this.btn_rescan_audio.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_rescan_audio.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_rescan_audio.ForeColor = System.Drawing.Color.White; this.btn_rescan_audio.ForeColor = System.Drawing.Color.White;
this.btn_rescan_audio.Location = new System.Drawing.Point(827, 186); this.btn_rescan_audio.Location = new System.Drawing.Point(760, 72);
this.btn_rescan_audio.Name = "btn_rescan_audio"; this.btn_rescan_audio.Name = "btn_rescan_audio";
this.btn_rescan_audio.Size = new System.Drawing.Size(71, 28); this.btn_rescan_audio.Size = new System.Drawing.Size(71, 28);
this.btn_rescan_audio.TabIndex = 3; this.btn_rescan_audio.TabIndex = 19;
this.btn_rescan_audio.Text = "rescan"; this.btn_rescan_audio.Text = "rescan";
this.btn_rescan_audio.UseVisualStyleBackColor = true; this.btn_rescan_audio.UseVisualStyleBackColor = true;
this.btn_rescan_audio.Click += new System.EventHandler(this.btn_rescan_audio_Click); this.btn_rescan_audio.Click += new System.EventHandler(this.btn_rescan_audio_Click);
@ -386,20 +549,20 @@ namespace DisplayMagician.UIForms
// //
this.cb_audio_device.Enabled = false; this.cb_audio_device.Enabled = false;
this.cb_audio_device.FormattingEnabled = true; this.cb_audio_device.FormattingEnabled = true;
this.cb_audio_device.Location = new System.Drawing.Point(392, 186); this.cb_audio_device.Location = new System.Drawing.Point(325, 72);
this.cb_audio_device.Name = "cb_audio_device"; this.cb_audio_device.Name = "cb_audio_device";
this.cb_audio_device.Size = new System.Drawing.Size(429, 28); this.cb_audio_device.Size = new System.Drawing.Size(429, 28);
this.cb_audio_device.TabIndex = 2; this.cb_audio_device.TabIndex = 18;
this.cb_audio_device.SelectedIndexChanged += new System.EventHandler(this.cb_audio_device_SelectedIndexChanged); this.cb_audio_device.SelectedIndexChanged += new System.EventHandler(this.cb_audio_device_SelectedIndexChanged);
// //
// rb_change_audio // rb_change_audio
// //
this.rb_change_audio.AutoSize = true; this.rb_change_audio.AutoSize = true;
this.rb_change_audio.ForeColor = System.Drawing.Color.White; this.rb_change_audio.ForeColor = System.Drawing.Color.White;
this.rb_change_audio.Location = new System.Drawing.Point(188, 186); this.rb_change_audio.Location = new System.Drawing.Point(121, 72);
this.rb_change_audio.Name = "rb_change_audio"; this.rb_change_audio.Name = "rb_change_audio";
this.rb_change_audio.Size = new System.Drawing.Size(198, 24); this.rb_change_audio.Size = new System.Drawing.Size(198, 24);
this.rb_change_audio.TabIndex = 1; this.rb_change_audio.TabIndex = 17;
this.rb_change_audio.Text = "Change audio output to:"; this.rb_change_audio.Text = "Change audio output to:";
this.rb_change_audio.UseVisualStyleBackColor = true; this.rb_change_audio.UseVisualStyleBackColor = true;
this.rb_change_audio.CheckedChanged += new System.EventHandler(this.rb_change_audio_CheckedChanged); this.rb_change_audio.CheckedChanged += new System.EventHandler(this.rb_change_audio_CheckedChanged);
@ -409,12 +572,12 @@ namespace DisplayMagician.UIForms
this.rb_no_change_audio.AutoSize = true; this.rb_no_change_audio.AutoSize = true;
this.rb_no_change_audio.Checked = true; this.rb_no_change_audio.Checked = true;
this.rb_no_change_audio.ForeColor = System.Drawing.Color.White; this.rb_no_change_audio.ForeColor = System.Drawing.Color.White;
this.rb_no_change_audio.Location = new System.Drawing.Point(188, 114); this.rb_no_change_audio.Location = new System.Drawing.Point(121, 34);
this.rb_no_change_audio.Name = "rb_no_change_audio"; this.rb_no_change_audio.Name = "rb_no_change_audio";
this.rb_no_change_audio.Size = new System.Drawing.Size(215, 24); this.rb_no_change_audio.Size = new System.Drawing.Size(275, 24);
this.rb_no_change_audio.TabIndex = 0; this.rb_no_change_audio.TabIndex = 16;
this.rb_no_change_audio.TabStop = true; this.rb_no_change_audio.TabStop = true;
this.rb_no_change_audio.Text = "Don\'t change audio output"; this.rb_no_change_audio.Text = "Don\'t change audio output settings";
this.rb_no_change_audio.UseVisualStyleBackColor = true; this.rb_no_change_audio.UseVisualStyleBackColor = true;
this.rb_no_change_audio.CheckedChanged += new System.EventHandler(this.rb_no_change_audio_CheckedChanged); this.rb_no_change_audio.CheckedChanged += new System.EventHandler(this.rb_no_change_audio_CheckedChanged);
// //
@ -1144,6 +1307,7 @@ namespace DisplayMagician.UIForms
// tabp_after // tabp_after
// //
this.tabp_after.BackColor = System.Drawing.Color.Black; this.tabp_after.BackColor = System.Drawing.Color.Black;
this.tabp_after.Controls.Add(this.groupBox2);
this.tabp_after.Controls.Add(this.groupBox1); this.tabp_after.Controls.Add(this.groupBox1);
this.tabp_after.Controls.Add(this.gb_display_after); this.tabp_after.Controls.Add(this.gb_display_after);
this.tabp_after.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tabp_after.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -1155,42 +1319,83 @@ namespace DisplayMagician.UIForms
this.tabp_after.TabIndex = 3; this.tabp_after.TabIndex = 3;
this.tabp_after.Text = "5. Choose what happens afterwards"; this.tabp_after.Text = "5. Choose what happens afterwards";
// //
// groupBox2
//
this.groupBox2.Controls.Add(this.rb_switch_capture_permanent);
this.groupBox2.Controls.Add(this.rb_switch_capture_temp);
this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox2.ForeColor = System.Drawing.Color.White;
this.groupBox2.Location = new System.Drawing.Point(175, 404);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(765, 161);
this.groupBox2.TabIndex = 13;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "What happens to the Microphone afterwards?";
//
// rb_switch_capture_permanent
//
this.rb_switch_capture_permanent.AutoSize = true;
this.rb_switch_capture_permanent.ForeColor = System.Drawing.Color.White;
this.rb_switch_capture_permanent.Location = new System.Drawing.Point(98, 96);
this.rb_switch_capture_permanent.Name = "rb_switch_capture_permanent";
this.rb_switch_capture_permanent.Size = new System.Drawing.Size(492, 24);
this.rb_switch_capture_permanent.TabIndex = 12;
this.rb_switch_capture_permanent.Text = "Keep using the Microphone after Game ends (permanent change)";
this.rb_switch_capture_permanent.UseVisualStyleBackColor = true;
this.rb_switch_capture_permanent.CheckedChanged += new System.EventHandler(this.rb_switch_capture_permanent_CheckedChanged);
//
// rb_switch_capture_temp
//
this.rb_switch_capture_temp.AutoSize = true;
this.rb_switch_capture_temp.Checked = true;
this.rb_switch_capture_temp.ForeColor = System.Drawing.Color.White;
this.rb_switch_capture_temp.Location = new System.Drawing.Point(98, 48);
this.rb_switch_capture_temp.Name = "rb_switch_capture_temp";
this.rb_switch_capture_temp.Size = new System.Drawing.Size(553, 24);
this.rb_switch_capture_temp.TabIndex = 11;
this.rb_switch_capture_temp.TabStop = true;
this.rb_switch_capture_temp.Text = "Revert back to original Microphone (temporary change while running game)";
this.rb_switch_capture_temp.UseVisualStyleBackColor = true;
this.rb_switch_capture_temp.CheckedChanged += new System.EventHandler(this.rb_switch_capture_temp_CheckedChanged);
//
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.rb_switch_audio_permanent); this.groupBox1.Controls.Add(this.rb_switch_audio_permanent);
this.groupBox1.Controls.Add(this.rb_switch_audio_temp); this.groupBox1.Controls.Add(this.rb_switch_audio_temp);
this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox1.ForeColor = System.Drawing.Color.White; this.groupBox1.ForeColor = System.Drawing.Color.White;
this.groupBox1.Location = new System.Drawing.Point(175, 311); this.groupBox1.Location = new System.Drawing.Point(175, 219);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(765, 203); this.groupBox1.Size = new System.Drawing.Size(765, 161);
this.groupBox1.TabIndex = 12; this.groupBox1.TabIndex = 12;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "What happens to the Audio afterwards?"; this.groupBox1.Text = "What happens to the Audio output afterwards?";
// //
// rb_switch_audio_permanent // rb_switch_audio_permanent
// //
this.rb_switch_audio_permanent.AutoSize = true; this.rb_switch_audio_permanent.AutoSize = true;
this.rb_switch_audio_permanent.ForeColor = System.Drawing.Color.White; this.rb_switch_audio_permanent.ForeColor = System.Drawing.Color.White;
this.rb_switch_audio_permanent.Location = new System.Drawing.Point(98, 116); this.rb_switch_audio_permanent.Location = new System.Drawing.Point(98, 96);
this.rb_switch_audio_permanent.Name = "rb_switch_audio_permanent"; this.rb_switch_audio_permanent.Name = "rb_switch_audio_permanent";
this.rb_switch_audio_permanent.Size = new System.Drawing.Size(502, 24); this.rb_switch_audio_permanent.Size = new System.Drawing.Size(502, 24);
this.rb_switch_audio_permanent.TabIndex = 12; this.rb_switch_audio_permanent.TabIndex = 12;
this.rb_switch_audio_permanent.Text = "Keep using the Audio Device after Game ends (permanent change)"; this.rb_switch_audio_permanent.Text = "Keep using the Audio Device after Game ends (permanent change)";
this.rb_switch_audio_permanent.UseVisualStyleBackColor = true; this.rb_switch_audio_permanent.UseVisualStyleBackColor = true;
this.rb_switch_audio_permanent.CheckedChanged += new System.EventHandler(this.rb_switch_audio_permanent_CheckedChanged);
// //
// rb_switch_audio_temp // rb_switch_audio_temp
// //
this.rb_switch_audio_temp.AutoSize = true; this.rb_switch_audio_temp.AutoSize = true;
this.rb_switch_audio_temp.Checked = true; this.rb_switch_audio_temp.Checked = true;
this.rb_switch_audio_temp.ForeColor = System.Drawing.Color.White; this.rb_switch_audio_temp.ForeColor = System.Drawing.Color.White;
this.rb_switch_audio_temp.Location = new System.Drawing.Point(98, 68); this.rb_switch_audio_temp.Location = new System.Drawing.Point(98, 48);
this.rb_switch_audio_temp.Name = "rb_switch_audio_temp"; this.rb_switch_audio_temp.Name = "rb_switch_audio_temp";
this.rb_switch_audio_temp.Size = new System.Drawing.Size(563, 24); this.rb_switch_audio_temp.Size = new System.Drawing.Size(563, 24);
this.rb_switch_audio_temp.TabIndex = 11; this.rb_switch_audio_temp.TabIndex = 11;
this.rb_switch_audio_temp.TabStop = true; this.rb_switch_audio_temp.TabStop = true;
this.rb_switch_audio_temp.Text = "Revert back to original Audio Device (temporary change while running game)"; this.rb_switch_audio_temp.Text = "Revert back to original Audio Device (temporary change while running game)";
this.rb_switch_audio_temp.UseVisualStyleBackColor = true; this.rb_switch_audio_temp.UseVisualStyleBackColor = true;
this.rb_switch_audio_temp.CheckedChanged += new System.EventHandler(this.rb_switch_audio_temp_CheckedChanged);
// //
// gb_display_after // gb_display_after
// //
@ -1198,9 +1403,9 @@ namespace DisplayMagician.UIForms
this.gb_display_after.Controls.Add(this.rb_switch_display_temp); this.gb_display_after.Controls.Add(this.rb_switch_display_temp);
this.gb_display_after.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.gb_display_after.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gb_display_after.ForeColor = System.Drawing.Color.White; this.gb_display_after.ForeColor = System.Drawing.Color.White;
this.gb_display_after.Location = new System.Drawing.Point(175, 58); this.gb_display_after.Location = new System.Drawing.Point(175, 31);
this.gb_display_after.Name = "gb_display_after"; this.gb_display_after.Name = "gb_display_after";
this.gb_display_after.Size = new System.Drawing.Size(765, 203); this.gb_display_after.Size = new System.Drawing.Size(765, 162);
this.gb_display_after.TabIndex = 11; this.gb_display_after.TabIndex = 11;
this.gb_display_after.TabStop = false; this.gb_display_after.TabStop = false;
this.gb_display_after.Text = "What happens to the Display Profile afterwards?"; this.gb_display_after.Text = "What happens to the Display Profile afterwards?";
@ -1209,25 +1414,27 @@ namespace DisplayMagician.UIForms
// //
this.rb_switch_display_permanent.AutoSize = true; this.rb_switch_display_permanent.AutoSize = true;
this.rb_switch_display_permanent.ForeColor = System.Drawing.Color.White; this.rb_switch_display_permanent.ForeColor = System.Drawing.Color.White;
this.rb_switch_display_permanent.Location = new System.Drawing.Point(98, 116); this.rb_switch_display_permanent.Location = new System.Drawing.Point(98, 96);
this.rb_switch_display_permanent.Name = "rb_switch_display_permanent"; this.rb_switch_display_permanent.Name = "rb_switch_display_permanent";
this.rb_switch_display_permanent.Size = new System.Drawing.Size(508, 24); this.rb_switch_display_permanent.Size = new System.Drawing.Size(508, 24);
this.rb_switch_display_permanent.TabIndex = 12; this.rb_switch_display_permanent.TabIndex = 12;
this.rb_switch_display_permanent.Text = "Keep using the Display Profile after Game ends (permanent change)"; this.rb_switch_display_permanent.Text = "Keep using the Display Profile after Game ends (permanent change)";
this.rb_switch_display_permanent.UseVisualStyleBackColor = true; this.rb_switch_display_permanent.UseVisualStyleBackColor = true;
this.rb_switch_display_permanent.CheckedChanged += new System.EventHandler(this.rb_switch_display_permanent_CheckedChanged);
// //
// rb_switch_display_temp // rb_switch_display_temp
// //
this.rb_switch_display_temp.AutoSize = true; this.rb_switch_display_temp.AutoSize = true;
this.rb_switch_display_temp.Checked = true; this.rb_switch_display_temp.Checked = true;
this.rb_switch_display_temp.ForeColor = System.Drawing.Color.White; this.rb_switch_display_temp.ForeColor = System.Drawing.Color.White;
this.rb_switch_display_temp.Location = new System.Drawing.Point(98, 68); this.rb_switch_display_temp.Location = new System.Drawing.Point(98, 48);
this.rb_switch_display_temp.Name = "rb_switch_display_temp"; this.rb_switch_display_temp.Name = "rb_switch_display_temp";
this.rb_switch_display_temp.Size = new System.Drawing.Size(569, 24); this.rb_switch_display_temp.Size = new System.Drawing.Size(569, 24);
this.rb_switch_display_temp.TabIndex = 11; this.rb_switch_display_temp.TabIndex = 11;
this.rb_switch_display_temp.TabStop = true; this.rb_switch_display_temp.TabStop = true;
this.rb_switch_display_temp.Text = "Revert back to original Display Profile (temporary change while running game)"; this.rb_switch_display_temp.Text = "Revert back to original Display Profile (temporary change while running game)";
this.rb_switch_display_temp.UseVisualStyleBackColor = true; this.rb_switch_display_temp.UseVisualStyleBackColor = true;
this.rb_switch_display_temp.CheckedChanged += new System.EventHandler(this.rb_switch_display_temp_CheckedChanged);
// //
// txt_shortcut_save_name // txt_shortcut_save_name
// //
@ -1305,7 +1512,13 @@ namespace DisplayMagician.UIForms
this.tabp_display.ResumeLayout(false); this.tabp_display.ResumeLayout(false);
this.tabp_display.PerformLayout(); this.tabp_display.PerformLayout();
this.tabp_audio.ResumeLayout(false); this.tabp_audio.ResumeLayout(false);
this.tabp_audio.PerformLayout(); this.gb_capture_settings.ResumeLayout(false);
this.gb_capture_settings.PerformLayout();
this.gb_capture_volume.ResumeLayout(false);
this.gb_capture_volume.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nud_capture_volume)).EndInit();
this.gb_audio_settings.ResumeLayout(false);
this.gb_audio_settings.PerformLayout();
this.gb_audio_volume.ResumeLayout(false); this.gb_audio_volume.ResumeLayout(false);
this.gb_audio_volume.PerformLayout(); this.gb_audio_volume.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nud_audio_volume)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nud_audio_volume)).EndInit();
@ -1327,6 +1540,8 @@ namespace DisplayMagician.UIForms
this.p_game.PerformLayout(); this.p_game.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nud_timeout_game)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nud_timeout_game)).EndInit();
this.tabp_after.ResumeLayout(false); this.tabp_after.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.gb_display_after.ResumeLayout(false); this.gb_display_after.ResumeLayout(false);
@ -1416,20 +1631,34 @@ namespace DisplayMagician.UIForms
private System.Windows.Forms.CheckBox cb_start_program2; private System.Windows.Forms.CheckBox cb_start_program2;
private System.Windows.Forms.CheckBox cb_start_program1; private System.Windows.Forms.CheckBox cb_start_program1;
private System.Windows.Forms.TabPage tabp_audio; private System.Windows.Forms.TabPage tabp_audio;
private System.Windows.Forms.RadioButton rb_no_change_audio;
private System.Windows.Forms.RadioButton rb_change_audio;
private System.Windows.Forms.ComboBox cb_audio_device;
private System.Windows.Forms.Button btn_rescan_audio;
private System.Windows.Forms.GroupBox gb_display_after; private System.Windows.Forms.GroupBox gb_display_after;
private System.Windows.Forms.RadioButton rb_switch_display_permanent; private System.Windows.Forms.RadioButton rb_switch_display_permanent;
private System.Windows.Forms.RadioButton rb_switch_display_temp; private System.Windows.Forms.RadioButton rb_switch_display_temp;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton rb_switch_audio_permanent; private System.Windows.Forms.RadioButton rb_switch_audio_permanent;
private System.Windows.Forms.RadioButton rb_switch_audio_temp; private System.Windows.Forms.RadioButton rb_switch_audio_temp;
private System.Windows.Forms.GroupBox gb_capture_settings;
private System.Windows.Forms.GroupBox gb_capture_volume;
private System.Windows.Forms.RadioButton rb_set_capture_volume;
private System.Windows.Forms.RadioButton rb_keep_capture_volume;
private System.Windows.Forms.Label lbl_capture_volume;
private System.Windows.Forms.NumericUpDown nud_capture_volume;
private System.Windows.Forms.Button btn_rescan_capture;
private System.Windows.Forms.ComboBox cb_capture_device;
private System.Windows.Forms.RadioButton rb_change_capture;
private System.Windows.Forms.RadioButton rb_no_change_capture;
private System.Windows.Forms.GroupBox gb_audio_settings;
private System.Windows.Forms.GroupBox gb_audio_volume; private System.Windows.Forms.GroupBox gb_audio_volume;
private System.Windows.Forms.RadioButton rb_set_audio_volume; private System.Windows.Forms.RadioButton rb_set_audio_volume;
private System.Windows.Forms.RadioButton rb_keep_audio_volume; private System.Windows.Forms.RadioButton rb_keep_audio_volume;
private System.Windows.Forms.Label lbl_audio_volume; private System.Windows.Forms.Label lbl_audio_volume;
private System.Windows.Forms.NumericUpDown nud_audio_volume; private System.Windows.Forms.NumericUpDown nud_audio_volume;
private System.Windows.Forms.Button btn_rescan_audio;
private System.Windows.Forms.ComboBox cb_audio_device;
private System.Windows.Forms.RadioButton rb_change_audio;
private System.Windows.Forms.RadioButton rb_no_change_audio;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton rb_switch_capture_permanent;
private System.Windows.Forms.RadioButton rb_switch_capture_temp;
} }
} }

View File

@ -27,11 +27,16 @@ namespace DisplayMagician.UIForms
private Executable _executableToUse; private Executable _executableToUse;
private ShortcutPermanence _displayPermanence = ShortcutPermanence.Temporary; private ShortcutPermanence _displayPermanence = ShortcutPermanence.Temporary;
private ShortcutPermanence _audioPermanence = ShortcutPermanence.Temporary; private ShortcutPermanence _audioPermanence = ShortcutPermanence.Temporary;
private ShortcutPermanence _capturePermanence = ShortcutPermanence.Temporary;
List<StartProgram> _startPrograms = new List<StartProgram>(); List<StartProgram> _startPrograms = new List<StartProgram>();
private string _audioDevice = ""; private string _audioDevice = "";
private bool _changeAudioDevice = false; private bool _changeAudioDevice = false;
private bool _setAudioVolume = false; private bool _setAudioVolume = false;
private decimal _audioVolume = -1; private decimal _audioVolume = -1;
private string _captureDevice = "";
private bool _changeCaptureDevice = false;
private bool _setCaptureVolume = false;
private decimal _captureVolume = -1;
private ShortcutItem _shortcutToEdit = null; private ShortcutItem _shortcutToEdit = null;
List<Game> allGames = new List<Game>(); List<Game> allGames = new List<Game>();
private bool _isUnsaved = true; private bool _isUnsaved = true;
@ -43,6 +48,9 @@ namespace DisplayMagician.UIForms
private List<CoreAudioDevice> audioDevices = null; private List<CoreAudioDevice> audioDevices = null;
private CoreAudioDevice selectedAudioDevice = null; private CoreAudioDevice selectedAudioDevice = null;
private bool audioVolumeSetToDefault = true; private bool audioVolumeSetToDefault = true;
private List<CoreAudioDevice> captureDevices = null;
private CoreAudioDevice selectedCaptureDevice = null;
private bool captureVolumeSetToDefault = true;
public ShortcutForm(ShortcutItem shortcutToEdit) public ShortcutForm(ShortcutItem shortcutToEdit)
{ {
@ -386,6 +394,31 @@ namespace DisplayMagician.UIForms
_audioVolume = -1; _audioVolume = -1;
} }
// Save the Capture features
if (rb_change_capture.Checked)
{
_changeCaptureDevice = true;
_captureDevice = cb_capture_device.Text;
}
else
{
_changeCaptureDevice = false;
_captureDevice = "";
}
if (rb_set_capture_volume.Checked)
{
_setCaptureVolume = true;
_captureVolume = nud_capture_volume.Value;
}
else
{
_setCaptureVolume = false;
_captureVolume = -1;
}
// Check the audio permanence requirements // Check the audio permanence requirements
if (rb_switch_audio_temp.Checked) if (rb_switch_audio_temp.Checked)
_audioPermanence = ShortcutPermanence.Temporary; _audioPermanence = ShortcutPermanence.Temporary;
@ -400,6 +433,13 @@ namespace DisplayMagician.UIForms
if (rb_switch_display_permanent.Checked) if (rb_switch_display_permanent.Checked)
_displayPermanence = ShortcutPermanence.Permanent; _displayPermanence = ShortcutPermanence.Permanent;
// Check the microphone permanence requirements
if (rb_switch_capture_temp.Checked)
_capturePermanence = ShortcutPermanence.Temporary;
if (rb_switch_capture_permanent.Checked)
_capturePermanence = ShortcutPermanence.Permanent;
// Save the start program 1 // Save the start program 1
StartProgram myStartProgram = new StartProgram(); StartProgram myStartProgram = new StartProgram();
myStartProgram.Priority = 1; myStartProgram.Priority = 1;
@ -457,9 +497,16 @@ namespace DisplayMagician.UIForms
_gameToUse, _gameToUse,
_displayPermanence, _displayPermanence,
_audioPermanence, _audioPermanence,
_capturePermanence,
_gameToUse.GameToPlay.IconPath, _gameToUse.GameToPlay.IconPath,
_changeAudioDevice,
_audioDevice, _audioDevice,
_setAudioVolume,
_audioVolume, _audioVolume,
_changeCaptureDevice,
_captureDevice,
_setCaptureVolume,
_captureVolume,
_startPrograms, _startPrograms,
_autoName, _autoName,
_uuid _uuid
@ -482,9 +529,16 @@ namespace DisplayMagician.UIForms
_gameToUse, _gameToUse,
_displayPermanence, _displayPermanence,
_audioPermanence, _audioPermanence,
_capturePermanence,
_gameToUse.GameToPlay.IconPath, _gameToUse.GameToPlay.IconPath,
_changeAudioDevice,
_audioDevice, _audioDevice,
_setAudioVolume,
_audioVolume, _audioVolume,
_changeCaptureDevice,
_captureDevice,
_setCaptureVolume,
_captureVolume,
_startPrograms, _startPrograms,
_autoName, _autoName,
_uuid _uuid
@ -516,9 +570,16 @@ namespace DisplayMagician.UIForms
_executableToUse, _executableToUse,
_displayPermanence, _displayPermanence,
_audioPermanence, _audioPermanence,
_capturePermanence,
_executableToUse.ExecutableNameAndPath, _executableToUse.ExecutableNameAndPath,
_changeAudioDevice,
_audioDevice, _audioDevice,
_setAudioVolume,
_audioVolume, _audioVolume,
_changeCaptureDevice,
_captureDevice,
_setCaptureVolume,
_captureVolume,
_startPrograms, _startPrograms,
_autoName _autoName
); );
@ -532,9 +593,16 @@ namespace DisplayMagician.UIForms
_profileToUse, _profileToUse,
_displayPermanence, _displayPermanence,
_audioPermanence, _audioPermanence,
_capturePermanence,
_executableToUse.ExecutableNameAndPath, _executableToUse.ExecutableNameAndPath,
_changeAudioDevice,
_audioDevice, _audioDevice,
_setAudioVolume,
_audioVolume, _audioVolume,
_changeCaptureDevice,
_captureDevice,
_setCaptureVolume,
_captureVolume,
_startPrograms, _startPrograms,
_autoName _autoName
); );
@ -730,9 +798,15 @@ namespace DisplayMagician.UIForms
selectedAudioDevice = audioDevice; selectedAudioDevice = audioDevice;
cb_audio_device.SelectedIndex = index; cb_audio_device.SelectedIndex = index;
if (_shortcutToEdit.SetAudioVolume && _shortcutToEdit.AudioVolume >= 0 && _shortcutToEdit.AudioVolume <= 100) if (_shortcutToEdit.SetAudioVolume && _shortcutToEdit.AudioVolume >= 0 && _shortcutToEdit.AudioVolume <= 100)
{
nud_audio_volume.Value = _shortcutToEdit.AudioVolume; nud_audio_volume.Value = _shortcutToEdit.AudioVolume;
rb_set_audio_volume.Checked = true;
}
else else
{
nud_audio_volume.Value = Convert.ToDecimal(audioDevice.Volume); nud_audio_volume.Value = Convert.ToDecimal(audioDevice.Volume);
rb_set_audio_volume.Checked = false;
}
} }
} }
} }
@ -781,6 +855,89 @@ namespace DisplayMagician.UIForms
rb_keep_audio_volume.Checked = true; rb_keep_audio_volume.Checked = true;
} }
// Populate all the Capture devices in the capture devices list.
// Set the Capture device to the shortcut capture device only if
// the Change Capture radiobutton is set
rb_change_capture.Checked = _shortcutToEdit.ChangeCaptureDevice;
cb_capture_device.Items.Clear();
captureDevices = audioController.GetCaptureDevices().ToList();
// If the shortcut is to change the capture device
if (_shortcutToEdit.ChangeCaptureDevice)
{
// Then we need to populate the list
bool foundCaptureDevice = false;
foreach (CoreAudioDevice captureDevice in captureDevices)
{
if (captureDevice.State == AudioSwitcher.AudioApi.DeviceState.Active)
{
int index = cb_capture_device.Items.Add(captureDevice.FullName);
// Set the capture device to the default device by default
if (captureDevice.FullName.Equals(_shortcutToEdit.CaptureDevice))
{
foundCaptureDevice = true;
selectedCaptureDevice = captureDevice;
cb_capture_device.SelectedIndex = index;
if (_shortcutToEdit.SetCaptureVolume && _shortcutToEdit.CaptureVolume >= 0 && _shortcutToEdit.CaptureVolume <= 100)
{
nud_capture_volume.Value = _shortcutToEdit.CaptureVolume;
rb_set_capture_volume.Checked = true;
}
else
{
nud_capture_volume.Value = Convert.ToDecimal(captureDevice.Volume);
rb_set_capture_volume.Checked = false;
}
}
}
}
// We need to handle the edgecase where the selected capture device
// isn't currently plugged in. We don't want to break the shortcut
// as it could be plugged in when it comes time to actually run
// the shortcut, so we need to just add it to the list to not break
// the UI.
if (!foundCaptureDevice)
{
int index = cb_capture_device.Items.Add(_shortcutToEdit.CaptureDevice);
cb_capture_device.SelectedIndex = index;
selectedCaptureDevice = null;
if (_shortcutToEdit.SetCaptureVolume && _shortcutToEdit.CaptureVolume >= 0 && _shortcutToEdit.CaptureVolume <= 100)
{
rb_set_capture_volume.Checked = true;
nud_capture_volume.Value = _shortcutToEdit.CaptureVolume;
}
else
{
rb_keep_capture_volume.Checked = true;
nud_capture_volume.Value = 50;
}
}
}
else
{
captureVolumeSetToDefault = true;
// Then we need to populate the list
foreach (CoreAudioDevice captureDevice in captureDevices)
{
if (captureDevice.State == AudioSwitcher.AudioApi.DeviceState.Active)
{
int index = cb_capture_device.Items.Add(captureDevice.FullName);
// Set the capture device to the default device by default
if (captureDevice.IsDefaultDevice)
{
selectedCaptureDevice = captureDevice;
cb_capture_device.SelectedIndex = index;
nud_capture_volume.Value = Convert.ToDecimal(captureDevice.Volume);
}
}
}
rb_keep_capture_volume.Checked = true;
}
// Populate a full list of games // Populate a full list of games
// Start with the Steam Games // Start with the Steam Games
allGames = new List<Game>(); allGames = new List<Game>();
@ -920,6 +1077,16 @@ namespace DisplayMagician.UIForms
break; break;
} }
switch (_shortcutToEdit.CapturePermanence)
{
case ShortcutPermanence.Permanent:
rb_switch_capture_permanent.Checked = true;
break;
case ShortcutPermanence.Temporary:
rb_switch_capture_temp.Checked = true;
break;
}
// Set the launcher items if we have them // Set the launcher items if we have them
txt_game_launcher.Text = _shortcutToEdit.GameLibrary.ToString(); txt_game_launcher.Text = _shortcutToEdit.GameLibrary.ToString();
txt_game_name.Text = _shortcutToEdit.GameName; txt_game_name.Text = _shortcutToEdit.GameName;
@ -1550,6 +1717,27 @@ namespace DisplayMagician.UIForms
} }
} }
private void rb_switch_audio_temp_CheckedChanged(object sender, EventArgs e)
{
if (rb_switch_audio_temp.Checked)
{
if (_loadedShortcut)
_isUnsaved = true;
rb_switch_audio_permanent.Checked = false;
}
}
private void rb_switch_audio_permanent_CheckedChanged(object sender, EventArgs e)
{
if (rb_switch_audio_permanent.Checked)
{
if (_loadedShortcut)
_isUnsaved = true;
rb_switch_audio_temp.Checked = false;
}
}
private void cb_audio_device_SelectedIndexChanged(object sender, EventArgs e) private void cb_audio_device_SelectedIndexChanged(object sender, EventArgs e)
{ {
if (_loadedShortcut) if (_loadedShortcut)
@ -1561,8 +1749,7 @@ namespace DisplayMagician.UIForms
audioDevices = audioController.GetPlaybackDevices().ToList(); audioDevices = audioController.GetPlaybackDevices().ToList();
// If the shortcut is to change the audio device // If the shortcut is to change the audio device
if (_shortcutToEdit.ChangeAudioDevice)
{
// Then we need to populate the list // Then we need to populate the list
bool foundAudioDevice = false; bool foundAudioDevice = false;
foreach (CoreAudioDevice audioDevice in audioDevices) foreach (CoreAudioDevice audioDevice in audioDevices)
@ -1588,27 +1775,7 @@ namespace DisplayMagician.UIForms
if (!foundAudioDevice) if (!foundAudioDevice)
{ {
selectedAudioDevice = null; selectedAudioDevice = null;
nud_audio_volume.Value = _shortcutToEdit.AudioVolume; nud_audio_volume.Value = 50;
}
}
else
{
audioVolumeSetToDefault = true;
// Then we need to populate the list
foreach (CoreAudioDevice audioDevice in audioDevices)
{
if (audioDevice.State == AudioSwitcher.AudioApi.DeviceState.Active)
{
int index = cb_audio_device.Items.Add(audioDevice.FullName);
// Set the audio device to the default device by default
if (audioDevice.IsDefaultDevice)
{
selectedAudioDevice = audioDevice;
nud_audio_volume.Value = Convert.ToDecimal(audioDevice.Volume);
}
}
}
rb_keep_audio_volume.Checked = true;
} }
} }
@ -1709,5 +1876,193 @@ namespace DisplayMagician.UIForms
nud_audio_volume.Enabled = true; nud_audio_volume.Enabled = true;
} }
private void btn_rescan_capture_Click(object sender, EventArgs e)
{
// Populate all the Capture devices in the capture devices list.
// Set the capture device to the shortcut capture device only if
// the Change capture radiobutton is set
rb_change_capture.Checked = _shortcutToEdit.ChangeCaptureDevice;
cb_capture_device.Items.Clear();
captureDevices = audioController.GetCaptureDevices().ToList();
// If the shortcut is to change the capture device
if (_shortcutToEdit.ChangeCaptureDevice)
{
// Then we need to populate the list
bool foundCaptureDevice = false;
foreach (CoreAudioDevice captureDevice in captureDevices)
{
if (captureDevice.State == AudioSwitcher.AudioApi.DeviceState.Active)
{
int index = cb_capture_device.Items.Add(captureDevice.FullName);
// Set the capture device to the default device by default
if (captureDevice.FullName.Equals(_shortcutToEdit.CaptureDevice))
{
foundCaptureDevice = true;
selectedCaptureDevice = captureDevice;
cb_capture_device.SelectedIndex = index;
if (_shortcutToEdit.SetCaptureVolume && _shortcutToEdit.CaptureVolume >= 0 && _shortcutToEdit.CaptureVolume <= 100)
nud_capture_volume.Value = _shortcutToEdit.CaptureVolume;
else
nud_capture_volume.Value = Convert.ToDecimal(captureDevice.Volume);
}
}
}
// We need to handle the edgecase where the selected capture device
// isn't currently plugged in. We don't want to break the shortcut
// as it could be plugged in when it comes time to actually run
// the shortcut, so we need to just add it to the list to not break
// the UI.
if (!foundCaptureDevice)
{
int index = cb_capture_device.Items.Add(_shortcutToEdit.CaptureDevice);
cb_capture_device.SelectedIndex = index;
selectedCaptureDevice = null;
if (_shortcutToEdit.SetCaptureVolume && _shortcutToEdit.CaptureVolume >= 0 && _shortcutToEdit.CaptureVolume <= 100)
{
rb_set_capture_volume.Checked = true;
nud_capture_volume.Value = _shortcutToEdit.CaptureVolume;
}
else
{
rb_keep_capture_volume.Checked = true;
nud_capture_volume.Value = 50;
}
}
}
else
{
captureVolumeSetToDefault = true;
// Then we need to populate the list
foreach (CoreAudioDevice captureDevice in captureDevices)
{
if (captureDevice.State == AudioSwitcher.AudioApi.DeviceState.Active)
{
int index = cb_capture_device.Items.Add(captureDevice.FullName);
// Set the capture device to the default device by default
if (captureDevice.IsDefaultDevice)
{
selectedCaptureDevice = captureDevice;
cb_capture_device.SelectedIndex = index;
nud_capture_volume.Value = Convert.ToDecimal(captureDevice.Volume);
}
}
}
rb_keep_capture_volume.Checked = true;
}
}
private void cb_capture_device_SelectedIndexChanged(object sender, EventArgs e)
{
if (_loadedShortcut)
_isUnsaved = true;
// Populate all the Capture devices in the capture devices list.
// Set the Capture device to the shortcut capture device only if
// the Change Capture radiobutton is set
captureDevices = audioController.GetCaptureDevices().ToList();
// Then we need to populate the list
bool foundCaptureDevice = false;
foreach (CoreAudioDevice captureDevice in captureDevices)
{
if (captureDevice.State == AudioSwitcher.AudioApi.DeviceState.Active)
{
// Set the capture device to the default device by default
if (captureDevice.FullName.Equals(cb_capture_device.SelectedItem.ToString()))
{
foundCaptureDevice = true;
selectedCaptureDevice = captureDevice;
nud_capture_volume.Value = Convert.ToDecimal(captureDevice.Volume);
}
}
}
// We need to handle the edgecase where the selected capture device
// isn't currently plugged in. We don't want to break the shortcut
// as it could be plugged in when it comes time to actually run
// the shortcut, so we need to just add it to the list to not break
// the UI.
if (!foundCaptureDevice)
{
selectedCaptureDevice = null;
nud_capture_volume.Value = 50;
}
}
private void rb_no_change_capture_CheckedChanged(object sender, EventArgs e)
{
if (rb_no_change_capture.Checked)
{
if (_loadedShortcut)
_isUnsaved = true;
cb_capture_device.Enabled = false;
btn_rescan_capture.Enabled = false;
gb_capture_volume.Visible = false;
}
}
private void rb_change_capture_CheckedChanged(object sender, EventArgs e)
{
if (rb_change_capture.Checked)
{
if (_loadedShortcut)
_isUnsaved = true;
cb_capture_device.Enabled = true;
btn_rescan_capture.Enabled = true;
gb_capture_volume.Visible = true;
}
}
private void rb_keep_capture_volume_CheckedChanged(object sender, EventArgs e)
{
if (_loadedShortcut)
_isUnsaved = true;
if (rb_set_capture_volume.Checked)
nud_capture_volume.Enabled = false;
}
private void rb_set_capture_volume_CheckedChanged(object sender, EventArgs e)
{
if (_loadedShortcut)
_isUnsaved = true;
if (rb_set_capture_volume.Checked)
nud_capture_volume.Enabled = true;
}
private void rb_switch_capture_temp_CheckedChanged(object sender, EventArgs e)
{
if (rb_switch_capture_temp.Checked)
{
if (_loadedShortcut)
_isUnsaved = true;
rb_switch_capture_permanent.Checked = false;
}
}
private void rb_switch_capture_permanent_CheckedChanged(object sender, EventArgs e)
{
if (rb_switch_capture_permanent.Checked)
{
if (_loadedShortcut)
_isUnsaved = true;
rb_switch_capture_temp.Checked = false;
}
}
private void nud_audio_volume_ValueChanged(object sender, EventArgs e)
{
_audioVolume = Convert.ToDecimal(nud_audio_volume.Value);
}
private void nud_capture_volume_ValueChanged(object sender, EventArgs e)
{
_captureVolume = Convert.ToDecimal(nud_capture_volume.Value);
}
} }
} }