On Sun, Apr 20, 2008 at 5:20 PM, Brian Gryder <[EMAIL PROTECTED]> wrote:
> I am an novice C# programmer. I am experimenting with GTK# and am trying to
> play audio on a button click with the Gnome.Sound.Play method. It will
> compile but not play audio. What is correct usage of the Gnome.Sound.Play
> method?
>
> -------------------------------------------------------------------------------------
> using Glade;
> using Gtk;
> using System;
> using Gnome;
>
> class myWindow
> {  // start class
>     public myWindow ()
>
>         { // start mywindow
>         Glade.XML gui = new Glade.XML ("./test2/test2.glade","window1","");
>         gui.Autoconnect (this);
>         } // end mywindow
>
>      void on_button_clicked (object o,EventArgs e)
>         { //start click event
>             Console.WriteLine ("button clicked")
>             Gnome.Sound.Init ("/home/user/test.wav"); //<--------is this
> correct?
>              Gnome.Sound.Play ("/home/user/test.wav"); //<--------is this
> correct?
>         } //end click event
>
> } // End class
>
> class theotherpart
>
> {  // start class
>  static void Main ()
>      { //start main
>         Gtk.Application.Init ();
>         myWindow W = new myWindow ();
>         Gtk.Application.Run ();
>     } //End main
> } // End class
>
> _______________________________________________
>  Gtk-sharp-list maillist  -  [email protected]
>  http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
>

As far as I can tell from the GNOME docs
(http://library.gnome.org/devel/libgnome/stable/libgnome-gnome-sound.html)
and the parameter names in the GNOME# API
(http://www.go-mono.com/docs/[EMAIL PROTECTED]),
this GNOME sound API works by connecting to an ESD sound player
daemon. The Init method takes the hostname of this daemon. Normally
I'd expect that you'd use "localhost" for the local machine, unless
you want to play sound over the network :-)

Hence the following probably works:

Gnome.Sound.Init ("localhost");
Gnome.Sound.Play ("/home/user/test.wav");

-- 
Michael Hutchinson
http://mjhutchinson.com
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to