Context

Constructors

syz_createContext

SYZ_CAPI syz_ErrorCode syz_createContext(syz_Handle *out, void *userdata, syz_UserdataFreeCallback *userdata_free_callback);

Creates a context configured to play through the default output device.

Properties

EnumTypeDefaultRangeDescription
SYZ_P_GAINdouble1.0value >= 0.0The gain of the context
SYZ_P_POSITIONdouble3(0, 0, 0)anyThe position of the listener.
SYZ_P_ORIENTATIONdouble6(0, 1, 0, 0, 0, 1)Two packed unit vectorsThe orientation of the listener as (atx, aty, atz, upx, upy, upz).
SYZ_P_DEFAULT_DISTANCE_MODELintSYZ_DISTANCE_MODEL_LINEARany SYZ_DISTANCE_MODELThe default distance model for new sources.
SYZ_P_DEFAULT_DISTANCE_REFdouble1.0value >= 0.0The default reference distance for new sources.
SYZ_P_DEFAULT_DISTANCE_MAXdouble50.0value >= 0.0The default max distance for new sources.
SYZ_P_DEFAULT_ROLLOFFdouble1.0value >= 0.0The default rolloff for new sources.
SYZ_P_DEFAULT_CLOSENESS_BOOSTdouble0.0any finite doubleThe default closeness boost for new sources in DB.
SYZ_P_DEFAULT_CLOSENESS_BOOST_DISTANCEdouble0.0value >= 0.0The default closeness boost distance for new sources
SYZ_P_DEFAULT_PANNER_STRATEGYintSYZ_PANNER_STRATEGY_STEREOany SYZ_PANNER_STRATEGYThe default panner strategy for new sources.

Functions

syz_contextGetNextEvent

See events.

Linger Behavior

None.

Remarks

The context is the main entrypoint to Synthizer, responsible for the following:

  • Control and manipulation of the audio device.
  • Driving the audio threads.
  • Owning all objects that play together.
  • Representing the listener in 3D space.

All objects which are associated with a context take a context as part of all their constructors. Two objects which are both associated with different contexts should never interact. For efficiency, whether two objects are from different contexts is unvalidated, and the behavior of mixing them is undefined.

All objects associated with a context become useless once the context is destroyed. Calls to them will still work, but they can't be reassociated with a different context and no audible output will result.

Most programs create one context and destroy it at shutdown.

For the time being, all contexts output stereo audio, and it is not possible to specify the output device. These restrictions will be lifted in future.

For information on the meaning of the distance model properties, see 3D Audio.