Subject: [E-devel] [patch] edje multisense example
Here is a try to have a working edje multisense example to fill up the
doc blank. edje-multisense.c is basically edje_example.c adapted.
I modified the edc, removing dead code, to have only a sample and a tone
example. Can be extended later.
Does the job except that it only plays sound one time per launch. Hope
someone will know why and correct it...
Attached:
- the patch for existing .edc and build system
- the new edje-multisense.c file
- duck.wav a reworked public domain wav sample of a duck quack-quack
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@69962
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
examplesdir = $(datadir)/$(PACKAGE)/examples
if ENABLE_MULTISENSE
+MULTISENSE_BIN_FILE = edje-multisense
+MULTISENSE_C_FILE = edje-multisense.c
MULTISENSE_EDC_FILE = multisense.edc
-SND_DIR = -sd $(srcdir)
+SND_DIR = -sd $(srcdir)
endif
#put here all EDCs one needs to the examples
red.png \
test.png \
Vera.ttf \
+ duck.wav \
edje-basic.c \
edje-swallow.c \
edje-text.c \
edje-color-class.c \
edje-perspective.c \
edje-animations.c \
- sigtest.c
+ sigtest.c \
+ $(MULTISENSE_C_FILE)
EXTRA_DIST = $(files_DATA)
edje-swallow \
edje-table \
edje-text \
- sigtest
+ sigtest \
+ $(MULTISENSE_BIN_FILE)
LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_LIBS@
--- /dev/null
+/**
+ * Simple example illustrating the very basic functions of multisense
+ *
+ * You'll need at least one Evas engine built for it (excluding the
+ * buffer one) and multisense support ine edje. See stdout/stderr for output.
+ *
+ * @verbatim
+ * gcc -o edje-multisense edje-multisense.c `pkg-config --libs --cflags eina evas ecore ecore-evas edje`
+ * @endverbatim
+ */
+
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#define WIDTH 300
+#define HEIGHT 300
+
+static Evas_Object *create_my_group(Evas *canvas)
+{
+ Evas_Object *edje;
+
+ edje = edje_object_add(canvas);
+ if (!edje)
+ {
+ EINA_LOG_CRIT("could not create edje object!");
+ return NULL;
+ }
+
+ if (!edje_object_file_set(edje, "multisense.edj", "example_group"))
+ {
+ int err = edje_object_load_error_get(edje);
+ const char *errmsg = edje_load_error_str(err);
+ EINA_LOG_ERR("could not load 'example_group' from multisense.edj: %s",
+ errmsg);
+
+ evas_object_del(edje);
+ return NULL;
+ }
+
+ evas_object_move(edje, 0, 0);
+ evas_object_resize(edje, WIDTH, HEIGHT);
+ evas_object_show(edje);
+ return edje;
+}
+
+int main(int argc, char *argv[])
+{
+ Ecore_Evas *window;
+ Evas *canvas;
+ Evas_Object *edje;
+
+ ecore_evas_init();
+ edje_init();
+
+ window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
+ if (!window)
+ {
+ EINA_LOG_CRIT("could not create window.");
+ return -1;
+ }
+ canvas = ecore_evas_get(window);
+
+ edje = create_my_group(canvas);
+ if (!edje)
+ return -2;
+
+ ecore_evas_show(window);
+ ecore_main_loop_begin();
+
+ evas_object_del(edje);
+ ecore_evas_free(window);
+
+ edje_shutdown();
+ ecore_evas_shutdown();
+
+ return 0;
+}
-#if 0
collections {
sounds {
sample {
name: "sound_name1" RAW;
- source: "8806__jovica__basic-sine-wave-g-1.wav";
-// source: "sample.wav";
-// source: "sample-flac10k.wav";
-// source: "sample-flac10k-mono.wav";
- }
-// sample {
-// name: "sound_name2" COMP;
-// source: "sample.wav";
-// }
-/*
- sample {
- name: "sound_name3" LOSSY 0.5;
- source: "sample.wav";
- }
- sample {
- name: "sound_name4" AS_IS;
- source: "sample.wav";
- }
- */
- sample {
-// name: "sound_name5" AS_IS;
-// name: "sound_name5" COMP;
- name: "sound_name5" RAW;
-// source: "sample-ogg.wav";
- source: "sample-ogg-mono.wav";
-// source: "sample-ogg10k.wav";
-// source: "sample-flac10k.wav";
-// source: "sample-flac10k-mono.wav";
- }
- sample {
- name: "sound_name6" AS_IS;
-// name: "sound_name6" LOSSY 45.0;
- source: "sample-flac44k-mono.wav";
-// source: "sample-flac.wav";
-// source: "sample.ogg";
+ source: "duck.wav";
}
tone: "tone-name" 2600;
}
name: "tone_text";
type: TEXT;
mouse_events: 1;
- repeat_events : 1;
+ repeat_events: 1;
description {
state: "default" 0.0;
rel1.to: "tone_bg";
action: PLAY_SAMPLE "sound_name1" 1.0;
}
program {
- name: "click_sample2";
- signal: "mouse,down,2";
- source: "sample_bg";
- action: PLAY_SAMPLE "sound_name5" 1.0;
- }
- program {
- name: "click_sample3";
- signal: "mouse,down,3";
- source: "sample_bg";
- action: PLAY_SAMPLE "sound_name6" 1.0;
- }
- program {
name: "click_tone";
signal: "mouse,down,1";
source: "tone_bg";
}
}
}
-#endif