Studio::System::getSoundInfo

FMOD Studio API

Firelight Technologies FMOD Studio API

Studio::System::getSoundInfo

Retrieves information for loading a sound from an audio table.

C++ Syntax

FMOD_RESULT Studio::System::getSoundInfo(
  const char *key,
  FMOD_STUDIO_SOUND_INFO *info
);

C Syntax

FMOD_RESULT FMOD_Studio_System_GetSoundInfo(
  FMOD_STUDIO_SYSTEM *system,
  const char *key,
  FMOD_STUDIO_SOUND_INFO *info
);

C# Syntax

RESULT Studio.System.getSoundInfo(
  string key,
  out SOUND_INFO info
);

JavaScript Syntax

System.getSoundInfo(
  key,                             
  info                             // writes value to info.val
);

Parameters

key
The key that identifies the sound.
info
Address of a variable to receive the sound loading information.

Return Values

If the function succeeds then the return value is FMOD_OK.
If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.

Remarks

The FMOD_STUDIO_SOUND_INFO structure contains information to be passed to System::createSound (which will create a parent sound), along with a subsound index to be passed to Sound::getSubSound once the parent sound is loaded.

The user is expected to call System::createSound with the given information. It is up to the user to OR in any desired loading flags, such as FMOD_CREATESTREAM, FMOD_CREATECOMPRESSEDSAMPLE or FMOD_NONBLOCKING. The default loading is the equivalent of FMOD_CREATESAMPLE, which will load the sample data and decompress into memory.

When the banks have been loaded via Studio::System::loadBankMemory, the mode will be returned as FMOD_OPENMEMORY_POINT. This won't work with the default FMOD_CREATESAMPLE mode. For memory banks, you should add in the FMOD_CREATECOMPRESSEDSAMPLE or FMOD_CREATESTREAM flag, or alternatively remove FMOD_OPENMEMORY_POINT and change it to FMOD_OPENMEMORY if you really want to decompress the sample out of the memory bank into a new allocation.

Example code:

const char* audio_table_name = "some name";
FMOD::Sound* sound = NULL;
FMOD_STUDIO_SOUND_INFO info = {};

// Look up the entry
ERRCHECK(studioSystem->getSoundInfo(audio_table_name, &info));

// Load compressed sample data
info.mode |= FMOD_CREATECOMPRESSEDSAMPLE;

// Create the sound
ERRCHECK(lowLevelSystem->createSound(info.name_or_data, info.mode, &info.exinfo, &sound));

// We end up with a parent sound, and info.subsoundIndex.  The subsound can be found, or
// the parent sound and subsound index can be given to a programmer sound callback

See Also




Version 1.10.03 Built on Feb 1, 2018