载入中...
搜索中...
未找到
Audio.cpp
浏览该文件的文档.
93 streamSources.erase(std::remove(streamSources.begin(), streamSources.end(), s), streamSources.end());
231 zoneItem.addVar("volume",&AudioZoneItem::volume); zoneItem.addVar("fadeInTime",&AudioZoneItem::fadeInTime);
232 zoneItem.addVar("fadeOutTime",&AudioZoneItem::fadeOutTime); zoneItem.addVar("duration",&AudioZoneItem::duration);
235 zoneProfile.addVar("z",&AudioZoneProfile::z); zoneProfile.addVar("radius",&AudioZoneProfile::radius);
240 zoneProfile.addFunc("addItem",[vm=table.getHandle()](AudioZoneProfile* p,const AudioZoneItem* item){
241 auto r=p&&item?p->addItem(*item):Result<int>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument,"profile and item required"));
246 zoneState.addVar("selectedTrack",&AudioZoneState::selectedTrack); zoneState.addVar("playing",&AudioZoneState::playing);
247 table.addFunc("evaluateAudioZone",[vm=table.getHandle()](const AudioZoneProfile* p,AudioZoneState* state,
250 :Result<AudioZoneOutput>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument,"profile and state required"));
251 return eve::script::projectResult(vm,std::move(r),[](const AudioZoneOutput& v){return Value::Object{
#define EV_PROFILE_MODULE(module, name)
Profile the enclosing scope, tagged with a module for grouping.
Definition Profile.h:140
The single Squirrel projection for common Result, Status and Value.
OpenAL audio module: device management, master listener state, and Source factory....
Definition Audio.h:29
Source * newSourceFromDecoder(sound::Decoder *decoder, std::string type)
Creates a Source from a decoder; type must be "static" or "stream".
Definition Audio.cpp:110
void unregisterSource(Source *s)
Internal: removes a source from all module tracking.
Definition Audio.cpp:91
void setVolume(float v)
Sets master volume (clamped to >= 0) applied to the OpenAL listener.
Definition Audio.cpp:175
void setVelocity(float x, float y, float z)
Sets the listener velocity (used by OpenAL doppler).
Definition Audio.cpp:182
void setPosition(float x, float y, float z)
Sets the listener position in world units.
Definition Audio.cpp:181
Source * newSourceFromData(Data *data, std::string type)
Creates a Source from raw encoded data; type must be "static" or "stream".
Definition Audio.cpp:132
Source * newSource(sound::SoundData *data)
Creates a static (non-streaming) Source from decoded sound data.
Definition Audio.cpp:103
void registerStream(Source *s)
Internal: registers a streaming source with the decode worker.
Definition Audio.cpp:86
void unregisterStream(Source *s)
Internal: removes a source from worker tracking.
Definition Audio.cpp:97
int getSourceCount()
Return the current number of caller- or handler-owned live sources.
Definition Audio.cpp:170
void setOrientation(float fx, float fy, float fz, float ux, float uy, float uz)
Sets the listener forward and up orientation vectors.
Definition Audio.cpp:183
void pump()
Advances streaming sources; call once per frame from the main thread.
Definition Audio.cpp:188
A playable audio source (static buffer or streaming decoder). Not thread-safe for playback control ex...
Definition Source.h:30
void setVelocity(float x, float y, float z)
Sets the source velocity (used by OpenAL doppler).
Definition Source.cpp:239
void setRelative(bool relative)
Makes the source ignore the listener position (head-relative).
Definition Source.cpp:241
void setPosition(float x, float y, float z)
Sets the source position in world units.
Definition Source.cpp:238
double getDuration() const
Total duration in seconds (0 for live/unbounded streams).
Definition Source.cpp:229
void setAttenuationDistances(float ref, float max)
Sets OpenAL reference and maximum attenuation distances.
Definition Source.cpp:244
bool seek(double seconds)
Seeks to a time in seconds; false when seeking is unsupported.
Definition Source.cpp:200
void setDirection(float x, float y, float z)
Sets the source directional cone orientation.
Definition Source.cpp:240
Streaming audio decoder (medialoader-backed). Owns the raw encoded bytes and decodes incrementally vi...
Definition Decoder.h:22
Raw PCM audio buffer with format metadata (samples/rate/bit depth/channels).
Definition SoundData.h:15
void bindAudioEventSinkOwner(Audio *owner) noexcept
Bind the live Audio module into the platform event pump sink. @ownership Borrowed; cleared when the A...
Definition EventSink.cpp:35
Result< AudioZoneOutput > evaluateAudioZone(const AudioZoneProfile &p, AudioZoneState &state, float now, float px, float py, float pz, float master, std::uint32_t seed)
Evaluate PcgAudioManager/PcgAudioZone for one explicit time and player observation.
Definition AudioZone.cpp:21
Result< void > applyAudioZoneOutput(Source *source, const AudioZoneOutput &output)
Apply one evaluated command to the caller-selected track Source without retaining it.
Definition AudioZone.cpp:59
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:470
@ InvalidArgument