]> err.no Git - mapper/commitdiff
Some more work on audio notes
authorKaj-Michael Lang <milang@onion.tal.org>
Wed, 15 Aug 2007 09:01:54 +0000 (12:01 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Wed, 15 Aug 2007 09:01:54 +0000 (12:01 +0300)
src/audio-note.c [new file with mode: 0644]
src/audio-note.h [new file with mode: 0644]
src/audio-record.c [deleted file]

diff --git a/src/audio-note.c b/src/audio-note.c
new file mode 100644 (file)
index 0000000..60209a1
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Quick record audio notes on the road.
+ */
+
+#include "config.h"
+#include <gst/gst.h>
+
+#include "audio-note.h"
+
+#ifdef WITH_DEVICE_770
+#define AUDIO_SRC "dsppcmsrc"
+#define AUDIO_SINK "dsppcmsink"
+#else
+#define AUDIO_SRC "alsasrc"
+#define AUDIO_SINK "autoaudiosink"
+#endif
+
+typedef struct _note_pipeline note_pipeline;
+struct _note_pipeline {
+       GstElement *pipeline,
+       GstElement *src,
+       GstElement *sink,
+       GstElement *filter,
+};
+static note_pipeline note_play;
+static note_pipeline note_record;
+
+static gboolean
+audio_bus_cb()
+{
+}
+
+static gboolean
+audio_create_pipeline(note_pipeline *np, gboolean rec)
+{
+p->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");
+} 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");
+}
+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);
+}
+
+gboolean
+audio_note_play(gchar *file)
+{
+audio_set_filename(note_play.src, file);
+}
+
+gboolean
+audio_note_record(gchar *file)
+{
+audio_set_filename(note_play.sink, file);
+}
+
+gboolean
+audio_init(void)
+{
+audio_create_pipeline(note_play, FALSE);
+audio_create_pipeline(note_record, TRUE);
+return TRUE;
+}
diff --git a/src/audio-note.h b/src/audio-note.h
new file mode 100644 (file)
index 0000000..e526472
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef _AUDIO_NOTE_H
+#define _AUDIO_NOTE_H
+
+gboolean audio_note_init(void);
+gboolean audio_note_record(gchar *file);
+gboolean audio_note_play(gchar *file);
+
+#endif
diff --git a/src/audio-record.c b/src/audio-record.c
deleted file mode 100644 (file)
index 6e2a1ea..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Quick record audio notes on the road.
- */
-
-#include "config.h"
-#include <gst/gst.h>
-
-#ifdef WITH_HILDON
-#define AUDIO_SRC "dsppcmsrc"
-#define AUDIO_SINK "dsppcmsink"
-#else
-#define AUDIO_SRC "alsasrc"
-#define AUDIO_SINK "alsasink"
-#endif
-
-struct {
-       GstElement *pipeline,
-       GstElement *src,
-       GstElement *sink,
-       GstElement *filter,
-} pipeline;
-
-gboolean
-audio_bus_cb()
-{
-}
-
-gboolean
-audio_create_record_pipeline(void)
-{
-pipeline=gst_pipeline_new("pipeline");
-src=gst_element_factory_make(AUDIO_SRC, "source");
-filter=gst_element_factory_make("wavenc", "filter");
-sink=gst_element_factory_make("filesink", "sink");
-}
-
-gboolean
-audio_create_play_pipelin(void)
-{
-
-}
-
-void
-audio_file_set_filename(GstElement *e, gchar *file)
-{
-g_object_set(G_OBJECT(e), "location", file, NULL);
-}
-
-gboolean
-audio_cb_xxx(void) 
-{
-
-}
-