Build sound

Structure of what's called by build_sound tool:

Cliquez pour afficher ⇲

Cliquez pour masquer ⇱

main (build_sound.cpp):

Check arguments
Add search paths
Create audioMixer (UAudioMixer = CAudioMixerUser)
Set SamplePath and Packed Sheet options
CAudioMixerUser::init (audio_mixer_user.cpp)


CAudioMixerUser::init (audio_mixer_user.cpp):

initDriver (audio_mixer_user.cpp)
Set init infos
initDevice (audio_mixer_user.cpp)


CAudioMixerUser::initDevice (audio_mixer_user.cpp):

Check driver initialized
Get init infos
Init sound driver with options
Init Listener
Init environment reverb effects (with environment definition)
Set default Environment
Init tracks
Init reserve
buildSampleBankList if update packed sheets is true, like in this case from build_sound.cpp (audio_mixer_user.cpp)
Init music channels
Create background sound and music managers
Load sound bank
Init sample bank manager
Load configuration from george sheet default.mixer_config
initUserVar (audio_mixer_user.cpp)


CAudioMixerUser::buildSampleBankList (audio_mixer_user.cpp):

Build list of sample bank directories
Build list of sample bank files *.sample_bank
Compare one by one bank file and sample file
	more Bank Files than in list or Bank File not present yet (bankFile[i] > bankname)
	     buildSampleBank and write on disk (audio_mixer_user.cpp)
	     Insert/Append Bank File to list
	Bank File out of date (bankname < bankDir[i])
	     Delete Bank File on disc
	     Delete Bank File from list
	Bank File still present
	     Read Bank File header
	     Check if same file name
	     	   not up to date / upToDate = false
	     Check if changed modification date
	     	   not up to date / upToDate = false
	     Check if not up to date
	     	   Delete Bank File on disc
		   Delete Bank File from list
Delete Bank Files on disc that are no more in list
Update SearchPath by readding it


initUserVar (audio_mixer_user.cpp):

Clear _UserVarControls
Create temporary Container
Load the sound_group sheets into Temporary container(::loadForm / load_form.h [L851])
Fill real container
Update the Controller for all existing sounds


loadForm (load_form.h [Line 851]):

Create various Containers (dictionnary, dictionnaryIndex, dependencies, dependencyDates)
Make sure that the packed file includes .packed_sheets
Get full path to the packed file
Open the packed file
Check packed sheet headers (header, version, compatible version)
Get block size of dependencies
If packed sheet should be updated
   read the dependency dictionary
   get the block size of dependency data
   save dependency data in dependencies[sheetName]
Else if block size of dependcies > 0 (got dependencies)
   read dependencies into dummy container
Read number of entries in packed sheet
Read version of packed sheet
If packed sheet version is not same as in code
   throw error
   continue to rebuild packed sheet if wanted
Read packed sheet data into container (NLMISC::CIFile::serialCont(container))
Close packed file
If packed sheet shouldn't be updated
   End
Get file modification date of each dependency
Make a list of files with sheed ids of selected Filters -> sheetNames
If no files
   End
Mark all current sheets in container for removal
Get modification date of packed sheet
For each file in sheetNames
    if file doesn't exist
       jump
    mark not needed to remove
    if file was modified after packed sheet or not in packed sheet yet
       mark to recompute
    else if dependency of file was modified after packed sheet
       mark to recompute
Prepare things to show how long it still takes to recompute
Create georges loader if needed (NLGEORGES::UFormLoader::createLoader)
Load form with given sheet id
Ajust the dependencies
Add the sheet into the container
Overwrite with new sheet if already loaded
Mark container as changed
Remove the sheets marked for removal
Write new packed sheets file