2021-02-21 13:04:24 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-02-24 08:05:11 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2021-02-24 18:35:01 +00:00
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.GetMuted;
|
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.GetVolume;
|
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.SetMuted;
|
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.SetVolume;
|
2021-02-21 13:04:24 +00:00
|
|
|
|
|
|
|
|
|
namespace MassiveKnob.Plugin.CoreAudio
|
|
|
|
|
{
|
|
|
|
|
[MassiveKnobPlugin]
|
|
|
|
|
public class MassiveKnobCoreAudioPlugin : IMassiveKnobActionPlugin
|
|
|
|
|
{
|
|
|
|
|
public Guid PluginId { get; } = new Guid("eaa5d3f8-8f9b-4a4b-8e29-827228d23e95");
|
2021-02-24 18:35:01 +00:00
|
|
|
|
public string Name { get; } = Strings.PluginName;
|
|
|
|
|
public string Description { get; } = Strings.PluginDescription;
|
2021-02-21 13:04:24 +00:00
|
|
|
|
public string Author { get; } = "Mark van Renswoude <mark@x2software.net>";
|
|
|
|
|
public string Url { get; } = "https://www.github.com/MvRens/MassiveKnob/";
|
|
|
|
|
|
|
|
|
|
public IEnumerable<IMassiveKnobAction> Actions { get; } = new IMassiveKnobAction[]
|
|
|
|
|
{
|
2021-02-24 18:35:01 +00:00
|
|
|
|
new DeviceSetVolumeAction(),
|
|
|
|
|
new DeviceGetVolumeAction(),
|
|
|
|
|
new DeviceSetMutedAction(),
|
|
|
|
|
new DeviceGetMutedAction()
|
2021-02-21 13:04:24 +00:00
|
|
|
|
};
|
2021-02-24 08:05:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MassiveKnobCoreAudioPlugin()
|
|
|
|
|
{
|
|
|
|
|
// My system suffers from this issue: https://github.com/xenolightning/AudioSwitcher/issues/40
|
|
|
|
|
// ...which causes the first call to the CoreAudioController to take up to 10 seconds,
|
|
|
|
|
// so initialise it as soon as possible. Bit of a workaround, but eh.
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
CoreAudioControllerInstance.Acquire();
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-02-21 13:04:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|