Playback audio from a sound file on disk.
More...
Inherits BStreamingGameSound.
Playback audio from a sound file on disk.
- Since
- BeOS R5
◆ BFileGameSound() [1/3]
| BFileGameSound::BFileGameSound |
( |
const entry_ref * |
file, |
|
|
bool |
looping = true, |
|
|
BGameSoundDevice * |
device = NULL |
|
) |
| |
Creates and initializes a BFileGameSound object from an entry_ref allowing you to play the specified sound file.
If looping is true, the sound automatically replays from the beginning once the end is reached. This is useful for playing background music in a loop.
You can specify the sound device to use by setting the device parameter. Setting device to NULL uses the default sound device.
- Parameters
-
| file | The entry ref pointing to the sound file on disk. |
| looping | Whether or not to repeat the sound in a loop. |
| device | The sound device to use to play the sound, use NULL for default. |
- Since
- BeOS R5
◆ BFileGameSound() [2/3]
| BFileGameSound::BFileGameSound |
( |
const char * |
file, |
|
|
bool |
looping = true, |
|
|
BGameSoundDevice * |
device = NULL |
|
) |
| |
Creates and initializes a BFileGameSound object from a file path allowing you to play the specified sound file.
If looping is true, the sound automatically replays from the beginning once the end is reached. This is useful for playing background music in a loop.
You can specify the sound device to use by setting the device parameter. Setting device to NULL uses the default sound device.
- Parameters
-
| file | The path of the sound file on disk. |
| looping | Whether or not to repeat the sound in a loop. |
| device | The sound device to use to play the sound, use NULL for default. |
- Since
- BeOS R5
◆ BFileGameSound() [3/3]
| BFileGameSound::BFileGameSound |
( |
BDataIO * |
source, |
|
|
bool |
looping = true, |
|
|
BGameSoundDevice * |
device = NULL |
|
) |
| |
Creates and initializes a BFileGameSound object from a BDataIO allowing you to play the specified sound data.
This allows using BFileGameSound with BFile as well as non-file based storage (BMemoryIO, etc).
If looping is true, the sound automatically replays from the beginning once the end is reached. This is useful for playing background music in a loop.
You can specify the sound device to use by setting the device parameter. Setting device to NULL uses the default sound device.
- Parameters
-
| source | The place to get the data from. |
| looping | Whether or not to repeat the sound in a loop. |
| device | The sound device to use to play the sound, use NULL for default. |
- Since
- Haiku R1
◆ ~BFileGameSound()
| BFileGameSound::~BFileGameSound |
( |
| ) |
|
|
virtual |
◆ Clone()
Not implemented, always returns NULL.
- Since
- BeOS R5
Implements BGameSound.
◆ FillBuffer()
| void BFileGameSound::FillBuffer |
( |
void * |
inBuffer, |
|
|
size_t |
inByteCount |
|
) |
| |
|
virtual |
Fill a buffer with sound data.
- Parameters
-
| inBuffer | The buffer to fill. |
| inByteCount | The number of bytes to fill buffer with. |
- Since
- BeOS R5
◆ IsPaused()
| int32 BFileGameSound::IsPaused |
( |
| ) |
|
Returns the current playback status.
- Returns
- An integer indicating the current playback status.
- Return values
-
| B_NOT_PAUSED | Sound is playing. |
| B_PAUSE_IN_PROGRESS | The sound is transitioning to or from a paused state. |
| B_PAUSED | Sound is paused. |
- Since
- BeOS R5
◆ Preload()
Preload the sound file into memory so that playback won't be delayed.
- Returns
- A status code,
B_OK on success or an error code if we were unable to communicate with the sound port.
- Since
- BeOS R5
◆ SetPaused()
Pauses playback if isPaused is true or resumes play if isPaused is false.
- Parameters
-
| isPaused | true to pause playback, false to resume playback. |
| rampTime | Determines how long the change in playback state should take to complete in microseconds. Set to 0 for an instantaneous change. |
- Returns
- A status code.
- Return values
-
| B_OK | The playback state was updated. |
| EALREADY | Already in the requested playback state. |
- Since
- BeOS R5
◆ StartPlaying()
| status_t BFileGameSound::StartPlaying |
( |
| ) |
|
|
virtual |
Plays the sound file.
- Returns
- A status code,
B_OK on success or an error code on error.
- Since
- BeOS R5
Reimplemented from BGameSound.
◆ StopPlaying()
| status_t BFileGameSound::StopPlaying |
( |
| ) |
|
|
virtual |
Stops playback of the sound file.
- Returns
- A status code,
B_OK on success or an error code on error.
- Since
- BeOS R5
Reimplemented from BGameSound.