Dart DocumentationstagexlSound

Sound abstract class

abstract class Sound {

 Sound() {
   var initEngine = SoundMixer.engine;
 }

 static Future<Sound> load(String url, [SoundLoadOptions soundLoadOptions = null]) {

   switch(SoundMixer.engine) {
     case "WebAudioApi" : return WebAudioApiSound.load(url, soundLoadOptions);
     case "AudioElement": return AudioElementSound.load(url, soundLoadOptions);
     default            : return MockSound.load(url, soundLoadOptions);
   }
 }

 static SoundLoadOptions defaultLoadOptions = new SoundLoadOptions(mp3:true, mp4:true, ogg:true, wav:true);

 //-------------------------------------------------------------------------------------------------

 num get length;
 SoundChannel play([bool loop = false, SoundTransform soundTransform]);

}

Subclasses

AudioElementSound, MockSound, WebAudioApiSound

Static Properties

SoundLoadOptions defaultLoadOptions #

static SoundLoadOptions defaultLoadOptions = new SoundLoadOptions(mp3:true, mp4:true, ogg:true, wav:true)

Static Methods

Future<Sound> load(String url, [SoundLoadOptions soundLoadOptions = null]) #

static Future<Sound> load(String url, [SoundLoadOptions soundLoadOptions = null]) {

 switch(SoundMixer.engine) {
   case "WebAudioApi" : return WebAudioApiSound.load(url, soundLoadOptions);
   case "AudioElement": return AudioElementSound.load(url, soundLoadOptions);
   default            : return MockSound.load(url, soundLoadOptions);
 }
}

Constructors

new Sound() #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
Sound() {
 var initEngine = SoundMixer.engine;
}

Properties

final num length #

num get length;

Methods

abstract SoundChannel play([bool loop = false, SoundTransform soundTransform]) #