2021-02-21 14:04:24 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-02-24 09:05:11 +01:00
|
|
|
|
using System.Threading.Tasks;
|
2021-03-06 10:53:38 +01:00
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.GetDefault;
|
2021-02-24 19:35:01 +01:00
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.GetMuted;
|
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.GetVolume;
|
2021-03-06 10:53:38 +01:00
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.SetDefault;
|
2021-02-24 19:35:01 +01:00
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.SetMuted;
|
|
|
|
|
using MassiveKnob.Plugin.CoreAudio.SetVolume;
|
2021-02-21 14:04:24 +01:00
|
|
|
|
|
|
|
|
|
namespace MassiveKnob.Plugin.CoreAudio
|
|
|
|
|
{
|
|
|
|
|
[MassiveKnobPlugin]
|
|
|
|
|
public class MassiveKnobCoreAudioPlugin : IMassiveKnobActionPlugin
|
|
|
|
|
{
|
|
|
|
|
public Guid PluginId { get; } = new Guid("eaa5d3f8-8f9b-4a4b-8e29-827228d23e95");
|
2021-02-24 19:35:01 +01:00
|
|
|
|
public string Name { get; } = Strings.PluginName;
|
|
|
|
|
public string Description { get; } = Strings.PluginDescription;
|
2021-02-21 14:04:24 +01: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 19:35:01 +01:00
|
|
|
|
new DeviceSetVolumeAction(),
|
|
|
|
|
new DeviceGetVolumeAction(),
|
2021-03-06 10:53:38 +01:00
|
|
|
|
|
2021-02-24 19:35:01 +01:00
|
|
|
|
new DeviceSetMutedAction(),
|
2021-03-06 10:53:38 +01:00
|
|
|
|
new DeviceGetMutedAction(),
|
|
|
|
|
|
|
|
|
|
new DeviceSetDefaultAction(),
|
|
|
|
|
new DeviceGetDefaultAction()
|
2021-02-21 14:04:24 +01:00
|
|
|
|
};
|
2021-02-24 09:05:11 +01: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 14:04:24 +01:00
|
|
|
|
}
|
|
|
|
|
}
|