sfml.audio
Sounds, streaming (musics or custom sources), recording, spatialization.
Attributes
Members list
Type members
Classlikes
Streamed music played from an audio file.
Streamed music played from an audio file.
Musics are sounds that are streamed rather than completely loaded in memory.
This is especially useful for compressed musics that usually take hundreds of MB when they are uncompressed: by streaming it instead of loading it entirely, you avoid saturating the memory and have almost no loading delay. This implies that the underlying resource (file, stream or memory buffer) must remain valid for the lifetime of the Music object.
As a sound stream, a music is played in its own thread in order not to block the rest of the program. This means that you can leave the music alone after calling play, it will manage itself very well.
// Declare a new music
val music = Music()
// Open it from an audio file
if !(music.openFromFile("music.ogg")) then
// error...
???
// Play it
music.play()
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SoundBuffer.type
Base class defining a sound's properties.
Base class defining a sound's properties.
SoundSource is not meant to be used directly, it only serves as a common base for all audio objects that can live in the audio environment.
Attributes
- See also
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SoundSource.type
Abstract base class for streamed audio sources.
Abstract base class for streamed audio sources.
Audio streams are never completely loaded in memory.
Instead, the audio data is acquired continuously while the stream is playing. This behavior allows to play a sound with no loading delay, and keeps the memory consumption very low.
SoundStream is a base class that doesn't care about the stream source, which is left to the derived class. SFML provides a built-in specialization for big files (see Music). No network stream source is provided, but you can write your own by combining this class with the network module.
It is important to note that each SoundStream is played in its own separate thread, so that the streaming loop doesn't block the rest of the program.
It is important to keep this in mind, because you may have to take care of synchronization issues if you share data between threads.
Attributes
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SoundStream.type
Enumeration of the sound source states.
Enumeration of the sound source states.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all