mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
Have multi-volume with recall ready for test. Pausing dependent on conversation with NYU
This commit is contained in:
@@ -317,6 +317,8 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Set volume control, using default if non provided
|
// Set volume control, using default if non provided
|
||||||
IBasicVolumeControls volDev = null;
|
IBasicVolumeControls volDev = null;
|
||||||
// Handle special cases for volume control
|
// Handle special cases for volume control
|
||||||
@@ -335,10 +337,26 @@ namespace PepperDash.Essentials
|
|||||||
volDev = (dev as IHasVolumeDevice).VolumeDevice;
|
volDev = (dev as IHasVolumeDevice).VolumeDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
if (volDev != CurrentVolumeControls)
|
||||||
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(0);
|
{
|
||||||
|
// zero the volume on the device we are leaving.
|
||||||
|
// Set the volume to default on device we are entering
|
||||||
|
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
||||||
|
{
|
||||||
|
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||||
|
SavedVolumeLevels[vd] = (uint)vd.VolumeLevelFeedback.IntValue;
|
||||||
|
vd.SetVolume(0);
|
||||||
|
}
|
||||||
|
CurrentVolumeControls = volDev;
|
||||||
|
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
||||||
|
{
|
||||||
|
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||||
|
ushort vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume);
|
||||||
|
vd.SetVolume(vol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CurrentVolumeControls = volDev;
|
|
||||||
|
|
||||||
// store the name and UI info for routes
|
// store the name and UI info for routes
|
||||||
if (item.SourceKey == "$off")
|
if (item.SourceKey == "$off")
|
||||||
|
|||||||
@@ -377,6 +377,8 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
// See if this can be moved into common, base-class method -------------
|
// See if this can be moved into common, base-class method -------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Set volume control, using default if non provided
|
// Set volume control, using default if non provided
|
||||||
IBasicVolumeControls volDev = null;
|
IBasicVolumeControls volDev = null;
|
||||||
// Handle special cases for volume control
|
// Handle special cases for volume control
|
||||||
@@ -395,23 +397,25 @@ namespace PepperDash.Essentials
|
|||||||
volDev = (dev as IHasVolumeDevice).VolumeDevice;
|
volDev = (dev as IHasVolumeDevice).VolumeDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
// zero the volume on the device we are leaving.
|
if (volDev != CurrentVolumeControls)
|
||||||
// Set the volume to default on device we are entering
|
|
||||||
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
|
||||||
{
|
{
|
||||||
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
// zero the volume on the device we are leaving.
|
||||||
SavedVolumeLevels[vd] = (uint)vd.VolumeLevelFeedback.IntValue;
|
// Set the volume to default on device we are entering
|
||||||
vd.SetVolume(0);
|
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
||||||
}
|
{
|
||||||
|
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||||
|
SavedVolumeLevels[vd] = (uint)vd.VolumeLevelFeedback.IntValue;
|
||||||
|
vd.SetVolume(0);
|
||||||
|
}
|
||||||
|
|
||||||
CurrentVolumeControls = volDev;
|
CurrentVolumeControls = volDev;
|
||||||
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
if (ZeroVolumeWhenSwtichingVolumeDevices && CurrentVolumeControls is IBasicVolumeWithFeedback)
|
||||||
{
|
{
|
||||||
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
var vd = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||||
ushort vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume);
|
ushort vol = (SavedVolumeLevels.ContainsKey(vd) ? (ushort)SavedVolumeLevels[vd] : DefaultVolume);
|
||||||
vd.SetVolume(vol);
|
vd.SetVolume(vol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user