there's something which is pissing me off since some time ago and not sure if it is a bug or just me... for some reason, the first time I hit play in the editor, the sounds are not available (I got a bell sound, which I guess it's the default one). Sometimes gets fixed when stop and play again, but sometimes the bell sound continues until I add the sounds folder to the resources in the asset manager. I have to add that folder to the resources every time I launch Skyline.
Here's the code related to the sounds:
- Code: Select all
-- ======== SOUNDS ===========
sound_music = 0
sound_page = 0
sound_click = 0
sound_beep = 0
sound_check = 0
sound_error = 0
sound_cash = 0
-- |=================================================================
-- | ON INIT
-- |=================================================================
function Sound_onInit()
-- ========= SOUNDS ====================================
LoadAllSounds()
--PlaySound( "sound_music" )
end
-- |=================================================================
-- | END ON INIT
-- |=================================================================
-- ============================== SOUNDS ===================================
function LoadAllSounds()
sound_music = LoadSound( 1, 1, "MR_MUSIC_menu2.ogg", 0 )
sound_page = LoadSound( 0, 1, "MR_MENU_page.ogg", 0 )
sound_click = LoadSound( 0, 1, "MR_MENU_clic.ogg", 0 )
sound_beep = LoadSound( 0, 0.5, "MR_MENU_beep.ogg", 0 )
sound_check = LoadSound( 0, 1, "MR_MENU_check.ogg", 0 )
sound_error = LoadSound( 0, 1, "MR_MENU_error.ogg", 0 )
sound_cash = LoadSound( 0, 1, "MR_MENU_cash.ogg", 0 )
end
function LoadSound( loop, volume, soundfile, stream )
sound.setLooped( loop )
sound.setVolume( volume )
sound.setSoundFile( soundfile )
sound.setIsStreamed( stream )
return sound.create2DSound()
end
function PlaySound( thesound )
if (thesound == "sound_music") then sound.play2DSound( sound_music ) end
if (thesound == "sound_page") then sound.play2DSound( sound_page ) end
if (thesound == "sound_click") then sound.play2DSound( sound_click ) end
if (thesound == "sound_beep") then sound.play2DSound( sound_beep ) end
if (thesound == "sound_check") then sound.play2DSound( sound_check ) end
if (thesound == "sound_error") then sound.play2DSound( sound_error ) end
if (thesound == "sound_cash") then sound.play2DSound( sound_cash ) end
end
Sounds are .ogg format, not sure if they must be in a specific frequency, mono or stereo, etc.
This issue is prior to the script "splitting", so I'm pretty sure that's not the problem. If you need more info just tell me.
![Smile :)](./images/smilies/icon_e_smile.gif)
Cheers!