Page 1 of 1

Sound?

Posted: 23 Mar 2018, 07:19
by GeorgeR
I've read a few ways of playing a sound on for example a button click in xaml, but when i search the noesis include files for "sound", nothing comes up so I assume they aren't supported. Is there a way of triggering sound in xaml or eloquent way of handling this with the host application? I'm going to have a LOT more event handlers if I can't do it through xaml...

Re: Sound?

Posted: 23 Mar 2018, 17:00
by hcpizzi
Hi George,

We are currently working on implementing XAML Behaviors (https://github.com/Microsoft/XamlBehaviors/wiki). It's meant to be a way to add interactivity in a declarative way, without having to write a lot of code.

Among other things, it allows you to trigger actions based on events, and one of the action classes is PlaySoundAction (https://github.com/Microsoft/XamlBehavi ... oundAction).

Re: Sound?

Posted: 23 Mar 2018, 17:57
by GeorgeR
"Sounds" good.

Re: Sound?

Posted: 27 Mar 2018, 11:39
by ai_enabled
You might be interested in how sounds are added in XAML in our game http://cryofall.com
The game ships with the completely open source code of UI and game logic. The game is currently available for free (open alpha).
It's a huge volume of educational material for any game developer, especially interesting in technologies like NoesisGUI, XAML and C#.

The class you're interested in particular is SoundUI and we're using it in XAML to assign sounds to different actions (such as click and mouse enter). In this class, you can see how we handle the events and call game API to play the sound.

Regards!

Re: Sound?

Posted: 27 Mar 2018, 15:51
by GeorgeR
You might be interested in how sounds are added in XAML in our game http://cryofall.com
The game ships with the completely open source code of UI and game logic. The game is currently available for free (open alpha).
It's a huge volume of educational material for any game developer, especially interesting in technologies like NoesisGUI, XAML and C#.

The class you're interested in particular is SoundUI and we're using it in XAML to assign sounds to different actions (such as click and mouse enter). In this class, you can see how we handle the events and call game API to play the sound.

Regards!
Thanks, i'll definately take a look at this!

Re: Sound?

Posted: 27 Mar 2018, 17:14
by sfernandez
While behaviors API is not available there are some alternatives you can use.

In C++ you can extend TriggerAction class to create your own SoundPlayerAction that can be used as a response to an EventTrigger for example.
You can also use some attached properties to add the sound behavior as you require.

We can help if you need more detail on any solution you want to follow.