Re: RFC: GSound, a GObject library for playing system sounds
- From: Tristan Brindle <tcbrindle gmail com>
- To: Richard Hughes <hughsient gmail com>
- Cc: desktop-devel-list <desktop-devel-list gnome org>
- Subject: Re: RFC: GSound, a GObject library for playing system sounds
- Date: Fri, 5 Dec 2014 13:42:55 +0800
On 5 Dec 2014, at 12:29 am, Tristan Brindle <t c brindle gmail com> wrote:
Alternatively, a few minutes of Googling has turned up that Mac OS has its own high level sound playing
API, coincidentally called NSSound[0], which has a broadly similar focus. So it might be possible for
GSound (or GTK) to use NSSound on the Mac. I don’t know whether Windows also has a similar high-level “just
play this sound and I don’t care how” API, but I’ll do some research.
It looks like the Windows equivalent is the PlaySound() function[0].
So I guess there are a couple of possible approaches if we don’t want GSound to stay as a separate library:
1) Make GTK/GDK or GIO depend on libcanberra, merge the GSound API there, and hope that DirectSound/CoreAudio
Canberra backends get contributed. This may be tricky as libcanberra appears to be more-or-less dead upstream
— there have been no commits to Lennart’s repository[1] for two years now (another thing we can blame on
systemd ;-)).
2) Come up with an API that is the intersection of libcanberra, NSSound and Windows' PlaySound(), and add
that to GTK/GDK/GIO. Off the top of my head, this might be something like:
gdk_play_sound_for_screen(const char *sound_id_or_filename, GdkScreen *screen);
gtk_play_sound_for_widget(const char *sound_id_or_filename, GtkWidget *widget);
where recognised sound id names would be the (very) short list of sounds that are approximately common to all
three platforms. Custom sound files (for example sound effects for a game or whatever) would need to be WAVs,
as this is the only format that can be played out-of-the-box everywhere. I think we’d have to lose the nice
async functions that GSound has, because Windows and Mac don’t seem to give you callbacks when the sound has
finished.
Any thoughts as to which one might be preferable?
Tristan
[0] http://msdn.microsoft.com/en-us/library/dd743680(v=vs.85).aspx
[1] http://git.0pointer.net/libcanberra.git/log/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]