Otter  0.9.8.91
2d Game Development Framework based on SFML.Net
 All Classes Namespaces Functions Variables Enumerations Properties
Otter.Sound Class Reference

Class used to play a sound from a file or an IO Stream. Sounds are cached if loaded from a file. More...

Public Member Functions

 Sound (string source, bool loop=false)
 Load a new sound from a filepath. If this file has been used before it will be loaded from the cache. More...
 
 Sound (Stream stream, bool loop=false)
 Load a new sound from an IO Stream. More...
 
 Sound (Sound sound)
 Load a new sound from copying another sound. More...
 
void Play ()
 Play the sound. More...
 
void Stop ()
 Stop the sound. More...
 
void Pause ()
 Pause the sound. More...
 
void CenterSound (float x, float y, float z)
 Centers the sound at the given position. More...
 
void CenterSound (float x, float y)
 Centers the sound at the given position. More...
 
void CenterSound (Vector3 position)
 Centers the sound at the given position. More...
 
void CenterSound (Vector2 position)
 Centers the sound at the given position. More...
 

Static Public Member Functions

static void CenterListener (float x, float y, float z)
 Centers the Listener at the given position. More...
 
static void CenterListener (float x, float y)
 Centers the Listener at the given position. More...
 
static void CenterListener (Vector3 position)
 Centers the Listener at the given position. More...
 
static void CenterListener (Vector2 position)
 Centers the Listener at the given position. More...
 
static void PointListener (float x, float y, float z)
 Points the Listener in the given direction. More...
 
static void PointListener (float x, float y)
 Points the Listener in the given direction. More...
 
static void PointListener (Vector3 direction)
 Points the Listener in the given direction. More...
 
static void PointListener (Vector2 direction)
 Points the Listener in the given direction. More...
 

Public Attributes

float Volume = 1f
 The local volume of this sound. More...
 

Properties

static float GlobalVolume [get, set]
 The global volume of all sounds. More...
 
static Vector3 ListenerPosition [get, set]
 Where the Listener is in 3D space. More...
 
static float ListenerX [get, set]
 The Listener's X position. More...
 
static float ListenerY [get, set]
 The Listener's Y position. More...
 
static float ListenerZ [get, set]
 The Listener's Z position. More...
 
static Vector3 ListenerDirection [get, set]
 What direction the Listener is pointing. Should be a unit vector. More...
 
float Pitch [get, set]
 Adjust the pitch of the sound. Default value is 1. More...
 
int Offset [get, set]
 The playback offset of the sound in milliseconds. More...
 
bool Loop [get, set]
 Determines if the sound should loop or not. More...
 
int Duration [get]
 The duration of the sound in milliseconds. More...
 
bool RelativeToListener [get, set]
 Whether or not the sound plays relative to the Listener position. Only mono sounds are able to be spatial. More...
 
Vector3 Position [get, set]
 Where the sound is in 3D space. More...
 
float X [get, set]
 The sound's X position. More...
 
float Y [get, set]
 The sound's Y position. More...
 
float Z [get, set]
 The sound's Z position. More...
 
float Attenuation [get, set]
 The sound's attenuation factor. Determines how the sound fades over distance. More...
 
float MinimumDistance [get, set]
 The minimum distance to hear the sound at max volume. Past this distance the sound is faded according to it's attenuation. 0 is an invalid value. More...
 
bool IsPlaying [get]
 Check if the Sound is currently playing. More...
 

Detailed Description

Class used to play a sound from a file or an IO Stream. Sounds are cached if loaded from a file.

Constructor & Destructor Documentation

Otter.Sound.Sound ( string  source,
bool  loop = false 
)

Load a new sound from a filepath. If this file has been used before it will be loaded from the cache.

Parameters
sourceThe path to the sound file.
loopDetermines if the sound should loop.
Otter.Sound.Sound ( Stream  stream,
bool  loop = false 
)

Load a new sound from an IO Stream.

Parameters
streamThe memory stream of the sound data.
loopDetermines if the sound should loop.
Otter.Sound.Sound ( Sound  sound)

Load a new sound from copying another sound.

Parameters
soundThe sound to copy from.

Member Function Documentation

static void Otter.Sound.CenterListener ( float  x,
float  y,
float  z 
)
static

Centers the Listener at the given position.

Parameters
x
y
z
static void Otter.Sound.CenterListener ( float  x,
float  y 
)
static

Centers the Listener at the given position.

Parameters
x
y
static void Otter.Sound.CenterListener ( Vector3  position)
static

Centers the Listener at the given position.

Parameters
position
static void Otter.Sound.CenterListener ( Vector2  position)
static

Centers the Listener at the given position.

Parameters
position
void Otter.Sound.CenterSound ( float  x,
float  y,
float  z 
)

Centers the sound at the given position.

Parameters
x
y
z
void Otter.Sound.CenterSound ( float  x,
float  y 
)

Centers the sound at the given position.

Parameters
x
y
void Otter.Sound.CenterSound ( Vector3  position)

Centers the sound at the given position.

Parameters
position
void Otter.Sound.CenterSound ( Vector2  position)

Centers the sound at the given position.

Parameters
position
void Otter.Sound.Pause ( )

Pause the sound.

void Otter.Sound.Play ( )

Play the sound.

static void Otter.Sound.PointListener ( float  x,
float  y,
float  z 
)
static

Points the Listener in the given direction.

Parameters
x
y
z
static void Otter.Sound.PointListener ( float  x,
float  y 
)
static

Points the Listener in the given direction.

Parameters
x
y
static void Otter.Sound.PointListener ( Vector3  direction)
static

Points the Listener in the given direction.

Parameters
direction
static void Otter.Sound.PointListener ( Vector2  direction)
static

Points the Listener in the given direction.

Parameters
direction
void Otter.Sound.Stop ( )

Stop the sound.

Member Data Documentation

float Otter.Sound.Volume = 1f

The local volume of this sound.

Property Documentation

float Otter.Sound.Attenuation
getset

The sound's attenuation factor. Determines how the sound fades over distance.

int Otter.Sound.Duration
get

The duration of the sound in milliseconds.

float Otter.Sound.GlobalVolume
staticgetset

The global volume of all sounds.

bool Otter.Sound.IsPlaying
get

Check if the Sound is currently playing.

Vector3 Otter.Sound.ListenerDirection
staticgetset

What direction the Listener is pointing. Should be a unit vector.

Vector3 Otter.Sound.ListenerPosition
staticgetset

Where the Listener is in 3D space.

float Otter.Sound.ListenerX
staticgetset

The Listener's X position.

float Otter.Sound.ListenerY
staticgetset

The Listener's Y position.

float Otter.Sound.ListenerZ
staticgetset

The Listener's Z position.

bool Otter.Sound.Loop
getset

Determines if the sound should loop or not.

float Otter.Sound.MinimumDistance
getset

The minimum distance to hear the sound at max volume. Past this distance the sound is faded according to it's attenuation. 0 is an invalid value.

int Otter.Sound.Offset
getset

The playback offset of the sound in milliseconds.

float Otter.Sound.Pitch
getset

Adjust the pitch of the sound. Default value is 1.

Vector3 Otter.Sound.Position
getset

Where the sound is in 3D space.

bool Otter.Sound.RelativeToListener
getset

Whether or not the sound plays relative to the Listener position. Only mono sounds are able to be spatial.

float Otter.Sound.X
getset

The sound's X position.

float Otter.Sound.Y
getset

The sound's Y position.

float Otter.Sound.Z
getset

The sound's Z position.


The documentation for this class was generated from the following file: