World class

Initializes pySonic and allows control over global parameters. Only one instantiation of this class can exist at a time.


World(int mixing_rate=44100, int soft_channels=32, int buffer_size=None, int output=None, int driver=None, int mixer=None, int *args)

Initializes pySonic. If values for buffer size, output, driver, and mixer are not provided, they default to reasonable values. Optional args are flags that will be OR'ed together and passed directly to the FMOD library. The flags can be any of the pySonic.Constants.FSOUND_INIT_* values.

The constructor will raise an exception if another instance of the World class already exists. Delete that instance first and then use the constructor again. Instances of other classes (e.g. Sample, Stream, Source) should continue to work across World deletion and creation.


int ActiveChannels (read)

The number of channels currently playing or paused.

float CPUUsage (read)

The percent of CPU time the mixing system is using. Values range between 0.0 and 100.0.

float DistanceFactor (write)

The distance factor for 3D sound relative to 1.0 meters.

float DopplerFactor (write)

The Doppler shift factor for 3D sound. Values greater than 1.0 exaggerate the Doppler effect. Values less than 1.0 diminish the effect.

int Driver (read)

The current audio device. Zero is the default output driver on the system. One and higher are other output drivers.

Listener Listener (read)

The Listener object that controls the position, velocity, and other parameters of the user within the virtual 3D sound space. See the Listener class for more details.

int MasterVolume (write)

The master volume control for all sample and stream audio. Values range between 0 and 255.

int MaxChannels (read)

The maximum number of channels allocated for playback.

int MaxSamples (read)

The maximum number of samples that can be loaded simultaneously.

tuple(int, int) MemoryStats (read)

The current amount of memory allocated to FMOD and the maximum amount of memory ever allocated to FMOD during this session.

int Mixer (read)

The mixing system used during playback. The value can be any of the pySonic.Constants.FSOUND_MIXER_* flags.

int MixingRate (read)

The mixing rate.

int NumDrivers (read)

The number of audio devices available on the system.

tuple(int, int, int) NumHardwareChannels (read)

The number of 2D output channels, the number of 3D output channels, and the total number of channels in the pool (not necessarily 2D + 3D if they are shared) supported by the system.

int Output (read)

The current audio output system (e.g. DirectSound, OSS, A3D, etc.). The value can be any of the pySonic.Constants.FSOUND_OUTPUT_* flags.

int OutputHandle (read)

The memory location of a structure containing information specific to the chosen output device. See the FMOD documentation for details.

GlobalReverb Reverb (read)

The Reverb object that controls the global EAX reverberation settings. See the GlobalReverb class for more details.

float RolloffFactor (write)

The volume attenuation factor for 3D sound. Volume of 3D sources normally falls off as 1.0 divided by the distance to listener. Values greater than 1.0 make the volume diminish sooner as the source distance increases. Values less than 1.0 have the opposite effect.

int SpeakerMode (write)

The speaker setup attached to the system. The value can be set to any of the pySonic.Constants.FSOUND_SPEAKERMODES_* flags.

string Version (read)

The version of the FMOD DLL. Check to make sure this value matches pySonic.VERSION. Otherwise, you could be using a DLL with functions that don't match those used in this version of pySonic.