Loads a sound effect from memory, resource pack or disk file.

HEFFECT Effect_Load(
  const char *filename,
  DWORD size = 0


Sound effect file name.
If this parameter isn't 0, it is the size of memory block containing the sound effect in one of the known formats and the parameter filename is treated as a pointer to this block.

Return value

If successful, returns the sound effect handle to be used with Effect_Play and Effect_PlayEx functions. Otherwise returns 0.


Supports WAV, MP3, MP2, MP1 and OGG audio file formats.

If filename specifies relative path, sound file is first searched within all resource packs attached with Resource_AttachPack, then in the application disk folder. If filename specifies absolute disk path, sound file is loaded directly from disk.

If the function fails, you may obtain error message with System_GetErrorMessage function. Also if HGE_LOGFILE system state was set, the error message is written to log.

When the sound effect isn't needed longer, you must delete it with Effect_Free function.


Header: hge.h
Import library: hge.lib

See also

Effect_Free, Effect_Play, Effect_PlayEx