From 67978513bd619275a2310ef89be675730f4dc7f1 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Wed, 15 Aug 2007 17:37:03 +0300 Subject: [PATCH] Some more work on audio notes --- src/audio-note.c | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) 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) +{ + +} -- 2.39.5