[DEV] add basic input viewer widget
This commit is contained in:
71
sample/ioViewer/appl/Windows.cpp
Normal file
71
sample/ioViewer/appl/Windows.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD 3 clauses (see license file)
|
||||
*/
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
#include <appl/debug.h>
|
||||
#include <appl/Windows.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <audio/river/widget/TemporalViewer.h>
|
||||
#include <etk/tool.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "Windows"
|
||||
|
||||
static const char* const g_eventChangeValues = "appl-change-value";
|
||||
static const char* const g_eventAutoMode = "appl-change-auto";
|
||||
|
||||
appl::Windows::Windows() :
|
||||
m_composer(NULL) {
|
||||
addObjectType("appl::Windows");
|
||||
}
|
||||
|
||||
void appl::Windows::init() {
|
||||
ewol::widget::Windows::init();
|
||||
setTitle("example 001_HelloWord");
|
||||
std::string composition = std::string("");
|
||||
composition += "<sizer mode='vert'>\n";
|
||||
composition += " <sizer mode='hori'>\n";
|
||||
composition += " <button name='bt-record'>\n";
|
||||
composition += " <label>\n";
|
||||
composition += " Start/Stop record\n";
|
||||
composition += " </label>\n";
|
||||
composition += " </button>\n";
|
||||
composition += " <button name='bt-generate'>\n";
|
||||
composition += " <label>\n";
|
||||
composition += " Start/Stop Generate\n";
|
||||
composition += " </label>\n";
|
||||
composition += " </button>\n";
|
||||
composition += " </sizer>\n";
|
||||
composition += " <TemporalViewer name='displayer' expand='true' fill='true'/>\n";
|
||||
composition += "</sizer>\n";
|
||||
|
||||
m_composer = ewol::widget::Composer::create(ewol::widget::Composer::String, composition);
|
||||
if (m_composer == NULL) {
|
||||
APPL_CRITICAL(" An error occured ... in the windows creatrion ...");
|
||||
return;
|
||||
}
|
||||
setSubWidget(m_composer);
|
||||
subBind(ewol::widget::Button, "bt-record", signalPressed, shared_from_this(), &appl::Windows::onCallbackRecord);
|
||||
subBind(ewol::widget::Button, "bt-generate", signalPressed, shared_from_this(), &appl::Windows::onCallbackGenerate);
|
||||
}
|
||||
|
||||
void appl::Windows::onCallbackRecord() {
|
||||
std::shared_ptr<audio::river::widget::TemporalViewer> tmpDisp = std::dynamic_pointer_cast<audio::river::widget::TemporalViewer>(getSubObjectNamed("displayer"));
|
||||
if (tmpDisp != NULL) {
|
||||
tmpDisp->recordToggle();
|
||||
}
|
||||
}
|
||||
|
||||
void appl::Windows::onCallbackGenerate() {
|
||||
std::shared_ptr<audio::river::widget::TemporalViewer> tmpDisp = std::dynamic_pointer_cast<audio::river::widget::TemporalViewer>(getSubObjectNamed("displayer"));
|
||||
if (tmpDisp != NULL) {
|
||||
tmpDisp->generateToggle();
|
||||
}
|
||||
}
|
||||
|
31
sample/ioViewer/appl/Windows.h
Normal file
31
sample/ioViewer/appl/Windows.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD 3 clauses (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __APPL_WINDOWS_H__
|
||||
#define __APPL_WINDOWS_H__
|
||||
|
||||
#include <ewol/widget/Windows.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
|
||||
namespace appl {
|
||||
class Windows : public ewol::widget::Windows {
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::Composer> m_composer;
|
||||
protected:
|
||||
Windows();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(Windows);
|
||||
public: // callback functions
|
||||
void onCallbackRecord();
|
||||
void onCallbackGenerate();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
13
sample/ioViewer/appl/debug.cpp
Normal file
13
sample/ioViewer/appl/debug.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <appl/debug.h>
|
||||
|
||||
|
||||
int32_t appl::getLogId() {
|
||||
static int32_t g_val = etk::log::registerInstance("ioViewer");
|
||||
return g_val;
|
||||
}
|
43
sample/ioViewer/appl/debug.h
Normal file
43
sample/ioViewer/appl/debug.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __APPL_DEBUG_H__
|
||||
#define __APPL_DEBUG_H__
|
||||
|
||||
#include <etk/log.h>
|
||||
|
||||
namespace appl {
|
||||
int32_t getLogId();
|
||||
}
|
||||
|
||||
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
|
||||
|
||||
#define APPL_PRINT(data) APPL_BASE(-1, data)
|
||||
#define APPL_CRITICAL(data) APPL_BASE(1, data)
|
||||
#define APPL_ERROR(data) APPL_BASE(2, data)
|
||||
#define APPL_WARNING(data) APPL_BASE(3, data)
|
||||
#ifdef DEBUG
|
||||
#define APPL_INFO(data) APPL_BASE(4, data)
|
||||
#define APPL_DEBUG(data) APPL_BASE(5, data)
|
||||
#define APPL_VERBOSE(data) APPL_BASE(6, data)
|
||||
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
|
||||
#else
|
||||
#define APPL_INFO(data) do { } while(false)
|
||||
#define APPL_DEBUG(data) do { } while(false)
|
||||
#define APPL_VERBOSE(data) do { } while(false)
|
||||
#define APPL_TODO(data) do { } while(false)
|
||||
#endif
|
||||
|
||||
#define APPL_ASSERT(cond,data) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
APPL_CRITICAL(data); \
|
||||
assert(!#cond); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
74
sample/ioViewer/appl/main.cpp
Normal file
74
sample/ioViewer/appl/main.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD 3 clauses (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/context/commandLine.h>
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/Windows.h>
|
||||
#include <ewol/object/Object.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
#include <ewol/context/Context.h>
|
||||
#include <audio/river/widget/TemporalViewer.h>
|
||||
|
||||
static const std::string configurationRiver =
|
||||
"{\n"
|
||||
" microphone:{\n"
|
||||
" io:'input',\n"
|
||||
" map-on:{\n"
|
||||
" interface:'auto',\n"
|
||||
" name:'default',\n"
|
||||
" },\n"
|
||||
" frequency:0,\n"
|
||||
" channel-map:['front-left', 'front-right'],\n"
|
||||
" type:'auto',\n"
|
||||
" nb-chunk:1024\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
|
||||
|
||||
class MainApplication : public ewol::context::Application {
|
||||
public:
|
||||
bool init(ewol::Context& _context, size_t _initId) {
|
||||
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
||||
|
||||
audio::river::initString(configurationRiver);
|
||||
|
||||
// TODO : Remove this : Move if in the windows properties
|
||||
_context.setSize(vec2(800, 600));
|
||||
|
||||
// select internal data for font ...
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
|
||||
|
||||
audio::river::widget::TemporalViewer::createManagerWidget(_context.getWidgetManager());
|
||||
|
||||
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
|
||||
// create the specific windows
|
||||
_context.setWindows(basicWindows);
|
||||
APPL_INFO("==> Init APPL (END)");
|
||||
return true;
|
||||
}
|
||||
void unInit(ewol::Context& _context) {
|
||||
APPL_INFO("==> Un-Init APPL (START)");
|
||||
// nothing to do...
|
||||
APPL_INFO("==> Un-Init APPL (END)");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
// second possibility
|
||||
return ewol::run(new MainApplication(), _argc, _argv);
|
||||
}
|
30
sample/ioViewer/lutin_ioViewer.py
Normal file
30
sample/ioViewer/lutin_ioViewer.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.tools as tools
|
||||
import datetime
|
||||
|
||||
def get_desc():
|
||||
return "Simpleaudio IO viewer and test ..."
|
||||
|
||||
def create(target):
|
||||
myModule = module.Module(__file__, 'ioViewer', 'PACKAGE')
|
||||
myModule.add_extra_compile_flags()
|
||||
myModule.add_src_file([
|
||||
'appl/debug.cpp',
|
||||
'appl/main.cpp',
|
||||
'appl/Windows.cpp'])
|
||||
myModule.add_module_depend(['ewol', 'audio-river', 'audio-river-widget'])
|
||||
myModule.add_path(tools.get_current_path(__file__))
|
||||
# set the package properties :
|
||||
myModule.pkg_set("VERSION", "1.0.0")
|
||||
myModule.pkg_set("VERSION_CODE", "1")
|
||||
myModule.pkg_set("COMPAGNY_TYPE", "org")
|
||||
myModule.pkg_set("COMPAGNY_NAME", "Edouard DUPIN")
|
||||
myModule.pkg_set("MAINTAINER", ["Mr DUPIN Edouard <yui.heero@gmail.com>"])
|
||||
myModule.pkg_set("SECTION", ["Development"])
|
||||
myModule.pkg_set("PRIORITY", "optional")
|
||||
myModule.pkg_set("DESCRIPTION", "Simple wiewer")
|
||||
myModule.pkg_set("NAME", "audio-io-viewer")
|
||||
|
||||
return myModule
|
||||
|
Reference in New Issue
Block a user