Class TSoundInfo

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TSoundInfo = class(TObject)

Description

Sound information, internally used by TRepoSoundEngine.

The fields correspond to appropriate attributes in sounds XML file. All of the fields except Buffer are initialized only by ReadSounds.

From the point of view of end-user the number of sounds is constant for given game and their properties (expressed in TSoundInfo below) are also constant. However, for the sake of debugging/testing the game, and for content designers, the actual values of Sounds are loaded at initialization by ReadSounds (called automatically by ALContextOpen) from sounds XML file, and later can be changed by calling ReadSounds once again during the game (debug menu may have command like "Reload sounds/index.xml").

Hierarchy

  • TObject
  • TSoundInfo

Overview

Fields

Public Name: string;
Public URL: string;
Public Gain: Single;
Public MinGain: Single;
Public MaxGain: Single;
Public DefaultImportance: Cardinal;

Description

Fields

Public Name: string;

Unique sound name. Empty for the special sound stNone.

Public URL: string;

URL from which to load sound data.

Empty means that the sound data is not defined, so the OpenAL buffer will not be initialized and trying to play this sound (with methods like TSoundEngine.Sound or TSoundEngine.Sound3D) will do nothing. This is useful if you want to use a sound name in code, but you do not have the actual sound file for this yet.

Public Gain: Single;

Gain (how loud the sound is). They are mapped directly to respective OpenAL source properties, so see OpenAL specification for exact details what they mean. In short:

  • Gain scales the sound loudness. Use this to indicate that e.g. a plane engine is louder than a mouse squeak (when heard from the same distance).

    Do not make the actual sound data (in wav, ogg and such files) louder/more silent for this purpose. This is usually bad for sound quality. Instead, keep your sound data at max loudness (normalized), and use this Gain property to scale sound.

    It can be antything from 0 to +infinity. The default is 1.

  • MinGain and MaxGain force a minimum/maximum sound loudness. These can be used to "cheat" around default distance attenuation calculation.

    These must be in [0, 1] range. By default MinGain is 0 and MaxGain is 1.

Note that Gain value > 1 is allowed. Although OpenAL may clip the resulting sound (after all calculations taking into account 3D position will be done). The resulting sound is also clamped by MaxGain (that generally must be in [0, 1], although some OpenAL implementations allow values > 1).

When this sound is used for MusicPlayer.Sound:

  1. MinGain, MaxGain are ignored.

  2. Effective Gain (passed to OpenAL sound source) is the TMusicPlayer.MusicVolume multiplied by our Gain.

Public MinGain: Single;

Gain (how loud the sound is). They are mapped directly to respective OpenAL source properties, so see OpenAL specification for exact details what they mean. In short:

  • Gain scales the sound loudness. Use this to indicate that e.g. a plane engine is louder than a mouse squeak (when heard from the same distance).

    Do not make the actual sound data (in wav, ogg and such files) louder/more silent for this purpose. This is usually bad for sound quality. Instead, keep your sound data at max loudness (normalized), and use this Gain property to scale sound.

    It can be antything from 0 to +infinity. The default is 1.

  • MinGain and MaxGain force a minimum/maximum sound loudness. These can be used to "cheat" around default distance attenuation calculation.

    These must be in [0, 1] range. By default MinGain is 0 and MaxGain is 1.

Note that Gain value > 1 is allowed. Although OpenAL may clip the resulting sound (after all calculations taking into account 3D position will be done). The resulting sound is also clamped by MaxGain (that generally must be in [0, 1], although some OpenAL implementations allow values > 1).

When this sound is used for MusicPlayer.Sound:

  1. MinGain, MaxGain are ignored.

  2. Effective Gain (passed to OpenAL sound source) is the TMusicPlayer.MusicVolume multiplied by our Gain.

Public MaxGain: Single;

Gain (how loud the sound is). They are mapped directly to respective OpenAL source properties, so see OpenAL specification for exact details what they mean. In short:

  • Gain scales the sound loudness. Use this to indicate that e.g. a plane engine is louder than a mouse squeak (when heard from the same distance).

    Do not make the actual sound data (in wav, ogg and such files) louder/more silent for this purpose. This is usually bad for sound quality. Instead, keep your sound data at max loudness (normalized), and use this Gain property to scale sound.

    It can be antything from 0 to +infinity. The default is 1.

  • MinGain and MaxGain force a minimum/maximum sound loudness. These can be used to "cheat" around default distance attenuation calculation.

    These must be in [0, 1] range. By default MinGain is 0 and MaxGain is 1.

Note that Gain value > 1 is allowed. Although OpenAL may clip the resulting sound (after all calculations taking into account 3D position will be done). The resulting sound is also clamped by MaxGain (that generally must be in [0, 1], although some OpenAL implementations allow values > 1).

When this sound is used for MusicPlayer.Sound:

  1. MinGain, MaxGain are ignored.

  2. Effective Gain (passed to OpenAL sound source) is the TMusicPlayer.MusicVolume multiplied by our Gain.

Public DefaultImportance: Cardinal;

How important the sound is. Influences what happens when we have a lot of sounds playing at once. See TSound.Importance.

Ignored when this sound is used for MusicPlayer.Sound.


Generated by PasDoc 0.13.0 on 2013-08-17 21:27:14