Turbo Engine 0.3
A C++ game engine using Allegro 5
turbo::Sound Class Reference

A short sound effect, loaded fully into memory and playable on demand. For longer tracks streamed from disk, use MusicStream. More...

#include <Sound.hpp>

Inheritance diagram for turbo::Sound:
Collaboration diagram for turbo::Sound:

Public Member Functions

 Sound (Path *path)
 Load a sound sample from an audio file.
 ~Sound ()
void play () override
 Start, or resume, playback.
void pause () override
 Pause playback, keeping the current position.
void reset () override
 Stop playback and rewind to the beginning.
bool is_playing () const override
 Whether the audio is currently playing.

Protected Attributes

ALLEGRO_SAMPLE * sample = nullptr
ALLEGRO_SAMPLE_INSTANCE * sample_instance = nullptr

Detailed Description

A short sound effect, loaded fully into memory and playable on demand. For longer tracks streamed from disk, use MusicStream.

Constructor & Destructor Documentation

◆ Sound()

turbo::Sound::Sound ( Path * path)
explicit

Load a sound sample from an audio file.

Parameters
pathpath to the audio file

◆ ~Sound()

turbo::Sound::~Sound ( )

Member Function Documentation

◆ is_playing()

bool turbo::Sound::is_playing ( ) const
nodiscardoverridevirtual

Whether the audio is currently playing.

Implements turbo::Audio.

◆ pause()

void turbo::Sound::pause ( )
overridevirtual

Pause playback, keeping the current position.

Implements turbo::Audio.

◆ play()

void turbo::Sound::play ( )
overridevirtual

Start, or resume, playback.

Implements turbo::Audio.

◆ reset()

void turbo::Sound::reset ( )
overridevirtual

Stop playback and rewind to the beginning.

Implements turbo::Audio.

Member Data Documentation

◆ sample

ALLEGRO_SAMPLE* turbo::Sound::sample = nullptr
protected

◆ sample_instance

ALLEGRO_SAMPLE_INSTANCE* turbo::Sound::sample_instance = nullptr
protected

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