载入中...
搜索中...
未找到
eve::audio::Source类 参考

A playable audio source (static buffer or streaming decoder). Not thread-safe for playback control except fillPendingFromDecoder(), which is synchronized for the Audio worker thread. 更多...

#include <Source.h>

Public 成员函数

 Source (Audio *audio, sound::SoundData *data)
 Creates a static source from decoded audio (both arguments required).
 
 Source (Audio *audio, sound::Decoder *decoder, bool streaming, bool takeDecoderOwnership=false)
 Creates a streaming (or static-decoder) source; ownership of decoder is optional.
 
 ~Source ()
 Source.
 
void play ()
 Starts (or resumes) playback.
 
void pause ()
 Pauses playback, keeping the play position.
 
void stop ()
 Stops playback and rewinds the play position.
 
bool isPlaying () const
 True when playing.
 
void setVolume (float v)
 Sets source gain (clamped to >= 0).
 
float getVolume () const
 Returns the volume.
 
void setPitch (float p)
 Sets playback pitch (clamped to >= 0).
 
float getPitch () const
 Returns the pitch.
 
void setLooping (bool l)
 Enables/disables looping.
 
bool isLooping () const
 True when looping.
 
bool seek (double seconds)
 Seeks to a time in seconds; false when seeking is unsupported.
 
double tell () const
 Current play time in seconds.
 
double getDuration () const
 Total duration in seconds (0 for live/unbounded streams).
 
void setPosition (float x, float y, float z)
 Sets the source position in world units.
 
void setVelocity (float x, float y, float z)
 Sets the source velocity (used by OpenAL doppler).
 
void setDirection (float x, float y, float z)
 Sets the source directional cone orientation.
 
void setRelative (bool relative)
 Makes the source ignore the listener position (head-relative).
 
void setAttenuationDistances (float ref, float max)
 Sets OpenAL reference and maximum attenuation distances.
 
bool isStreaming () const
 True when streaming.
 
void pump ()
 Main thread: queues/unqueues AL buffers for a streaming source.
 
void fillPendingFromDecoder ()
 Called by the Audio worker thread. Internally synchronized against concurrent decoder teardown (see decoderMutex) — safe to call even if another thread is stopping/seeking/destroying this Source.
 

友元

class Audio
 

详细描述

A playable audio source (static buffer or streaming decoder). Not thread-safe for playback control except fillPendingFromDecoder(), which is synchronized for the Audio worker thread.

在文件 Source.h 第 30 行定义.

构造及析构函数说明

◆ Source() [1/2]

eve::audio::Source::Source ( Audio *  audio,
sound::SoundData *  data 
)

Creates a static source from decoded audio (both arguments required).

在文件 Source.cpp 第 18 行定义.

引用了 audio.

◆ Source() [2/2]

eve::audio::Source::Source ( Audio *  audio,
sound::Decoder *  decoder,
bool  streaming,
bool  takeDecoderOwnership = false 
)

Creates a streaming (or static-decoder) source; ownership of decoder is optional.

在文件 Source.cpp 第 28 行定义.

引用了 audio , 以及 eve::audio::kStreamBufferCount.

◆ ~Source()

eve::audio::Source::~Source ( )

Source.

在文件 Source.cpp 第 46 行定义.

引用了 stop() , 以及 eve::audio::Audio::unregisterSource().

成员函数说明

◆ fillPendingFromDecoder()

void eve::audio::Source::fillPendingFromDecoder ( )

Called by the Audio worker thread. Internally synchronized against concurrent decoder teardown (see decoderMutex) — safe to call even if another thread is stopping/seeking/destroying this Source.

在文件 Source.cpp 第 250 行定义.

引用了 eve::audio::PcmChunk::bytes, eve::sound::Decoder::decode(), eve::sound::Decoder::getBuffer(), n , 以及 eve::sound::Decoder::rewind().

◆ getDuration()

double eve::audio::Source::getDuration ( ) const

Total duration in seconds (0 for live/unbounded streams).

在文件 Source.cpp 第 229 行定义.

引用了 eve::sound::Decoder::getDuration() , 以及 eve::sound::SoundData::getDuration().

被这些函数引用 eve::audio_editing::AudioSourceTransportBackend::duration().

◆ getPitch()

float eve::audio::Source::getPitch ( ) const

Returns the pitch.

在文件 Source.cpp 第 191 行定义.

◆ getVolume()

float eve::audio::Source::getVolume ( ) const

Returns the volume.

在文件 Source.cpp 第 185 行定义.

◆ isLooping()

bool eve::audio::Source::isLooping ( ) const

True when looping.

在文件 Source.cpp 第 198 行定义.

◆ isPlaying()

bool eve::audio::Source::isPlaying ( ) const

True when playing.

在文件 Source.cpp 第 175 行定义.

引用了 state.

被这些函数引用 eve::audio::applyUnderwaterAudio(), eve::audio_editing::AudioSourceTransportBackend::playing() , 以及 pump().

◆ isStreaming()

bool eve::audio::Source::isStreaming ( ) const
inline

True when streaming.

在文件 Source.h 第 80 行定义.

◆ pause()

void eve::audio::Source::pause ( )

Pauses playback, keeping the play position.

在文件 Source.cpp 第 135 行定义.

被这些函数引用 eve::audio_editing::AudioSourceTransportBackend::pause().

◆ play()

void eve::audio::Source::play ( )

Starts (or resumes) playback.

在文件 Source.cpp 第 120 行定义.

引用了 eve::audio::Audio::notifyWorker().

被这些函数引用 eve::audio::applyUnderwaterAudio() , 以及 eve::audio_editing::AudioSourceTransportBackend::play().

◆ pump()

void eve::audio::Source::pump ( )

Main thread: queues/unqueues AL buffers for a streaming source.

在文件 Source.cpp 第 286 行定义.

引用了 b, eve::audio::PcmChunk::bytes, isPlaying(), eve::audio::Audio::notifyWorker(), q , 以及 queued.

◆ seek()

bool eve::audio::Source::seek ( double  seconds)

Seeks to a time in seconds; false when seeking is unsupported.

在文件 Source.cpp 第 200 行定义.

引用了 eve::sound::Decoder::isSeekable(), eve::audio::Audio::notifyWorker(), eve::sound::Decoder::seek() , 以及 stop().

被这些函数引用 eve::audio_editing::AudioSourceTransportBackend::seek().

◆ setAttenuationDistances()

void eve::audio::Source::setAttenuationDistances ( float  ref,
float  max 
)

Sets OpenAL reference and maximum attenuation distances.

在文件 Source.cpp 第 244 行定义.

引用了 max.

◆ setDirection()

void eve::audio::Source::setDirection ( float  x,
float  y,
float  z 
)

Sets the source directional cone orientation.

在文件 Source.cpp 第 240 行定义.

引用了 x, y , 以及 z.

◆ setLooping()

void eve::audio::Source::setLooping ( bool  l)

Enables/disables looping.

在文件 Source.cpp 第 193 行定义.

被这些函数引用 eve::audio::applyUnderwaterAudio() , 以及 eve::audio_editing::AudioSourceTransportBackend::setNativeLooping().

◆ setPitch()

void eve::audio::Source::setPitch ( float  p)

Sets playback pitch (clamped to >= 0).

在文件 Source.cpp 第 187 行定义.

引用了 p.

◆ setPosition()

void eve::audio::Source::setPosition ( float  x,
float  y,
float  z 
)

Sets the source position in world units.

在文件 Source.cpp 第 238 行定义.

引用了 x, y , 以及 z.

◆ setRelative()

void eve::audio::Source::setRelative ( bool  relative)

Makes the source ignore the listener position (head-relative).

在文件 Source.cpp 第 241 行定义.

引用了 relative.

◆ setVelocity()

void eve::audio::Source::setVelocity ( float  x,
float  y,
float  z 
)

Sets the source velocity (used by OpenAL doppler).

在文件 Source.cpp 第 239 行定义.

引用了 x, y , 以及 z.

◆ setVolume()

void eve::audio::Source::setVolume ( float  v)

Sets source gain (clamped to >= 0).

在文件 Source.cpp 第 181 行定义.

引用了 v.

被这些函数引用 eve::audio::applyUnderwaterAudio().

◆ stop()

void eve::audio::Source::stop ( )

Stops playback and rewinds the play position.

在文件 Source.cpp 第 140 行定义.

引用了 b, queued , 以及 eve::sound::Decoder::rewind().

被这些函数引用 eve::audio::applyUnderwaterAudio(), seek(), eve::audio_editing::AudioSourceTransportBackend::stop() , 以及 ~Source().

◆ tell()

double eve::audio::Source::tell ( ) const

Current play time in seconds.

在文件 Source.cpp 第 223 行定义.

被这些函数引用 eve::audio_editing::AudioSourceTransportBackend::tell().

友元及相关函数文档

◆ Audio

friend class Audio
friend

在文件 Source.h 第 92 行定义.


该类的文档由以下文件生成: