载入中...
搜索中...
未找到
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>

类 eve::audio::Source 继承关系图:
eve::Object

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 () override
 
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
 
void setVolume (float v)
 Sets source gain (clamped to >= 0).
 
float getVolume () const
 
void setPitch (float p)
 Sets playback pitch (clamped to >= 0).
 
float getPitch () const
 
void setLooping (bool l)
 Enables/disables looping.
 
bool isLooping () const
 
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
 
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.
 
- Public 成员函数 继承自 eve::Object
 Object ()
 
void setUpdate (Object *update)
 Update the current object with a replacement. You don't need to care about the reference to the old object since it will be automatically updated in the ref smart pointer.
 

友元

class Audio
 

额外继承的成员函数

- Protected 成员函数 继承自 eve::Object
virtual ~Object ()
 
bool isDirty () const
 
ObjectgetUpdate () const
 
void ref ()
 
void unref ()
 
- Protected 属性 继承自 eve::Object
Objectupdate
 
unsigned ref_count = 0
 

详细描述

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.h30 行定义.

构造及析构函数说明

◆ Source() [1/2]

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

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

在文件 Source.cpp18 行定义.

引用了 data.

◆ 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.cpp28 行定义.

引用了 eve::audio::kStreamBufferCount, eve::audio::Audio::notifyWorker() , 以及 eve::audio::Audio::registerStream().

◆ ~Source()

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

在文件 Source.cpp46 行定义.

引用了 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.cpp250 行定义.

引用了 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.cpp229 行定义.

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

◆ getPitch()

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

在文件 Source.cpp191 行定义.

◆ getVolume()

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

在文件 Source.cpp185 行定义.

◆ isLooping()

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

在文件 Source.cpp198 行定义.

◆ isPlaying()

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

在文件 Source.cpp175 行定义.

引用了 state.

被这些函数引用 pump().

◆ isStreaming()

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

在文件 Source.h74 行定义.

◆ pause()

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

Pauses playback, keeping the play position.

在文件 Source.cpp135 行定义.

◆ play()

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

Starts (or resumes) playback.

在文件 Source.cpp120 行定义.

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

◆ pump()

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

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

在文件 Source.cpp286 行定义.

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

◆ seek()

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

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

在文件 Source.cpp200 行定义.

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

◆ setAttenuationDistances()

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

Sets OpenAL reference and maximum attenuation distances.

在文件 Source.cpp244 行定义.

◆ setDirection()

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

Sets the source directional cone orientation.

在文件 Source.cpp240 行定义.

引用了 x, y , 以及 z.

◆ setLooping()

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

Enables/disables looping.

在文件 Source.cpp193 行定义.

◆ setPitch()

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

Sets playback pitch (clamped to >= 0).

在文件 Source.cpp187 行定义.

引用了 p.

◆ setPosition()

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

Sets the source position in world units.

在文件 Source.cpp238 行定义.

引用了 x, y , 以及 z.

◆ setRelative()

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

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

在文件 Source.cpp241 行定义.

◆ setVelocity()

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

Sets the source velocity (used by OpenAL doppler).

在文件 Source.cpp239 行定义.

引用了 x, y , 以及 z.

◆ setVolume()

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

Sets source gain (clamped to >= 0).

在文件 Source.cpp181 行定义.

引用了 v.

◆ stop()

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

Stops playback and rewinds the play position.

在文件 Source.cpp140 行定义.

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

被这些函数引用 seek() , 以及 ~Source().

◆ tell()

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

Current play time in seconds.

在文件 Source.cpp223 行定义.

友元及相关函数文档

◆ Audio

friend class Audio
friend

在文件 Source.h86 行定义.


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