Bottle 2D - Lua API 1.0.0
All you need to create games using bottle2D.
Public Member Functions

Music Class Reference

A music. More...

#include <header.hpp>

List of all members.

Public Member Functions

 Music ()
 Default constructor.
nil LoadFromFile (string Filename)
 Open a music file (doesn't play it -- call Play() for that) Note: the working directory is the mode's root directory.
number GetDuration ()
 Get the music duration.
number GetChannelsCount ()
 Return the number of channels (1 = mono, 2 = stereo, ...)
nil Play ()
 Play the sound.
nil Pause ()
 Pause the sound.
nil Stop ()
 Stop the sound.
nil SetLoop (bool Loop)
 Set the sound loop state.
nil SetPitch (number Pitch)
 Set the sound pitch.
nil SetVolume (number Volume)
 Set the sound volume.
bool GetLoop ()
 Tell whether or not the sound is looping.
number GetPitch ()
 Get the pitch.
number GetVolume ()
 Get the volume.
number GetPlayingOffset ()
 Get the current playing position of the sound.
bool IsPlaying ()
 Return true if the music is playing.

Detailed Description

A music.

Note: a music is not attached to a screen. It can be played by itself.


Constructor & Destructor Documentation

Music::Music ( )

Default constructor.


Member Function Documentation

number Music::GetChannelsCount ( )

Return the number of channels (1 = mono, 2 = stereo, ...)

Returns:
Number of channels
number Music::GetDuration ( )

Get the music duration.

Returns:
Music duration, in seconds
bool Music::GetLoop ( )

Tell whether or not the sound is looping.

Returns:
True if the sound is looping, false otherwise
number Music::GetPitch ( )

Get the pitch.

Returns:
Pitch value
number Music::GetPlayingOffset ( )

Get the current playing position of the sound.

Returns:
Current playing position, expressed in seconds
number Music::GetVolume ( )

Get the volume.

Returns:
Volume value (in range [1, 100])
bool Music::IsPlaying ( )

Return true if the music is playing.

Returns:
Current status of the sound (playing or not)
nil Music::LoadFromFile ( string  Filename)

Open a music file (doesn't play it -- call Play() for that) Note: the working directory is the mode's root directory.

Parameters:
Filename: Path of the music file to open
Returns:
True if loading has been successful
nil Music::Pause ( )

Pause the sound.

nil Music::Play ( )

Play the sound.

nil Music::SetLoop ( bool  Loop)

Set the sound loop state.

This parameter is disabled by default

Parameters:
Loop: True to play in loop, false to play once
nil Music::SetPitch ( number  Pitch)

Set the sound pitch.

The default pitch is 1

Parameters:
Pitch: New pitch
nil Music::SetVolume ( number  Volume)

Set the sound volume.

The default volume is 100

Parameters:
Volume: Volume (in range [0, 100])
nil Music::Stop ( )

Stop the sound.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables