GeorgeR
Topic Author
Posts: 39
Joined: 15 Mar 2018, 01:06

Sound?

23 Mar 2018, 07:19

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...
 
User avatar
hcpizzi
Site Admin
Posts: 236
Joined: 09 Feb 2012, 12:40

Re: Sound?

23 Mar 2018, 17:00

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).
 
GeorgeR
Topic Author
Posts: 39
Joined: 15 Mar 2018, 01:06

Re: Sound?

23 Mar 2018, 17:57

"Sounds" good.
 
User avatar
ai_enabled
Posts: 221
Joined: 18 Jul 2013, 05:28
Contact:

Re: Sound?

27 Mar 2018, 11:39

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!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
GeorgeR
Topic Author
Posts: 39
Joined: 15 Mar 2018, 01:06

Re: Sound?

27 Mar 2018, 15:51

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!
 
User avatar
sfernandez
Site Admin
Posts: 1911
Joined: 22 Dec 2011, 19:20

Re: Sound?

27 Mar 2018, 17:14

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.

Who is online

Users browsing this forum: samc and 2 guests