playSound method

int playSound(
  1. Sound sound, {
  2. int channel = -1,
  3. bool loop = false,
  4. double? loopStart,
  5. double? loopEnd,
})

Plays the given Sound.

Returns the channel ID on which the sound is playing, or -1 if it could not be played.

Implementation

int playSound(Sound sound, {int channel = -1, bool loop = false, double? loopStart, double? loopEnd}) {
  var targetChannels = (channel == -1) ? _allChannels : [channel];
  return playSoundOnTargetChannels(sound, targetChannels: targetChannels, loop: loop, loopStart: loopStart, loopEnd: loopEnd);
}