···1+// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2+// See the LICENCE file in the repository root for full licence text.
3+4+using osu.Framework.Audio.Track;
5+6+namespace osu.Framework.Audio
7+{
8+ public interface IHasAmplitudes
9+ {
10+ /// <summary>
11+ /// Current amplitude of stereo channels where 1 is full volume and 0 is silent.
12+ /// LeftChannel and RightChannel represent the maximum current amplitude of all of the left and right channels respectively.
13+ /// The most recent values are returned. Synchronisation between channels should not be expected.
14+ /// </summary>
15+ ChannelAmplitudes CurrentAmplitudes { get; }
16+ }
17+}
+1-1
osu.Framework/Audio/Sample/ISampleChannel.cs
···6 /// <summary>
7 /// A channel playing back an audio sample.
8 /// </summary>
9- public interface ISampleChannel
10 {
11 /// <summary>
12 /// Start playback.
···6 /// <summary>
7 /// A channel playing back an audio sample.
8 /// </summary>
9+ public interface ISampleChannel : IHasAmplitudes
10 {
11 /// <summary>
12 /// Start playback.
-5
osu.Framework/Audio/Sample/SampleChannel.cs
···5455 public override bool IsAlive => base.IsAlive && !Played;
5657- /// <summary>
58- /// Current amplitude of stereo channels where 1 is full volume and 0 is silent.
59- /// LeftChannel and RightChannel represent the maximum current amplitude of all of the left and right channels respectively.
60- /// The most recent values are returned. Synchronisation between channels should not be expected.
61- /// </summary>
62 public virtual ChannelAmplitudes CurrentAmplitudes { get; } = new ChannelAmplitudes();
63 }
64}
···5455 public override bool IsAlive => base.IsAlive && !Played;
560000057 public virtual ChannelAmplitudes CurrentAmplitudes { get; } = new ChannelAmplitudes();
58 }
59}
+1-1
osu.Framework/Audio/Track/ITrack.cs
···6 /// <summary>
7 /// An audio track.
8 /// </summary>
9- public interface ITrack
10 {
11 /// <summary>
12 /// States if this track should repeat.
···6 /// <summary>
7 /// An audio track.
8 /// </summary>
9+ public interface ITrack : IHasAmplitudes
10 {
11 /// <summary>
12 /// States if this track should repeat.
-5
osu.Framework/Audio/Track/Track.cs
···112113 public override bool HasCompleted => IsLoaded && !IsRunning && CurrentTime >= Length;
114115- /// <summary>
116- /// Current amplitude of stereo channels where 1 is full volume and 0 is silent.
117- /// LeftChannel and RightChannel represent the maximum current amplitude of all of the left and right channels respectively.
118- /// The most recent values are returned. Synchronisation between channels should not be expected.
119- /// </summary>
120 public virtual ChannelAmplitudes CurrentAmplitudes { get; } = new ChannelAmplitudes();
121122 protected override void UpdateState()
···112113 public override bool HasCompleted => IsLoaded && !IsRunning && CurrentTime >= Length;
11400000115 public virtual ChannelAmplitudes CurrentAmplitudes { get; } = new ChannelAmplitudes();
116117 protected override void UpdateState()
+3
osu.Framework/Graphics/Audio/DrawableSample.cs
···2// See the LICENCE file in the repository root for full licence text.
34using osu.Framework.Audio.Sample;
056namespace osu.Framework.Graphics.Audio
7{
···36 get => channel.Looping;
37 set => channel.Looping = value;
38 }
0039 }
40}
···2// See the LICENCE file in the repository root for full licence text.
34using osu.Framework.Audio.Sample;
5+using osu.Framework.Audio.Track;
67namespace osu.Framework.Graphics.Audio
8{
···37 get => channel.Looping;
38 set => channel.Looping = value;
39 }
40+41+ public ChannelAmplitudes CurrentAmplitudes => channel.CurrentAmplitudes;
42 }
43}
+2
osu.Framework/Graphics/Audio/DrawableTrack.cs
···56 public void Start() => track.Start();
5758 public void Stop() => track.Stop();
0059 }
60}
···56 public void Start() => track.Start();
5758 public void Stop() => track.Stop();
59+60+ public ChannelAmplitudes CurrentAmplitudes => track.CurrentAmplitudes;
61 }
62}