\chapter{Multisense example}
\hypertarget{tutorial_edje_multisense}{}\label{tutorial_edje_multisense}\index{Multisense example@{Multisense example}}


This is a simple example in which a rect is created and sound and tone are played on mouse down event.

Focusing on the creation of sample and tone. It should be noted that creation of sample sound is from any supported (sndfile lib) audio file, tone from of specific audible frequency range are controlled by the theme\+:

The full source code follows\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Evas.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Ecore.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Edje_8h}{Edje.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#ifndef\ PACKAGE\_DATA\_DIR}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ PACKAGE\_DATA\_DIR\ "{}."{}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ WIDTH\ \ 300}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ HEIGHT\ 300}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ Evas\_Object\ *create\_my\_group(Evas\ *canvas)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Evas\_Object\ *edje;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ edje\ =\ \mbox{\hyperlink{group__Edje__Object__Group_ga5548cef32568746f40df9bd0be339bea}{edje\_object\_add}}(canvas);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!edje)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eina__Log__Group_ga5b50827f35399f9ff87f5d9d817c764a}{EINA\_LOG\_CRIT}}(\textcolor{stringliteral}{"{}could\ not\ create\ edje\ object!"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Edje__Object__Group_gaec1edd24b5bd8e82823759a8dddc1996}{edje\_object\_file\_set}}(edje,\ PACKAGE\_DATA\_DIR\textcolor{stringliteral}{"{}/multisense.edj"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}example\_group"{}}))}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ err\ =\ \mbox{\hyperlink{group__Edje__Object__Group_ga4d244ed455a48b9cbf286b6d8b802df3}{edje\_object\_load\_error\_get}}(edje);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *errmsg\ =\ \mbox{\hyperlink{group__Edje__Object__Group_gaa26fe971d6817a0db649480b63eb3791}{edje\_load\_error\_str}}(err);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eina__Log__Group_ga2e33caeeeb6051526c01b7fea4d6c91b}{EINA\_LOG\_ERR}}(\textcolor{stringliteral}{"{}could\ not\ load\ 'example\_group'\ from\ multisense.edj:\ \%s"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ errmsg);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9217cf1d90690dbd1960db155d1c7476}{evas\_object\_del}}(edje);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(edje,\ 0,\ 0);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(edje,\ WIDTH,\ HEIGHT);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(edje);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ edje;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ main()}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Ecore\_Evas\ *window;}
\DoxyCodeLine{\ \ \ Evas\ *canvas;}
\DoxyCodeLine{\ \ \ Evas\_Object\ *edje;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Edje__General__Group_ga1c9c6594f38023c29fbfb2d0c8c675db}{edje\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ window\ =\ \mbox{\hyperlink{group__Ecore__Evas__Group_gaaa770b6f2f1395f9eeb0e50e26c3f933}{ecore\_evas\_new}}(NULL,\ 0,\ 0,\ WIDTH,\ HEIGHT,\ NULL);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!window)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eina__Log__Group_ga5b50827f35399f9ff87f5d9d817c764a}{EINA\_LOG\_CRIT}}(\textcolor{stringliteral}{"{}could\ not\ create\ window."{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ canvas\ =\ \mbox{\hyperlink{group__Ecore__Evas__Group_ga6f8d214cd55bc940d7cc62fecd8dbc06}{ecore\_evas\_get}}(window);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ edje\ =\ create\_my\_group(canvas);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!edje)}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return}\ -\/2;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}}(window);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9217cf1d90690dbd1960db155d1c7476}{evas\_object\_del}}(edje);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}}(window);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{collections\ \{}
\DoxyCodeLine{\ \ \ sounds\ \{}
\DoxyCodeLine{\ \ \ \ \ \ sample\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ name:\ "{}sound\_name1"{}\ RAW;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ source:\ "{}duck.wav"{};}
\DoxyCodeLine{\ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ tone:\ "{}tone-\/name"{}\ 2600;}
\DoxyCodeLine{\ \ \ \}}
\DoxyCodeLine{\ \ \ group\ \{}
\DoxyCodeLine{\ \ \ \ \ \ name:\ "{}example\_group"{};}
\DoxyCodeLine{\ \ \ \ \ \ parts\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ part\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ name:\ "{}sample\_bg"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ type:\ RECT;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ mouse\_events:\ 1;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ description\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ state:\ "{}default"{}\ 0.0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min:\ 300\ 150;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max:\ 300\ 150;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ color:\ 200\ 200\ 200\ 100;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ align:\ 0.5\ 0.0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rel1\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ relative:\ 0.0\ 0.0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ part\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ name:\ "{}sample\_text"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ type:\ TEXT;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ mouse\_events:\ 1;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ repeat\_events:\ 1;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ description\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ state:\ "{}default"{}\ 0.0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rel1.to:\ "{}sample\_bg"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rel2.to:\ "{}sample\_bg"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ text\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ font:\ "{}Sans"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ size:\ 20;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ text:\ "{}Play\ Sound\ Sample"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ part\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ name:\ "{}tone\_bg"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ type:\ RECT;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ mouse\_events:\ 1;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ description\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ state:\ "{}default"{}\ 0.0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min:\ 300\ 150;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max:\ 300\ 150;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ align:\ 0.5\ 0.0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ color:\ 180\ 180\ 180\ 100;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rel1\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ relative:\ 0.0\ 1.0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ to:\ "{}sample\_bg"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ part\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ name:\ "{}tone\_text"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ type:\ TEXT;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ mouse\_events:\ 1;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ repeat\_events:\ 1;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ description\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ state:\ "{}default"{}\ 0.0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rel1.to:\ "{}tone\_bg"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rel2.to:\ "{}tone\_bg"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ text\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ font:\ "{}Sans"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ size:\ 20;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ text:\ "{}Play\ Tone"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ programs\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ program\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name:\ "{}click\_sample1"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ signal:\ "{}mouse,down,1"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ source:\ "{}sample\_bg"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ action:\ PLAY\_SAMPLE\ "{}sound\_name1"{}\ 1.0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ program\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name:\ "{}click\_tone"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ signal:\ "{}mouse,down,1"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ source:\ "{}tone\_bg"{};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ action:\ PLAY\_TONE\ "{}tone-\/name"{}\ 0.1;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \}}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 