| CRM64Pro GDK v0.17.0 A free cross-platform game development kit built on top of SDL 3.0

Loading...
Searching...
No Matches
AudioTrack
Audio module

## Description

Audio Track Manager and AudioTrack objects for sound effects and music playback [v26.02.0].

### Overview

The Audio Track module provides a unified audio system for loading and playing both short sound effects and long music tracks. Once the audio system is initialized using ConfigMgr::audioInit() or ConfigMgr::load(), you can load audio from external files, memory buffers, or CDC archives.
There are no longer fixed "channels". Tracks are allocated dynamically as needed, allowing for virtually unlimited polyphony (limited only by CPU/RAM).

### Key features

- Unified audio object: Handles both short SFX and long music streams transparently
- Tag categorization: Tracks are assigned a category tag (Music, SFX, Voice, Custom) allowing group operations like "Stop all SFX" or "Fade out Music"
- Hierarchical volume: Final Output Volume = Master Gain * Category Gain
- Editor support: Optional raw data persistence for saving/exporting audio assets

### AudioTrack actions

Playback | Play (supports multiple overlapping instances), stop, pause and resume
Transitions | Fade out and fade in on a given time
Playback control | Pitch/speed, looping, seeking (for streams)
Effects | Volume, panning, 3D distance and angular position

### Loading strategies

Choose the appropriate loading strategy based on your audio content type and performance requirements:

Preload (RAM) | Best for SFX. Decodes entire file to memory for zero-latency playback
Stream (Disk) | Best for Music. Decodes chunks on-demand to save memory

### Supported audio formats

Raw streams | AIFF, WAV and VOC
Compressed | FLAC, OGG and MP3
Modules (52) | 669, abk, amf, arch, asylum, chip, coco, dbm, digi, dt, emod, far, flt, fnk, gal4, gal5, gdm, hmn, ice, imf, ims, it, liq, masi, masi16, mdl, med2, med3, med4, mfp, mgt, mmd1, mmd3, mod, mtm, muse, no, okt, pt3, ptm, rtm, s3m, sfx, st, stim, stm, stx, sym, ult, umx, xm, xmf

### Manager type

This is a sharing manager: it has the ability of sharing an audio ID to a group of owners when they request to open an already opened object based on the name as the key.

Default behavior | Returns a shared ID. Control methods (stop/volume) affect all instances sharing this ID
Unique instance | Request via `load(..., iUnique=1)`. Creates a standalone object with independent control while efficiently sharing the underlying raw audio data in memory

### Naming security

Resource names are restricted to prevent collisions with system assets. The characters '#' and '@' are reserved for internal engine use. Any attempt to create or rename a resource starting with these characters will be rejected (returning a negative error code).

### Best practices

- Always initialize the audio system via ConfigMgr::audioInit() or ConfigMgr::load() before using the Audio Track Manager
- Leverage category tags (Music, SFX, Voice, Custom) for efficient group control operations
- Consider the hierarchical volume model when setting levels: category and master gains are multipled
- Request unique instances when you need independent playback control over the same audio asset
- Access the manager exclusively through Main::IAudioTrackMgr()

Note
  The Audio Track Manager is a singleton, automatically created once Main is instantiated. You can get a reference to this manager using Main::IAudioTrackMgr() method.
  The Audio Track Manager is automatically released when Main::Terminate() is called. At this time, any resource still loaded will be released, avoiding resource leaks.

## Classes
struct | CRM64Pro::AudioInfo
| Audio metadata information. More...
class | CRM64Pro::AudioTrack
| Audio Track object class. More...
class | CRM64Pro::AudioTrackMgr
| Audio Track Manager class. More...

## Enumerations
enum | CRM64Pro::eAudioTrackTag { CRM64Pro::ATT_MUSIC = 0x01 , CRM64Pro::ATT_SFX = 0x02 , CRM64Pro::ATT_VOICE = 0x04 , CRM64Pro::ATT_CUSTOM = 0x08 }
| Audio track category tags for grouping and batch operations. More...
enum | CRM64Pro::eAudioType { CRM64Pro::AT_NONE = 0 , CRM64Pro::AT_WAV = 1 , CRM64Pro::AT_MOD = 2 , CRM64Pro::AT_OGG = 3 , CRM64Pro::AT_MP3 = 4 , CRM64Pro::AT_FLAC = 5 , CRM64Pro::AT_UNKNOWN = 6 }
| Audio codec/format type. More...
enum | CRM64Pro::eAudioLoadMode { CRM64Pro::ALM_AUTO = 0 , CRM64Pro::ALM_PRELOAD = 1 , CRM64Pro::ALM_STREAM = 2 }
| Audio loading strategy. More...

## Functions
bool | CRM64Pro::AudioTrack::info (Sint32 iMode=0) override
| Request AudioTrack information.
const string & | CRM64Pro::AudioTrack::getName () const override
| Get the name.
Uint32 | CRM64Pro::AudioTrack::getID () const override
| Get the ID.
bool | CRM64Pro::AudioTrack::getInfo (string *sType, AudioInfo *pAI) const
| Get AudioTrack detailed information.
bool | CRM64Pro::AudioTrack::play (Sint32 iLoop=0)
| Play the track.
bool | CRM64Pro::AudioTrack::fadeIn (Sint32 iTimeMS=1000, Sint32 iLoop=0)
| Play the track with a fade-in effect.
bool | CRM64Pro::AudioTrack::fadeOut (Sint32 iTimeMS=1000)
| Fade out all instances of this track to silence, then stop.
bool | CRM64Pro::AudioTrack::stop ()
| Immediately stop all instances of this track.
bool | CRM64Pro::AudioTrack::pause ()
| Pause all instances of this track.
bool | CRM64Pro::AudioTrack::resume ()
| Resume all instances of this track.
Sint32 | CRM64Pro::AudioTrack::getPosition () const
| Get the current playback position.
bool | CRM64Pro::AudioTrack::setPosition (Sint32 iTimeMS)
| Set the playback position (Seek).
bool | CRM64Pro::AudioTrack::setPitch (float fPitch)
| Set Pitch (Frequency Ratio).
float | CRM64Pro::AudioTrack::getPitch () const
| Get current pitch property.
bool | CRM64Pro::AudioTrack::setPanning (Uint8 iLeft, Uint8 iRight)
| Set Stereo Panning.
bool | CRM64Pro::AudioTrack::setLoopPoints (double dStartSec, double dEndSec)
| Set Loop Points.
bool | CRM64Pro::AudioTrack::setDistance (Uint8 iDistance)
| Set 3D Distance Attenuation.
bool | CRM64Pro::AudioTrack::setPosition3D (Sint16 iAngle, Uint8 iDistance)
| Set 3D Angular Position.
bool | CRM64Pro::AudioTrack::setTag (eAudioTrackTag eTag)
| Set Track Tag category.
eAudioTrackTag | CRM64Pro::AudioTrack::getTag () const
| Get Track Tag category.
Sint32 | CRM64Pro::AudioTrack::saveToFile (const string &sFile)
| Export the AudioTrack to an external file.
Sint32 | CRM64Pro::AudioTrack::save (const string &sCDCFile, const string &sResourceName="")
| Save the AudioTrack into a CDC file.
Sint32 | CRM64Pro::AudioTrack::save (const Sint32 idCDC, const string &sResourceName="")
| Save the AudioTrack into a CDC file.
bool | CRM64Pro::AudioTrackMgr::info (Sint32 iMode=0) override
| Request AudioTrack Manager information.
bool | CRM64Pro::AudioTrackMgr::close (Sint32 idAudio=0) override
| Close and destroy an AudioTrack.
Sint32 | CRM64Pro::AudioTrackMgr::getCount () const override
| Get number of loaded objects.
Sint32 | CRM64Pro::AudioTrackMgr::setName (Sint32 idAudio, const string &sName) override
| Change the object name.
AudioTrack * | CRM64Pro::AudioTrackMgr::get (Sint32 idAudio=0)
| Get a pointer to the AudioTrack using its handler.
bool | CRM64Pro::AudioTrackMgr::stopAll ()
| Immediately stop all active audio tracks.
bool | CRM64Pro::AudioTrackMgr::fadeOutAll (Sint32 iTimeMS=1000)
| Fade out all active audio tracks to silence, then stop.
bool | CRM64Pro::AudioTrackMgr::pauseAll ()
| Pause all active audio tracks.
bool | CRM64Pro::AudioTrackMgr::resumeAll ()
| Resume all paused audio tracks.
bool | CRM64Pro::AudioTrackMgr::stopTag (eAudioTrackTag eTag)
| Stop all tracks of a specific audio track tag category.
bool | CRM64Pro::AudioTrackMgr::fadeOutTag (eAudioTrackTag eTag, Sint32 iTimeMS=1000)
| Fade out all tracks of a specific audio track tag category.
bool | CRM64Pro::AudioTrackMgr::pauseTag (eAudioTrackTag eTag)
| Pause all tracks of a specific audio track tag category.
bool | CRM64Pro::AudioTrackMgr::resumeTag (eAudioTrackTag eTag)
| Resume all tracks of a specific audio track tag category.
bool | CRM64Pro::AudioTrackMgr::setKeepSourceData (bool bKeep)
| Set the global policy for keeping raw source data in memory.
bool | CRM64Pro::AudioTrackMgr::getKeepSourceData () const
| Get the current policy for keeping raw source data.
Sint32 | CRM64Pro::AudioTrackMgr::loadFromFile (const string &sFile, const string &sName="", eAudioTrackTag eTag=ATT_SFX, eAudioLoadMode eMode=ALM_AUTO, Sint32 iUnique=0)
| Load an AudioTrack from an external file.
Sint32 | CRM64Pro::AudioTrackMgr::load (const string &sCDCFile, const string &sName, Sint32 iUnique=0)
| Load an AudioTrack from a CDC file (by file name).
Sint32 | CRM64Pro::AudioTrackMgr::load (const Sint32 idCDC, const string &sName, Sint32 iUnique=0)
| Load an AudioTrack from a CDC file (by ID).
Sint32 | CRM64Pro::AudioTrackMgr::loadFromBuffer (const void *pBuffer, Sint32 iSize, const string &sName, const string &sFormat, eAudioTrackTag eTag=ATT_SFX)
| Load an AudioTrack from a raw memory buffer.
Sint32 | CRM64Pro::AudioTrackMgr::remove (Sint32 idCDC, const string &sName)
| Remove an AudioTrack stored in a CDC file.
bool | CRM64Pro::AudioTrackMgr::exist (Sint32 idCDC, const string &sName)
| Check if an AudioTrack is stored in a CDC file.
bool | CRM64Pro::AudioTrackMgr::exist (const string &sCDCFile, const string &sName)
| Check if an AudioTrack is stored in a CDC file.

## Enumeration Type Documentation

## ◆ eAudioTrackTag

enum CRM64Pro::eAudioTrackTag

Audio track category tags for grouping and batch operations.

Enumerator
ATT_MUSIC | Background music track.
ATT_SFX | Sound effect track.
ATT_VOICE | Voice/dialogue track.
ATT_CUSTOM | Custom user-defined track type.

## ◆ eAudioType

enum CRM64Pro::eAudioType

Audio codec/format type.

Enumerator
AT_NONE | No type or uninitialized.
AT_WAV | WAV, RIFF, AIFF, or VOC audio type.
AT_MOD | Module audio type (MOD, XM, IT, etc.).
AT_OGG | OGG Vorbis audio type.
AT_MP3 | MP3 audio type.
AT_FLAC | FLAC audio type.
AT_UNKNOWN | Unknown or unsupported type.

## ◆ eAudioLoadMode

enum CRM64Pro::eAudioLoadMode

Audio loading strategy.

Enumerator
ALM_AUTO | Automatically select based on file size/type.
ALM_PRELOAD | Preload entire audio into memory (best for SFX).
ALM_STREAM | Stream audio from file on-demand (best for music).

## Function Documentation

## ◆ info() [1/2]

bool CRM64Pro::AudioTrack::info | ( | Sint32 | iMode = 0 | ) |
| override

Request AudioTrack information.

Writes information to the default log.

Parameters

  iMode | unused for the time being.

Returns
  true on success, or false on failure.

## ◆ getName()

const string & CRM64Pro::AudioTrack::getName | ( |  | ) | const
| override

Get the name.

Returns
  The object name.

## ◆ getID()

Uint32 CRM64Pro::AudioTrack::getID | ( |  | ) | const
| override

Get the ID.

Returns
  Object ID.

## ◆ getInfo()

bool CRM64Pro::AudioTrack::getInfo | ( | string * | sType,
|  | AudioInfo * | pAI ) const

Get AudioTrack detailed information.

Parameters

  sType | a string pointer filled with the input file extension. If nullptr, this value is not retrieved.
  pAI | a pointer to an AudioInfo struct. If nullptr, this struct is not retrieved.

Returns
  true on success, or false on failure.

## ◆ play()

bool CRM64Pro::AudioTrack::play | ( | Sint32 | iLoop = 0 | ) |

Play the track.

Parameters

  iLoop | 0 = play once, -1 = infinite, >0 = specific number of loops.

Returns
  true on success or false on failure.

## ◆ fadeIn()

bool CRM64Pro::AudioTrack::fadeIn | ( | Sint32 | iTimeMS = 1000,
|  | Sint32 | iLoop = 0 )

Play the track with a fade-in effect.

Creates a new hardware track, assigns the audio data, applies current properties (Gain, Pitch, Pan), and starts playback.

Parameters

  iTimeMS | Time in milliseconds for the fade-in effect. 0 for instant playback.
  iLoop | Number of loops. 0 = play once, -1 = infinite, >0 = specific number of additional loops.

Returns
  true on success or false on failure.

## ◆ fadeOut()

bool CRM64Pro::AudioTrack::fadeOut | ( | Sint32 | iTimeMS = 1000 | ) |

Fade out all instances of this track to silence, then stop.

Parameters

  iTimeMS | Time in milliseconds for the fade-out effect.

Returns
  true on success or false on failure.

## ◆ stop()

bool CRM64Pro::AudioTrack::stop | ( |  | ) |

Immediately stop all instances of this track.

Returns
  true on success or false on failure.

## ◆ pause()

bool CRM64Pro::AudioTrack::pause | ( |  | ) |

Pause all instances of this track.

Returns
  true on success or false on failure.

## ◆ resume()

bool CRM64Pro::AudioTrack::resume | ( |  | ) |

Resume all instances of this track.

Returns
  true on success or false on failure.

## ◆ getPosition()

Sint32 CRM64Pro::AudioTrack::getPosition | ( |  | ) | const

Get the current playback position.

Retrieves the current time position of the active track instance.

Returns
  The position in milliseconds, or -1 if the track is not playing or invalid.

## ◆ setPosition()

bool CRM64Pro::AudioTrack::setPosition | ( | Sint32 | iTimeMS | ) |

Set the playback position (Seek).

Jumps to a specific time in the audio track. If the track is currently playing, it seeks immediately.

Parameters

  iTimeMS | The position in milliseconds to seek to.

Returns
  true on success or false on failure.

## ◆ setPitch()

bool CRM64Pro::AudioTrack::setPitch | ( | float | fPitch | ) |

Set Pitch (Frequency Ratio).

Sets the pitch for future playbacks. If the track is currently playing, it updates the sound immediately.

Parameters

  fPitch | 1.0f = Normal, 0.5f = Half speed, 2.0f = Double speed.

Returns
  true on success or false on failure.

## ◆ getPitch()

float CRM64Pro::AudioTrack::getPitch | ( |  | ) | const

Get current pitch property.

Returns
  The current pitch value.

## ◆ setPanning()

bool CRM64Pro::AudioTrack::setPanning | ( | Uint8 | iLeft,
|  | Uint8 | iRight )

Set Stereo Panning.

Sets panning for future playbacks. If the track is currently playing, it updates the sound immediately.

Parameters

  iLeft | 0-255.
  iRight | 0-255.

Returns
  true on success or false on failure.

## ◆ setLoopPoints()

bool CRM64Pro::AudioTrack::setLoopPoints | ( | double | dStartSec,
|  | double | dEndSec )

Set Loop Points.

Sets loop region for future playbacks.

Parameters

  dStartSec | Start of loop in seconds.
  dEndSec | End of loop in seconds (or -1 for end of file).

Returns
  true on success or false on failure.

## ◆ setDistance()

bool CRM64Pro::AudioTrack::setDistance | ( | Uint8 | iDistance | ) |

Set 3D Distance Attenuation.

Sets the distance simulation for future playbacks. If the track is currently playing, it updates the sound immediately. SDL_mixer's distance effect attenuates volume as distance increases.

Parameters

  iDistance | 0 (closest/loudest) to 255 (farthest/quietest).

Returns
  true on success or false on failure.

## ◆ setPosition3D()

bool CRM64Pro::AudioTrack::setPosition3D | ( | Sint16 | iAngle,
|  | Uint8 | iDistance )

Set 3D Angular Position.

Sets the 3D position for future playbacks. If the track is currently playing, it updates the sound immediately. Simulates sound source direction relative to listener (at center).

Parameters

  iAngle | Angle in degrees (0 = front, 90 = right, 180 = back, 270 = left).
  iDistance | Distance attenuation (0-255).

Returns
  true on success or false on failure.

## ◆ setTag()

bool CRM64Pro::AudioTrack::setTag | ( | eAudioTrackTag | eTag | ) |

Set Track Tag category.

Updates the tag category (Music, SFX, Voice) and immediately re-calculates gain for active instance. This allows changing a track from "SFX" to "Music" and having it instantly adopt the Music volume level.

Parameters

  eTag | The new track type.

Returns
  true on success or false on failure.

## ◆ getTag()

eAudioTrackTag CRM64Pro::AudioTrack::getTag | ( |  | ) | const

Get Track Tag category.

Returns
  The current eAudioTrackTag.

## ◆ saveToFile()

Sint32 CRM64Pro::AudioTrack::saveToFile | ( | const string & | sFile | ) |

Export the AudioTrack to an external file.

Parameters

  sFile | string containing the [directory]+filename. Extension is automatically corrected.

Returns
  0 or greater on success or a negative error code on failure.

Note
  Only works if 'Keep Source Data' was enabled during load.

## ◆ save() [1/2]

Sint32 CRM64Pro::AudioTrack::save | ( | const string & | sCDCFile,
|  | const string & | sResourceName = "" )

Save the AudioTrack into a CDC file.

Parameters

  sCDCFile | Path to the CDC archive.
  sResourceName | Optional resource name to use in the CDC. If empty (default), uses the AudioTrack object's internal name.

Returns
  greater than 0 on success, or a negative error code on failure.

## ◆ save() [2/2]

Sint32 CRM64Pro::AudioTrack::save | ( | const Sint32 | idCDC,
|  | const string & | sResourceName = "" )

Save the AudioTrack into a CDC file.

Parameters

  idCDC | CDC id.
  sResourceName | Optional resource name to use in the CDC. If empty (default), uses the AudioTrack object's internal name.

Returns
  greater than 0 on success, or a negative error code on failure.

Note
  Only works if 'Keep Source Data' was enabled during load.

## ◆ info() [2/2]

bool CRM64Pro::AudioTrackMgr::info | ( | Sint32 | iMode = 0 | ) |
| override

Request AudioTrack Manager information.

Writes information to the default log.

Parameters

  iMode | -1 for displaying only Manager information. 0 (default) for displaying Manager and all Objects information.

Returns
  true on success, or false on failure.

## ◆ close()

bool CRM64Pro::AudioTrackMgr::close | ( | Sint32 | idAudio = 0 | ) |
| override

Close and destroy an AudioTrack.

Parameters

  idAudio | 0 (default) for closing all tracks, or a specific AudioTrack id. If playing, it will be stopped immediately.

Returns
  true if at least one AudioTrack was closed, or false if nothing was closed.

## ◆ getCount()

Sint32 CRM64Pro::AudioTrackMgr::getCount | ( |  | ) | const
| override

Get number of loaded objects.

Returns
  the number of AudioTrack objects.

## ◆ setName()

Sint32 CRM64Pro::AudioTrackMgr::setName | ( | Sint32 | idAudio,
|  | const string & | sName )
| override

Change the object name.

Parameters

  idAudio | AudioTrack id.
  sName | The new name. Must be unique.

Returns
  0 on success, or a negative error code on failure.

## ◆ get()

AudioTrack * CRM64Pro::AudioTrackMgr::get | ( | Sint32 | idAudio = 0 | ) |

Get a pointer to the AudioTrack using its handler.

Parameters

  idAudio | AudioTrack id.

Returns
  nullptr if not found.
  A pointer to the AudioTrack object.

## ◆ stopAll()

bool CRM64Pro::AudioTrackMgr::stopAll | ( |  | ) |

Immediately stop all active audio tracks.

Stops all playback on the mixer device.

Returns
  true on success or false on failure.

## ◆ fadeOutAll()

bool CRM64Pro::AudioTrackMgr::fadeOutAll | ( | Sint32 | iTimeMS = 1000 | ) |

Fade out all active audio tracks to silence, then stop.

Parameters

  iTimeMS | Time in milliseconds for the fade-out effect. Default 1000ms.

Returns
  true on success or false on failure.

## ◆ pauseAll()

bool CRM64Pro::AudioTrackMgr::pauseAll | ( |  | ) |

Pause all active audio tracks.

Returns
  true on success or false on failure.

## ◆ resumeAll()

bool CRM64Pro::AudioTrackMgr::resumeAll | ( |  | ) |

Resume all paused audio tracks.

Returns
  true on success or false on failure.

## ◆ stopTag()

bool CRM64Pro::AudioTrackMgr::stopTag | ( | eAudioTrackTag | eTag | ) |

Stop all tracks of a specific audio track tag category.

Iterates through all managed AudioTrack objects of the given tag category and stops them.

Parameters

  eTag | The tag category to stop (Music, SFX, etc).

Returns
  true on success or false on failure.

## ◆ fadeOutTag()

bool CRM64Pro::AudioTrackMgr::fadeOutTag | ( | eAudioTrackTag | eTag,
|  | Sint32 | iTimeMS = 1000 )

Fade out all tracks of a specific audio track tag category.

Iterates through all managed AudioTrack objects of the given tag category and fades them out.

Parameters

  eTag | The tag category to fade out (Music, SFX, etc).
  iTimeMS | Time in milliseconds for the fade-out effect. Default 1000ms.

Returns
  true on success or false on failure.

## ◆ pauseTag()

bool CRM64Pro::AudioTrackMgr::pauseTag | ( | eAudioTrackTag | eTag | ) |

Pause all tracks of a specific audio track tag category.

Iterates through all managed AudioTrack objects of the given tag category and pauses them.

Parameters

  eTag | The tag category to pause.

Returns
  true on success or false on failure.

## ◆ resumeTag()

bool CRM64Pro::AudioTrackMgr::resumeTag | ( | eAudioTrackTag | eTag | ) |

Resume all tracks of a specific audio track tag category.

Iterates through all managed AudioTrack objects of the given tag category and resumes them.

Parameters

  eTag | The tag category to resume.

Returns
  true on success or false on failure.

## ◆ setKeepSourceData()

bool CRM64Pro::AudioTrackMgr::setKeepSourceData | ( | bool | bKeep | ) |

Set the global policy for keeping raw source data in memory.

If enabled, subsequent load operations will cache the original raw bytes in RAM. This allows the use of AudioTrack::save() and AudioTrack::saveToFile().

Warning
  Enabling this increases memory usage significantly (Raw Data + Decoded Audio). It is recommended to enable this only for Editors/Tools, and keep it disabled (default) for Games.

Parameters

  bKeep | true to cache raw data, false to discard it.

Returns
  true on success, or false on failure.

## ◆ getKeepSourceData()

bool CRM64Pro::AudioTrackMgr::getKeepSourceData | ( |  | ) | const

Get the current policy for keeping raw source data.

Returns
  true if raw data is being cached, false otherwise.

## ◆ loadFromFile()

Sint32 CRM64Pro::AudioTrackMgr::loadFromFile | ( | const string & | sFile,
|  | const string & | sName = "",
|  | eAudioTrackTag | eTag = ATT_SFX,
|  | eAudioLoadMode | eMode = ALM_AUTO,
|  | Sint32 | iUnique = 0 )

Load an AudioTrack from an external file.

Parameters

  sFile | string containing [directory]+filename+[extension]. Directory separators '\' and '/' are supported.
  sName | Object name. If empty, filename is used (without extension). Max 64 characters.
  eTag | The tag category (SFX, Music, etc).
  eMode | Loading strategy (Preload to RAM or Stream from disk).
  iUnique | 1 forces a new object creation even if an object with this name exists.

Note
  If iUnique is 0 and an object with the same name already exists, the existing object's ID is returned.

Returns
  AudioTrack ID on success, negative on error.

## ◆ load() [1/2]

Sint32 CRM64Pro::AudioTrackMgr::load | ( | const string & | sCDCFile,
|  | const string & | sName,
|  | Sint32 | iUnique = 0 )

Load an AudioTrack from a CDC file (by file name).

Parameters

  sCDCFile | Path to the CDC archive file.
  sName | Object name.
  iUnique | 1 forces a new object creation even if an object with this name exists.

Returns
  AudioTrack ID on success, negative on error.

Note
  Always forces ALM_PRELOAD (RAM) logic as streaming from a CDC archive is not supported.

## ◆ load() [2/2]

Sint32 CRM64Pro::AudioTrackMgr::load | ( | const Sint32 | idCDC,
|  | const string & | sName,
|  | Sint32 | iUnique = 0 )

Load an AudioTrack from a CDC file (by ID).

Parameters

  idCDC | CDC archive ID.
  sName | Object name stored in the archive.
  iUnique | 1 forces a new object creation.

Returns
  AudioTrack ID on success, negative on error.

Note
  Always forces ALM_PRELOAD (RAM) logic as streaming from a CDC archive is not supported.

## ◆ loadFromBuffer()

Sint32 CRM64Pro::AudioTrackMgr::loadFromBuffer | ( | const void * | pBuffer,
|  | Sint32 | iSize,
|  | const string & | sName,
|  | const string & | sFormat,
|  | eAudioTrackTag | eTag = ATT_SFX )

Load an AudioTrack from a raw memory buffer.

Parameters

  pBuffer | Pointer to the raw audio data (WAV, OGG, etc).
  iSize | Size of the buffer in bytes.
  sName | Object name. It will be used as source file name together with format.
  sFormat | Audio format of the buffer (AIFF, WAV, VOC, OGG, FLAC, MP3, MOD, XM, S3M, etc).
  eTag | The category tag (SFX, Music, etc).

Returns
  AudioTrack ID on success, negative on error.

Note
  The buffer is copied internally. The user is responsible for the original buffer.

## ◆ remove()

Sint32 CRM64Pro::AudioTrackMgr::remove | ( | Sint32 | idCDC,
|  | const string & | sName )

Remove an AudioTrack stored in a CDC file.

Parameters

  idCDC | CDC id.
  sName | string with the AudioTrack name (maximum size of 64 characters).

Returns
  greater than 0 on success, or a negative error code on failure.

## ◆ exist() [1/2]

bool CRM64Pro::AudioTrackMgr::exist | ( | Sint32 | idCDC,
|  | const string & | sName )

Check if an AudioTrack is stored in a CDC file.

Parameters

  idCDC | CDC id.
  sName | string with the AudioTrack name (maximum size of 64 characters).

Returns
  true on success(it exists) or false on failure (it does not exist).

Note
  It is normally used for checking if an audio track is present without throwing any error.

## ◆ exist() [2/2]

bool CRM64Pro::AudioTrackMgr::exist | ( | const string & | sCDCFile,
|  | const string & | sName )

Check if an AudioTrack is stored in a CDC file.

Parameters

  sCDCFile | Path to the CDC archive file.
  sName | string with the AudioTrack name (maximum size of 64 characters).

Returns
  true on success(it exists) or false on failure (it does not exist).

Note
  It is normally used for checking if an audio track is present without throwing any error.