From: P. F. Chimento Date: Sun, 30 Jan 2011 16:01:06 +0000 (+0100) Subject: Enabled MOD/S3M/IT/XM support X-Git-Tag: v0.9~152^2~1 X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=commitdiff_plain;h=502f8b7c14ad789df8d3e02faf4a635a67dd9bb4 Enabled MOD/S3M/IT/XM support With this commit, sound support should be finished completely! --- diff --git a/libchimara/schannel.c b/libchimara/schannel.c index 70bb7e1..637ec96 100644 --- a/libchimara/schannel.c +++ b/libchimara/schannel.c @@ -114,18 +114,15 @@ static void on_type_found(GstElement *typefind, guint probability, GstCaps *caps, schanid_t s) { gchar *type = gst_caps_to_string(caps); - if(strcmp(type, "application/ogg") == 0) - { + if(strcmp(type, "application/ogg") == 0) { s->demux = gst_element_factory_make("oggdemux", NULL); s->decode = gst_element_factory_make("vorbisdec", NULL); - if(!s->demux || !s->decode) - { + if(!s->demux || !s->decode) { WARNING(_("Could not create one or more GStreamer elements")); goto finally; } gst_bin_add_many(GST_BIN(s->pipeline), s->demux, s->decode, NULL); - if(!gst_element_link(s->typefind, s->demux) || !gst_element_link(s->decode, s->convert)) - { + if(!gst_element_link(s->typefind, s->demux) || !gst_element_link(s->decode, s->convert)) { WARNING(_("Could not link GStreamer elements")); goto finally; } @@ -133,24 +130,29 @@ on_type_found(GstElement *typefind, guint probability, GstCaps *caps, schanid_t demuxer doesn't know what source pads it will have until it starts demuxing the stream */ g_signal_connect(s->demux, "pad-added", G_CALLBACK(on_ogg_demuxer_pad_added), s); - } - else if(strcmp(type, "audio/x-aiff") == 0) - { + } else if(strcmp(type, "audio/x-aiff") == 0) { s->decode = gst_element_factory_make("aiffparse", NULL); - if(!s->decode) - { + if(!s->decode) { WARNING(_("Could not create 'aiffparse' GStreamer element")); goto finally; } gst_bin_add(GST_BIN(s->pipeline), s->decode); - if(!gst_element_link_many(s->typefind, s->decode, s->convert, NULL)) - { + if(!gst_element_link_many(s->typefind, s->decode, s->convert, NULL)) { WARNING(_("Could not link GStreamer elements")); goto finally; } - } - else - { + } else if(strcmp(type, "audio/x-mod") == 0) { + s->decode = gst_element_factory_make("modplug", NULL); + if(!s->decode) { + WARNING(_("Could not create 'modplug' GStreamer element")); + goto finally; + } + gst_bin_add(GST_BIN(s->pipeline), s->decode); + if(!gst_element_link_many(s->typefind, s->decode, s->convert, NULL)) { + WARNING(_("Could not link GStreamer elements")); + goto finally; + } + } else { WARNING_S(_("Unexpected audio type in blorb"), type); } diff --git a/tests/SND3 b/tests/SND3 deleted file mode 100644 index ddbf43d..0000000 Binary files a/tests/SND3 and /dev/null differ diff --git a/tests/soundtest.c b/tests/soundtest.c index b301479..e89dcf3 100644 --- a/tests/soundtest.c +++ b/tests/soundtest.c @@ -33,6 +33,9 @@ glk_main(void) return; } glk_set_window(mainwin); + glk_put_string("Copy a sound file to the current directory and rename it " + "to SND3. Supported formats: AIFF, OGG, MOD, S3M, IT, XM. Type 'play' " + "to play it.\n"); char buffer[1024]; int len;