timday
Topic Author
Posts: 2
Joined: 21 Feb 2020, 04:05

Playing sound on GotFocus event - not ideal for gamepad controls

30 Jun 2020, 08:26

Hi, new to the forum and hoping the problem I'm experiencing is just an oversight on my behalf.

At the moment, I am using the GotFocus triggered event on menu items to play a sound as the user navigates around, just like the Noesis samples.

This works fine when the user is using gamepad inputs to navigate the screen. But upon a screen first loading up we set the focus to the first element - and this of course triggers the sound. But as the user did not navigate to the element themselves this sound is out of place and undesirable.

The sample project demos either don't focus an element upon a screen loading (mouse input only, this does not work for gamepad input), or they tie the element focus with a visual animation to give the sound some context - I am specifically referring to the Menu3D sample in this case - but our menus have the focused element already highlighted on load so the sound is not tied to anything and shouldn't be played.

Any feedback greatly appreciated, thanks.
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Playing sound on GotFocus event - not ideal for gamepad controls

03 Jul 2020, 14:27

Assuming you are setting the focus when screen gets loaded, you can disable the sound action during that initial focus:
<i:Interaction.Triggers>
    <i:EventTrigger EventName="Loaded">
        <ei:ChangePropertyAction PropertyName="IsEnabled" Value="False" TargetName="FocusSound"/>
        <noesis:SetFocusAction/>
        <ei:ChangePropertyAction PropertyName="IsEnabled" Value="True" TargetName="FocusSound"/>
    </i:EventTrigger>
    <i:EventTrigger EventName="GotFocus">
        <ei:PlaySoundAction x:Name="FocusSound" Source="Focus.mp3"/>
    </i:EventTrigger>
</i:Interaction.Triggers>
 
timday
Topic Author
Posts: 2
Joined: 21 Feb 2020, 04:05

Re: Playing sound on GotFocus event - not ideal for gamepad controls

08 Jul 2020, 06:43

That's great, thanks!

Who is online

Users browsing this forum: Google [Bot] and 66 guests