Skip to content

[Feature request] IVolumeGettable #16

Open
@lcnvdl

Description

@lcnvdl

Hi!

For some stuff I'm developing, I added this interface. I was wondering if you can add it to the official version (if you consider that can be useful).

Thanks in advance.

New interface:

namespace Ami.BroAudio
{
  public interface IVolumeGettable
  {
    internal float GetVolume();
  }
}

Implemented in IAudioPlayer:

public interface IAudioPlayer : IEffectDecoratable, IVolumeGettable, IVolumeSettable, IMusicDecoratable, IAudioStoppable, ISchedulable
 {
...
}

In Audio Player:

        float IVolumeGettable.GetVolume()
        {
          return _trackVolume.Current;
        }

In EmptyInstance:

float IVolumeGettable.GetVolume() => 0f;

In AudioPlayerInstanceWrapper

 float IVolumeGettable.GetVolume() => IsAvailable() ? Instance.GetVolume() : 0f;

And finally in BroAudioChainingMethod (I couldn't find another extension class for Audio Player, I know is not the right place):

    /// <inheritdoc cref="GetVolume(IAudioPlayer)"/>
    public static float GetVolume(this IAudioPlayer player)
        => player == null ? 0f : player.GetVolume();

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions