Luanti 5.16.0-dev
Loading...
Searching...
No Matches
sound::PlayingSound Class Referencefinal

A sound that is currently played. More...

#include <playing_sound.h>

Collaboration diagram for sound::PlayingSound:

Classes

struct  FadeState

Public Member Functions

 PlayingSound (ALuint source_id, std::shared_ptr< ISoundDataOpen > data, bool loop, f32 volume, f32 pitch, f32 start_time, const std::optional< std::pair< v3f, v3f > > &pos_vel_opt, const ALExtensions &exts)
 ~PlayingSound () noexcept
bool stepStream (bool playback_speed_changed=false)
bool fade (f32 step, f32 target_gain) noexcept
bool doFade (f32 dtime) noexcept
void updatePosVel (const v3f &pos, const v3f &vel) noexcept
void setGain (f32 gain) noexcept
f32 getGain () noexcept
void setPitch (f32 pitch)
bool isStreaming () const noexcept
void play () noexcept
ALint getState () noexcept
bool isDead () noexcept
void pause () noexcept
void resume () noexcept

Private Attributes

ALuint m_source_id
std::shared_ptr< ISoundDataOpenm_data
ALuint m_next_sample_pos = 0
bool m_looping
bool m_is_positional
bool m_stopped_means_dead = true
std::optional< FadeStatem_fade_state = std::nullopt

Detailed Description

A sound that is currently played.

Can be streaming. Can be fading.

Constructor & Destructor Documentation

◆ PlayingSound()

sound::PlayingSound::PlayingSound ( ALuint source_id,
std::shared_ptr< ISoundDataOpen > data,
bool loop,
f32 volume,
f32 pitch,
f32 start_time,
const std::optional< std::pair< v3f, v3f > > & pos_vel_opt,
const ALExtensions & exts )

References m_data, m_is_positional, m_looping, m_next_sample_pos, m_source_id, m_stopped_means_dead, setGain(), setPitch(), stepStream(), updatePosVel(), and sound::warn_if_al_error().

Here is the call graph for this function:

◆ ~PlayingSound()

sound::PlayingSound::~PlayingSound ( )
inlinenoexcept

References m_source_id.

Member Function Documentation

◆ doFade()

bool sound::PlayingSound::doFade ( f32 dtime)
noexcept

References fade(), getGain(), getState(), isDead(), m_fade_state, m_source_id, m_stopped_means_dead, and setGain().

Here is the call graph for this function:

◆ fade()

bool sound::PlayingSound::fade ( f32 step,
f32 target_gain )
noexcept

References getGain(), m_fade_state, and MYMAX.

Referenced by doFade().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGain()

f32 sound::PlayingSound::getGain ( )
noexcept

References m_is_positional, and m_source_id.

Referenced by doFade(), and fade().

Here is the caller graph for this function:

◆ getState()

ALint sound::PlayingSound::getState ( )
inlinenoexcept

References m_source_id.

Referenced by doFade(), isDead(), resume(), and stepStream().

Here is the caller graph for this function:

◆ isDead()

bool sound::PlayingSound::isDead ( )
inlinenoexcept

References getState(), and m_stopped_means_dead.

Referenced by doFade(), and stepStream().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isStreaming()

bool sound::PlayingSound::isStreaming ( ) const
inlinenoexcept

References isStreaming(), and m_data.

Referenced by isStreaming(), and setPitch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pause()

void sound::PlayingSound::pause ( )
inlinenoexcept

References m_source_id.

Referenced by sound::OpenALSoundManager::pauseAll().

Here is the caller graph for this function:

◆ play()

void sound::PlayingSound::play ( )
inlinenoexcept

References m_source_id.

Referenced by resume(), and stepStream().

Here is the caller graph for this function:

◆ resume()

void sound::PlayingSound::resume ( )
inlinenoexcept

References getState(), and play().

Referenced by sound::OpenALSoundManager::resumeAll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGain()

void sound::PlayingSound::setGain ( f32 gain)
noexcept

References m_is_positional, and m_source_id.

Referenced by PlayingSound(), and doFade().

Here is the caller graph for this function:

◆ setPitch()

void sound::PlayingSound::setPitch ( f32 pitch)

References isStreaming(), m_source_id, and stepStream().

Referenced by PlayingSound().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stepStream()

bool sound::PlayingSound::stepStream ( bool playback_speed_changed = false)

References getState(), isDead(), m_data, m_looping, m_next_sample_pos, m_source_id, m_stopped_means_dead, sound::MIN_STREAM_BUFFER_LENGTH, play(), sound::STREAM_BIGSTEP_TIME, and warningstream.

Referenced by PlayingSound(), and setPitch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePosVel()

void sound::PlayingSound::updatePosVel ( const v3f & pos,
const v3f & vel )
noexcept

References m_source_id, and sound::warn_if_al_error().

Referenced by PlayingSound().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_data

std::shared_ptr<ISoundDataOpen> sound::PlayingSound::m_data
private

◆ m_fade_state

std::optional<FadeState> sound::PlayingSound::m_fade_state = std::nullopt
private

Referenced by doFade(), and fade().

◆ m_is_positional

bool sound::PlayingSound::m_is_positional
private

Referenced by PlayingSound(), getGain(), and setGain().

◆ m_looping

bool sound::PlayingSound::m_looping
private

Referenced by PlayingSound(), and stepStream().

◆ m_next_sample_pos

ALuint sound::PlayingSound::m_next_sample_pos = 0
private

Referenced by PlayingSound(), and stepStream().

◆ m_source_id

ALuint sound::PlayingSound::m_source_id
private

◆ m_stopped_means_dead

bool sound::PlayingSound::m_stopped_means_dead = true
private

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