     audio.masterGain[SOUND_MUSIC] = newVolume;
 }
 
-void HandleSoundFinished(StringHash eventType, VariantMap& eventData)
-{
-    Node@ soundNode = eventData["Node"].GetPtr();
-    soundNode.Remove();
-}
-
 // Create XML patch instructions for screen joystick layout specific to this sample app
 String patchInstructions =
         "<patch>" +


void CreateUI()
{
    // Create a scene which will not be actually rendered, but is used to hold SoundSource components while they play sounds
    scene_ = Scene();

    XMLFile@ uiStyle = cache.GetResource("XMLFile", "UI/DefaultStyle.xml");
    // Set style to the UI root so that elements will inherit it
    ui.root.defaultStyle = uiStyle;


    if (sound !is null)
    {
        // Create a SoundSource component for playing the sound. The SoundSource component plays
        // non-positional audio, so its 3D position in the scene does not matter. For positional sounds the
        // SoundSource3D component would be used instead
        SoundSource@ soundSource = scene_.CreateComponent("SoundSource");
        soundSource.autoRemoveMode = REMOVE_COMPONENT;
        soundSource.Play(sound);
        // In case we also play music, set the sound volume below maximum so that we don't clip the output
        soundSource.gain = 0.7f;
    }
}

void HandlePlayMusic(StringHash eventType, VariantMap& eventData)
{
    Sound@ music = cache.GetResource("Sound", "Music/Ninja Gods.ogg");
    // Set the song to loop
    music.looped = true;

    musicSource.Play(music);
}

void HandleStopMusic(StringHash eventType, VariantMap& eventData)
{
    musicSource.Stop();
}

void HandleSoundVolume(StringHash eventType, VariantMap& eventData)
