From: Kaj-Michael Lang Date: Wed, 15 Aug 2007 14:37:03 +0000 (+0300) Subject: Some more work on audio notes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67978513bd619275a2310ef89be675730f4dc7f1;p=mapper Some more work on audio notes --- diff --git a/src/audio-note.c b/src/audio-note.c index 60209a1..638b5e5 100644 --- a/src/audio-note.c +++ b/src/audio-note.c @@ -17,10 +17,10 @@ typedef struct _note_pipeline note_pipeline; struct _note_pipeline { - GstElement *pipeline, - GstElement *src, - GstElement *sink, - GstElement *filter, + GstElement *pipeline; + GstElement *src; + GstElement *sink; + GstElement *filter; }; static note_pipeline note_play; static note_pipeline note_record; @@ -33,43 +33,59 @@ audio_bus_cb() static gboolean audio_create_pipeline(note_pipeline *np, gboolean rec) { -p->pipeline=gst_pipeline_new("pipeline"); +np->pipeline=gst_pipeline_new("pipeline"); if (rec==TRUE) { - p->src=gst_element_factory_make(AUDIO_SRC, "source"); - p->filter=gst_element_factory_make("wavenc", "filter"); - p->sink=gst_element_factory_make("filesink", "sink"); + np->src=gst_element_factory_make(AUDIO_SRC, "source"); + np->filter=gst_element_factory_make("wavenc", "filter"); + np->sink=gst_element_factory_make("filesink", "sink"); } else { - p->src=gst_element_factory_make("filesrc", "source"); - p->filter=gst_element_factory_make("wavenc", "filter"); - p->sink=gst_element_factory_make(AUDIO_SINK, "sink"); + np->src=gst_element_factory_make("filesrc", "source"); + np->filter=gst_element_factory_make("wavenc", "filter"); + np->sink=gst_element_factory_make(AUDIO_SINK, "sink"); } return TRUE; } /** * Set the given elements (filesrc or filesink) file location + */ static void audio_set_filename(GstElement *e, gchar *file) { g_object_set(G_OBJECT(e), "location", file, NULL); } +/** + * Play given audio note file + */ gboolean audio_note_play(gchar *file) { audio_set_filename(note_play.src, file); } +/** + * Record to given file + */ gboolean audio_note_record(gchar *file) { audio_set_filename(note_play.sink, file); } +/** + * Init gst pipelines for note play and record + */ gboolean -audio_init(void) +audio_note_init(void) { -audio_create_pipeline(note_play, FALSE); -audio_create_pipeline(note_record, TRUE); +audio_create_pipeline(¬e_play, FALSE); +audio_create_pipeline(¬e_record, TRUE); return TRUE; } + +void +audio_note_deinit(void) +{ + +}