0

sorry for my bad English and straight forwarding.

i have something about the coding to ask...

i would like to ask, is it possible to add sound for all the button?

seems like the button with a "click" sound when it is selected would be nice.

anyone have any idea to do it?

is it add the .wav file source in somewhere here?

    new BrushSelection(
        new Uri("/KinectPaint;component/Resources/pen-unselected.png", UriKind.RelativeOrAbsolute), 
        new Uri("/KinectPaint;component/Resources/pen-selected.png", UriKind.RelativeOrAbsolute), 
        KinectPaintbrush.Marker, 
        "pen"),

or

SoundPlayer ClickSound = new SoundPlayer(@"c:\Media\ClickSound.wav");
    ClickSound.Play();
C4 - Travis
  • 4,502
  • 4
  • 31
  • 56
  • Ok, if I'm correct you have to have some onclick action or something like this. So can't you just play the sound in this onclick action ? – Fixus Apr 14 '12 at 11:31

2 Answers2

0

I got this code to work, once you defined the PlaySound Method, go to select all of the buttons on the wpf and chose the EventHandler Setting under propertys, and add the PlaySound method to the CLick event, and obviously startSoundPlayer is going to be whatever you want to call your sound player. Oh and this is using Wpf

 namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }

    System.Media.SoundPlayer startSoundPlayer = new System.Media.SoundPlayer(@"C:\Windows\Media\chord.wav");



    private void PlaySound(object sender, RoutedEventArgs e)
    {
        startSoundPlayer.Play();
    }

Hope This Helps

Liam McInroy
  • 4,339
  • 5
  • 32
  • 53
0

You can have an event handler for the button in which it will trigger the sound clip to be played.

Jagger
  • 10,350
  • 9
  • 51
  • 93
LZH
  • 775
  • 1
  • 7
  • 15