func init() lng.decl_priv_var(FMOD_CreateSound, 'FMOD_SOUND*') println(FMOD_CreateSound + ' = NULL;') if(linked(Length)) lng.decl_priv_var(len, 'unsigned int') end end func doRelease(_data) println('if(' + FMOD_CreateSound + ') {') block.inclvl() println('FMOD_Sound_Release(' + FMOD_CreateSound + ');') println(FMOD_CreateSound + ' = NULL;') block.declvl() println('}') end func doCreateSound(_data) if(isdef(AutoRelease)) doRelease(_data) end if(isndef(SoundSystem)) lng.decl_loc_var(res, 'FMOD_RESULT') println(res + ' = FMOD_System_CreateSound(' + lng.get_linked_obj('SoundSystem') + ', QString(', FileName, ').toLocal8Bit().constData(), ', Mode, ', 0, &' + FMOD_CreateSound + ');') println('if(' + res + ' == FMOD_OK) {') block.inclvl() event(onCreateSound) block.declvl() if(linked(onError)) println('} else {') block.inclvl() event(onError, res@int ^ ('FMOD_ErrorString(' + res + ')')@str) block.declvl() end println('}') else error("Please set SoundSystem property.") end end func Length(_data) println('if(' + FMOD_CreateSound + ')') println(' FMOD_Sound_GetLength(' + FMOD_CreateSound + ', &' + len + ', FMOD_TIMEUNIT_' + code(TimeUnit) + ');') println('else ' + len + ' = 0;') return(len) end