···11+// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
22+// See the LICENCE file in the repository root for full licence text.
33+44+using osu.Framework.Audio.Track;
55+66+namespace osu.Framework.Audio
77+{
88+ public interface IHasAmplitudes
99+ {
1010+ /// <summary>
1111+ /// Current amplitude of stereo channels where 1 is full volume and 0 is silent.
1212+ /// LeftChannel and RightChannel represent the maximum current amplitude of all of the left and right channels respectively.
1313+ /// The most recent values are returned. Synchronisation between channels should not be expected.
1414+ /// </summary>
1515+ ChannelAmplitudes CurrentAmplitudes { get; }
1616+ }
1717+}
+1-1
osu.Framework/Audio/Sample/ISampleChannel.cs
···66 /// <summary>
77 /// A channel playing back an audio sample.
88 /// </summary>
99- public interface ISampleChannel
99+ public interface ISampleChannel : IHasAmplitudes
1010 {
1111 /// <summary>
1212 /// Start playback.
-5
osu.Framework/Audio/Sample/SampleChannel.cs
···54545555 public override bool IsAlive => base.IsAlive && !Played;
56565757- /// <summary>
5858- /// Current amplitude of stereo channels where 1 is full volume and 0 is silent.
5959- /// LeftChannel and RightChannel represent the maximum current amplitude of all of the left and right channels respectively.
6060- /// The most recent values are returned. Synchronisation between channels should not be expected.
6161- /// </summary>
6257 public virtual ChannelAmplitudes CurrentAmplitudes { get; } = new ChannelAmplitudes();
6358 }
6459}
+1-1
osu.Framework/Audio/Track/ITrack.cs
···66 /// <summary>
77 /// An audio track.
88 /// </summary>
99- public interface ITrack
99+ public interface ITrack : IHasAmplitudes
1010 {
1111 /// <summary>
1212 /// States if this track should repeat.
-5
osu.Framework/Audio/Track/Track.cs
···112112113113 public override bool HasCompleted => IsLoaded && !IsRunning && CurrentTime >= Length;
114114115115- /// <summary>
116116- /// Current amplitude of stereo channels where 1 is full volume and 0 is silent.
117117- /// LeftChannel and RightChannel represent the maximum current amplitude of all of the left and right channels respectively.
118118- /// The most recent values are returned. Synchronisation between channels should not be expected.
119119- /// </summary>
120115 public virtual ChannelAmplitudes CurrentAmplitudes { get; } = new ChannelAmplitudes();
121116122117 protected override void UpdateState()
+3
osu.Framework/Graphics/Audio/DrawableSample.cs
···22// See the LICENCE file in the repository root for full licence text.
3344using osu.Framework.Audio.Sample;
55+using osu.Framework.Audio.Track;
5667namespace osu.Framework.Graphics.Audio
78{
···3637 get => channel.Looping;
3738 set => channel.Looping = value;
3839 }
4040+4141+ public ChannelAmplitudes CurrentAmplitudes => channel.CurrentAmplitudes;
3942 }
4043}
+2
osu.Framework/Graphics/Audio/DrawableTrack.cs
···5656 public void Start() => track.Start();
57575858 public void Stop() => track.Stop();
5959+6060+ public ChannelAmplitudes CurrentAmplitudes => track.CurrentAmplitudes;
5961 }
6062}