A game framework written with osu! in mind.
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
4using osu.Framework.Bindables;
5
6namespace osu.Framework.Audio.Sample
7{
8 /// <summary>
9 /// An interface for an audio sample.
10 /// </summary>
11 public interface ISample : IAdjustableAudioComponent
12 {
13 /// <summary>
14 /// The length in milliseconds of this <see cref="ISample"/>.
15 /// </summary>
16 double Length { get; }
17
18 /// <summary>
19 /// The number of times this sample (as identified by name) can be played back concurrently.
20 /// </summary>
21 /// <remarks>
22 /// This affects all <see cref="ISample"/> instances identified by the same sample name.
23 /// </remarks>
24 Bindable<int> PlaybackConcurrency { get; }
25
26 /// <summary>
27 /// Creates a new unique playback channel for this <see cref="ISample"/> and immediately plays it.
28 /// </summary>
29 /// <remarks>
30 /// Multiple channels can be played simultaneously, but can only be heard up to <see cref="PlaybackConcurrency"/> times.
31 /// </remarks>
32 /// <returns>The unique <see cref="SampleChannel"/> for the playback.</returns>
33 SampleChannel Play();
34
35 /// <summary>
36 /// Retrieves a unique playback channel for this <see cref="ISample"/>.
37 /// </summary>
38 /// <remarks>
39 /// Multiple channels can be retrieved and played simultaneously, but can only be heard up to <see cref="PlaybackConcurrency"/> times.
40 /// </remarks>
41 /// <returns>The unique <see cref="SampleChannel"/> for the playback.</returns>
42 SampleChannel GetChannel();
43 }
44}