Cross Platform Application to allow control with a MIDI controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
855 B

// Author: Gockner, Simon
// Created: 2021-04-07
// Copyright(c) 2021 SimonG. All Rights Reserved.
using Lib.Audio.Interfaces;
using NAudio.CoreAudioApi;
namespace Lib.Audio
{
public class Controllable : IControllable
{
private readonly AudioSessionControl _audioSessionControl;
private readonly string _name;
public Controllable(AudioSessionControl audioSessionControl, string name)
{
_audioSessionControl = audioSessionControl;
_name = name;
}
public void SetVolume(float volume) => _audioSessionControl.SimpleAudioVolume.Volume = volume;
public void Mute() => _audioSessionControl.SimpleAudioVolume.Mute = true;
public void UnMute() => _audioSessionControl.SimpleAudioVolume.Mute = false;
public override string ToString() => _name;
}
}