Luanti 5.11.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

◆ fade()

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

References MYMAX.

◆ getGain()

f32 sound::PlayingSound::getGain ( )
noexcept

References m_is_positional, and m_source_id.

◆ getState()

ALint sound::PlayingSound::getState ( )
inlinenoexcept

References m_source_id.

Referenced by 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 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 m_data.

Referenced by setPitch().

+ 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

Referenced by PlayingSound().

+ 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 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

◆ m_is_positional

bool sound::PlayingSound::m_is_positional
private

Referenced by PlayingSound(), and getGain().

◆ 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

Referenced by PlayingSound(), isDead(), and stepStream().


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