Skip to content

Commit 5d86fff

Browse files
taublastjfversluis
andauthored
Add fast-Play method to AudioMixer (#158)
* Add fast-Play method to AudioMixer * Update src/Plugin.Maui.Audio/AudioMixer/AudioMixer.cs --------- Co-authored-by: Gerald Versluis <[email protected]>
1 parent 7bb87ff commit 5d86fff

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Plugin.Maui.Audio/AudioMixer/AudioMixer.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ public AudioMixer(IAudioManager audioManager, int numberOfChannels)
7070
}
7171
}
7272

73+
/// <summary>
74+
/// Play an already prepared channel.
75+
/// </summary>
76+
/// <param name="channelIndex">The index of the channel to play the sound on.</param>
77+
/// <param name="loop">Indicates whether the audio should loop.</param>
78+
public void Play(int channelIndex, bool loop = false)
79+
{
80+
ValidateChannelIndex(channelIndex);
81+
var player = channels[channelIndex];
82+
player.Loop = loop;
83+
player.Play();
84+
}
85+
7386
/// <summary>
7487
/// Plays the specified audio clip on the given channel.
7588
/// </summary>

0 commit comments

Comments
 (0)