예제 #1
0
ememory::SharedPtr<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
	APPL_INFO("get('" << _fileName << "'," << _createIfNeeded << ")");
	for (auto &it : m_list) {
		if (it == nullptr) {
			continue;
		}
		if (it->getFileName() == _fileName) {
			return it;
		}
	}
	if (_createIfNeeded == true) {
		if (etk::FSNodeGetType(_fileName) == etk::typeNode_folder) {
			APPL_WARNING("try open a folder : " << _fileName);
			APPL_CRITICAL("plop");
			return nullptr;
		}
		ememory::SharedPtr<appl::Buffer> tmp = appl::Buffer::create();
		if (tmp == nullptr) {
			APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
			return nullptr;
		}
		tmp->setParent(ewol::Object::sharedFromThis());
		tmp->loadFile(_fileName);
		m_list.push_back(tmp);
		APPL_INFO("Creata a open Buffer");
		signalNewBuffer.emit(tmp->getFileName());
		APPL_INFO("Creata a open Buffer (done)");
		return tmp;
	}
	return nullptr;
}
예제 #2
0
파일: init.cpp 프로젝트: HeeroYui/fxCreator
/**
 * @brief main application function Un-Initialisation
 */
void APP_UnInit(void)
{
	APPL_INFO("==> Un-Init Edn (START)");
	// Remove windows :
	ewol::DisplayWindows(NULL);
	
	if (NULL != basicWindows) {
		basicWindows->MarkToRemove();
		basicWindows = NULL;
	}
	APPL_INFO("==> Un-Init Edn (END)");
}
예제 #3
0
void appl::BufferManager::setBufferSelected(ememory::SharedPtr<appl::Buffer> _bufferSelected) {
	m_bufferSelected = _bufferSelected;
	if (m_bufferSelected == nullptr) {
		APPL_ERROR("select a NULL buffer ...");
		propertySetOnWidgetNamed("appl-widget-display-name", "value", "---");
		return;
	}
	APPL_INFO("Set buffer selected");
	//signalSelectFile.emit(m_bufferSelected->getName());
	//propertySetOnWidgetNamed("appl-widget-display-name", "value", m_bufferSelected->getName());
	APPL_INFO("Set buffer selected (done)");
}
예제 #4
0
파일: Main.cpp 프로젝트: biddyweb/ewol
		bool init(ewol::Context& _context, size_t _initId) {
			APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
			
			// 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);
			
			std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
			// create the specific windows
			_context.setWindows(basicWindows);
			APPL_INFO("==> Init APPL (END)");
			return true;
		}
예제 #5
0
ememory::SharedPtr<appl::Buffer> appl::BufferManager::createNewBuffer() {
	ememory::SharedPtr<appl::Buffer> tmp = appl::Buffer::create();
	if (tmp == nullptr) {
		APPL_ERROR("Can not allocate the Buffer (empty).");
		return nullptr;
	}
	tmp->setParent(ewol::Object::sharedFromThis());
	m_list.push_back(tmp);
	APPL_INFO("Create a new Buffer");
	signalNewBuffer.emit(tmp->getFileName());
	APPL_INFO("Create a new Buffer (done)");
	APPL_INFO("select Buffer");
	signalSelectFile.emit(tmp->getFileName());
	APPL_INFO("select Buffer (done)");
	return tmp;
}
예제 #6
0
void appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn(const std::string& _value) {
	// open the new one :
	etk::FSNode tmpFilename = _value;
	m_tagFilename = tmpFilename.getNameFile();
	m_tagFolderBase = tmpFilename.getNameFolder();
	APPL_INFO("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
	loadTagFile();
}
예제 #7
0
void appl::TextPluginCtags::loadTagFile() {
	tagFileInfo info;
	// close previous tag file
	if (nullptr != m_ctagFile) {
		tagsClose(m_ctagFile);
		m_ctagFile = nullptr;
	}
	if (m_tagFilename == "") {
		return;
	}
	// load (open) the tag file : 
	APPL_INFO("try to open tag file : " << m_tagFilename);
	m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info);
	if (nullptr != m_ctagFile) {
		APPL_INFO("open exuberant Ctags file is OK ...");
	} else {
		APPL_INFO("Error to open ctags file ...");
	}
}
예제 #8
0
void appl::TextPluginCtags::jumpTo(const std::string& _name) {
	if (m_ctagFile == nullptr) {
		APPL_WARNING("No ctags file open");
		return;
	}
	tagEntry entry;
	APPL_INFO("try to find the tag : " << _name);
	if (tagsFind (m_ctagFile, &entry, _name.c_str(), 0) != TagSuccess) {
		APPL_INFO("no tag find ...");
		return;
	}
	tagEntry entrySave = entry;
	int32_t numberOfTags = 0;
	
	// For all tags : Save in an internal Structure :
	std::string tmpFile(m_tagFolderBase + "/" + entry.file);
	etk::FSNode myfile(tmpFile);
	int32_t lineID = entry.address.lineNumber;
	printTag(&entry);
	
	if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
		APPL_INFO("Multiple file destination ...");
		ememory::SharedPtr<appl::TagFileSelection> tmpWidget = appl::TagFileSelection::create();
		if (tmpWidget == nullptr) {
			APPL_ERROR("Can not allocate widget  == > display might be in error");
		} else {
			tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
			do {
				tmpFile = m_tagFolderBase + "/" + entry.file;
				myfile = tmpFile;
				lineID = entry.address.lineNumber;
				printTag(&entry);
				tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
			} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
			ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
			tmpWidget->signalSelect.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn);
		}
	} else {
		jumpFile(myfile.getName(), lineID - 1);
	}
}
예제 #9
0
파일: TextViewer.cpp 프로젝트: HeeroYui/edn
void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
	APPL_INFO("Select new file: " << _value);
	if (isSelectedLast() == false) {
		return;
	}
	
	// reset scroll:
	if (m_buffer != nullptr) {
		m_buffer->signals.disconnect(sharedFromThis());
		bool needAdd = true;
		auto it = m_drawingRemenber.begin();
		while (it != m_drawingRemenber.end()) {
			ememory::SharedPtr<appl::Buffer> tmpBuff = it->first.lock();
			if (tmpBuff == nullptr) {
				it = m_drawingRemenber.erase(it);
				continue;
			}
			if (tmpBuff == m_buffer) {
				it->second = m_originScrooled;
				APPL_VERBOSE("store origin : " << m_originScrooled);
				needAdd = false;
				break;
			}
			++it;
		}
		if (needAdd == true) {
			m_drawingRemenber.push_back(std::make_pair(ememory::WeakPtr<appl::Buffer>(m_buffer), m_originScrooled));
			APPL_VERBOSE("Push origin : " << m_originScrooled);
		}
	}
	m_originScrooled = vec2(0,0);
	if (m_bufferManager != nullptr) {
		m_buffer = m_bufferManager->get(_value);
		m_bufferManager->setBufferSelected(m_buffer);
		if (m_buffer != nullptr) {
			m_buffer->signalIsModify.connect(sharedFromThis(), &appl::TextViewer::onCallbackIsModify);
			m_buffer->signalSelectChange.connect(sharedFromThis(), &appl::TextViewer::onCallbackSelectChange);
			for (auto element : m_drawingRemenber) {
				if (element.first.lock() == m_buffer) {
					m_originScrooled = element.second;
					APPL_VERBOSE("retrive origin : " << m_originScrooled);
					// TODO : Check if this element is not out of the display text ...
					break;
				}
			}
		}
	}
	markToRedraw();
	return;
}
예제 #10
0
bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer,
                                              const std::string& _shortCutName) {
	if (isEnable() == false) {
		return false;
	}
	if (_shortCutName == "appl::TextPluginCtags::OpenCtagsFile") {
		APPL_INFO("Request opening ctag file");
		ememory::SharedPtr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
		if (tmpWidget == nullptr) {
			APPL_ERROR("Can not allocate widget  == > display might be in error");
			return true;
		}
		tmpWidget->propertyLabelTitle.set("Open Exuberant Ctags file");
		tmpWidget->propertyLabelValidate.set("Open");
		// try to get the current folder :
		std::string path = _textDrawer.getBufferPath();
		APPL_ERROR("get path : '" << path << "'");
		if (path != "") {
			tmpWidget->propertyPath.set(path);
		}
		ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
		tmpWidget->signalValidate.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
		return true;
	} else if (_shortCutName == "appl::TextPluginCtags::JumpDestination") {
		if (_textDrawer.hasBuffer() == false) {
			return false;
		}
		std::string textToSearch;
		if (_textDrawer.hasTextSelected() == true) {
			_textDrawer.copy(textToSearch, _textDrawer.selectStart(), _textDrawer.selectStop() );
		} else {
			appl::Buffer::Iterator _beginPos;
			appl::Buffer::Iterator _endPos;
			if (_textDrawer.getPosAround(_textDrawer.cursor(), _beginPos, _endPos) == false) {
				APPL_WARNING("Can not get data around...");
				return true;
			}
			_textDrawer.copy(textToSearch, _beginPos, _endPos);
		}
		jumpTo(textToSearch);
		return true;
	} else if (_shortCutName == "appl::TextPluginCtags::JumpBack") {
		if (_textDrawer.hasBuffer() == false) {
			return false;
		}
		return true;
	}
	return false;
}
예제 #11
0
파일: Main.cpp 프로젝트: atria-soft/ewol
		void onCreate(ewol::Context& _context) override {
			APPL_INFO(" == > CREATE ... " << PROJECT_NAME << "  v" << APPL_VERSION << " (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
			for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
				std::string tmpppp = _context.getCmd().get(iii);
				if (    tmpppp == "-h"
				     || tmpppp == "--help") {
					APPL_INFO("  -h/--help display this help" );
					exit(0);
				}
			}
			// 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);
			
			appl::widget::VectorDisplay::createManagerWidget(_context.getWidgetManager());
			
			ewol::widget::WindowsShared basicWindows = appl::Windows::create();
			// create the specific windows
			_context.setWindows(basicWindows);
			APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
		}
예제 #12
0
파일: init.cpp 프로젝트: HeeroYui/fxCreator
/**
 * @brief main application function Initialisation
 */
void APP_Init(void)
{
	#ifdef __PLATFORM__Linux
		#ifdef MODE_RELEASE
			APPL_INFO("==> Init "PROJECT_NAME" (START) (Linux) (Release)");
		#else
			APPL_INFO("==> Init "PROJECT_NAME" (START) (Linux) (Debug)");
		#endif
	#else
		#ifdef MODE_RELEASE
			APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Release)");
		#else
			APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Debug)");
		#endif
	#endif
	ewol::ChangeSize(800, 600);
	etk::InitDefaultFolder(PROJECT_NAME);

	ewol::SetFontFolder("Font");
	
	#ifdef __PLATFORM__Android
		ewol::SetDefaultFont("freefont/FreeSerif.ttf", 19);
	#else
		ewol::SetDefaultFont("freefont/FreeSerif.ttf", 14);
	#endif
	
	basicWindows = new MainWindows();
	
	if (NULL == basicWindows) {
		APPL_ERROR("Can not allocate the basic windows");
		ewol::Stop();
		return;
	}
	// create the specific windows
	ewol::DisplayWindows(basicWindows);
	// set basic random sound
	generator::GenerateBasicRandom();
	// initialize output audio :
	ewol::audio::Init();
	ewol::audio::AddCallbackOutput(&generator::GenerateAudio);
	// add files
	APPL_INFO("show list of files : ");
	
	APPL_INFO("==> Init Edn (END)");
}
예제 #13
0
void appl::TextPluginCtags::printTag(const tagEntry *_entry) {
	#if 1
		APPL_INFO("find Tag file : name=\"" << _entry->name << "\" in file=\"" << _entry->file
			<< "\" at line="<< (int32_t)_entry->address.lineNumber);
	#else
		APPL_INFO("find Tag file : name=\"" << _entry->name << "\" in file=\"" << _entry->file
			<< "\" pattern=\"" << _entry->address.pattern 
			<< "\" at line="<< (int32_t)_entry->address.lineNumber);
		
		APPL_INFO("Extention field : ");
		if (_entry->kind != nullptr  && _entry->kind [0] != '\0') {
			APPL_INFO("        kind : " << _entry->kind);
		}
		if (_entry->fileScope) {
			APPL_INFO("        file : ");
		}
		for (int32_t iii = 0 ; iii < _entry->fields.count ; ++iii) {
			APPL_INFO("               " << _entry->fields.list[iii].key << ":" << _entry->fields.list[iii].value );
		}
	#endif
}
예제 #14
0
파일: Highlight.cpp 프로젝트: HeeroYui/edn
void appl::Highlight::display() {
	APPL_INFO("List of ALL Highlight : ");
	for (auto &it : m_listExtentions) {
		APPL_INFO("        Extention : " << it );
	}
	// display all elements
	for (auto &it : m_listHighlightPass1) {
		APPL_INFO("        Pass 1 : " << it.getName() );
		//it.display();
	}
	for (auto &it : m_listHighlightPass2) {
		APPL_INFO("        pass 2 : " << it.getName() );
		//it.display();
	}
	for (auto &it : m_listHighlightNamed) {
		APPL_INFO("        pass * : " << it.first << " : ");
		for (auto &it2 : it.second) {
			APPL_INFO("              " << it2.getName() );
			//it.display();
		}
		//it.display();
	}
}
예제 #15
0
TestScene::~TestScene() {
	APPL_INFO("Remove "__class__" ...");
}
예제 #16
0
파일: Main.cpp 프로젝트: atria-soft/ewol
		void onStart(ewol::Context& _context) override {
			APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
			// nothing to do ...
			APPL_INFO("==> START ... " PROJECT_NAME " (END)");
		}
예제 #17
0
TestScene::TestScene() :
	ewol::widget::Sizer(ewol::widget::Sizer::modeVert)
{
	addObjectType("appl::TestScene");
	/*
	m_ground = new game::Element("DATA:grass.obj");
	if (nullptr != m_ground) {
		m_ground->SetStaticMode(true);
		m_gameEngine.AddElement(m_ground);
	}
	*/
	
	APPL_CRITICAL("Create "__class__" (start)");
	std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = nullptr;
	std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr;
	std::shared_ptr<ewol::widget::Button> myButton = nullptr;
	/*
	mySizerHori = new ewol::widget::SizerHori();
	if (nullptr == mySizerHori) {
		APPL_DEBUG("Allocation error mySizerHori");
		return;
	}
	SubWidgetAdd(mySizerHori);
		myButton = new ewol::widget::Button("Add Box");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddBox);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Add Sphere");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddSphere);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Rotation X");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationX);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Rotation Y"); = nullptr
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationY);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Rotation Z");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationZ);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Rotation -");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotation0);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("UP");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventUp);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("DOWN");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventDown);
			mySizerHori->SubWidgetAdd(myButton);
		}
	mySizerHori = new ewol::widget::SizerHori();
	if (nullptr == mySizerHori) {
		APPL_DEBUG("Allocation error mySizerHori");
		return;
	}
	SubWidgetAdd(mySizerHori);
		myButton = new ewol::widget::Button("lunch object");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventLunch);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("1x speed");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed1);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("0.5x speed");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed0);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("2x speed");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed2);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("4x speed");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed4);
			mySizerHori->SubWidgetAdd(myButton);
		}
	*/
	std::shared_ptr<ewol::widget::Spacer> mySpacer = new widget::Spacer();
	if (nullptr != mySpacer) {
		mySpacer->setExpand(bvec2(false,false));
		mySpacer->setFill(bvec2(true,false));
		mySpacer->setMinSize(vec2(10,10));
		mySpacer->setColor(0xFF000080);
		subWidgetAdd(mySpacer);
	}
	
	mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori);
	if (nullptr == mySizerHori) {
		APPL_DEBUG("Allocation error mySizerHori");
		return;
	}
	subWidgetAdd(mySizerHori);
		mySpacer = new ewol::widget::Spacer();
		if (nullptr != mySpacer) {
			mySpacer->setExpand(bvec2(false,false));
			mySpacer->setFill(bvec2(false,true));
			mySpacer->setMinSize(vec2(10,10));
			mySpacer->setColor(0x00FF0080);
			mySizerHori->subWidgetAdd(mySpacer);
		}
		
		m_testWidget = new ewol::widget::Scene(/*&m_gameEngine*/ nullptr);
		if (nullptr != m_testWidget) {
			m_testWidget->setExpand(bvec2(true,true));
			m_testWidget->setFill(bvec2(true,true));
			mySizerHori->subWidgetAdd(m_testWidget);
		}
		
		mySpacer = new ewol::widget::Spacer();
		if (nullptr != mySpacer) {
			mySpacer->setExpand(bvec2(false,false));
			mySpacer->setFill(bvec2(false,true));
			mySpacer->setMinSize(vec2(10,10));
			mySpacer->setColor(0x0000FF80);
			mySizerHori->subWidgetAdd(mySpacer);
		}
		
	mySpacer = new ewol::widget::Spacer();
	if (nullptr != mySpacer) {
		mySpacer->setExpand(bvec2(false,false));
		mySpacer->setFill(bvec2(true,false));
		mySpacer->setMinSize(vec2(10,10));
		mySpacer->setColor(0x00FFFF80);
		subWidgetAdd(mySpacer);
	}
	APPL_INFO("Create "__class__" (end)");
}
예제 #18
0
int main(int _argc, const char** _argv) {
	// the only one init for etk:
	etk::init(_argc, _argv);
	std::string fbName = "";
	std::string micName = "";
	int32_t filterSize = 0;
	float mu = 0.0f;
	bool nlms = false;
	bool perf = false;
	int64_t sampleRate = 48000;
	for (int32_t iii=0; iii<_argc ; ++iii) {
		std::string data = _argv[iii];
		if (etk::start_with(data,"--fb=")) {
			fbName = &data[5];
		} else if (etk::start_with(data,"--mic=")) {
			micName = &data[6];
		} else if (etk::start_with(data,"--filter-size=")) {
			data = &data[14];
			filterSize = etk::string_to_int32_t(data);
		} else if (etk::start_with(data,"--mu=")) {
			data = &data[5];
			mu = etk::string_to_float(data);
		} else if (data == "--nlms") {
			nlms = true;
		} else if (data == "--perf") {
			perf = true;
		} else if (etk::start_with(data,"--sample-rate=")) {
			data = &data[14];
			sampleRate = etk::string_to_int32_t(data);
		} else if (    data == "-h"
		            || data == "--help") {
			APPL_INFO("Help : ");
			APPL_INFO("    ./xxx --fb=file.raw --mic=file.raw");
			APPL_INFO("        --fb=YYY.raw        Feedback file");
			APPL_INFO("        --mic=XXX.raw       Microphone file");
			APPL_INFO("        --filter-size=xxx   Size of the filter");
			APPL_INFO("        --mu=0.xx           Mu value -1.0< mu < -1.0");
			APPL_INFO("        --nlms              NLMS version");
			APPL_INFO("        --perf              Enable performence test (little slower but real performence test)");
			APPL_INFO("        --sample-rate=XXXX  Signal sample rate (default 48000)");
			exit(0);
		}
	}
	if (    fbName == ""
	     || micName == "") {
		APPL_ERROR("Can not Process missing parameters...");
		exit(-1);
	}
	APPL_INFO("Read FeedBack:");
	std::vector<int16_t> fbData = etk::FSNodeReadAllDataType<int16_t>(fbName);
	APPL_INFO("    " << fbData.size() << " samples");
	APPL_INFO("Read Microphone:");
	std::vector<int16_t> micData = etk::FSNodeReadAllDataType<int16_t>(micName);
	APPL_INFO("    " << micData.size() << " samples");
	// resize output :
	std::vector<int16_t> output;
	output.resize(std::min(fbData.size(), micData.size()), 0);
	// process in chunk of 256 samples
	int32_t blockSize = 256;
	// end filter :
	std::vector<float> filter;
	std11::chrono::nanoseconds totalTimeProcessing(0);
	std11::chrono::nanoseconds minProcessing(99999999999999LL);
	std11::chrono::nanoseconds maxProcessing(0);
	int32_t totalIteration = 0;
	if (nlms == false) {
		APPL_INFO("***********************");
		APPL_INFO("**         LMS       **");
		APPL_INFO("***********************");
		audio::algo::aec::Lms algo;
		if (filterSize != 0) {
			algo.setFilterSize(filterSize);
		}
		if (mu != 0.0f) {
			algo.setMu(mu);
		}
		int32_t lastPourcent = -1;
		for (int32_t iii=0; iii<output.size()/blockSize; ++iii) {
			if (lastPourcent != 100*iii / (output.size()/blockSize)) {
				lastPourcent = 100*iii / (output.size()/blockSize);
				APPL_INFO("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize << " " << lastPourcent << "/100");
			} else {
				APPL_VERBOSE("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize);
			}
			std11::chrono::steady_clock::time_point timeStart = std11::chrono::steady_clock::now();
			algo.process(&output[iii*blockSize], &fbData[iii*blockSize], &micData[iii*blockSize], blockSize);
			if (perf == true) {
				std11::chrono::steady_clock::time_point timeEnd = std11::chrono::steady_clock::now();
				std11::chrono::nanoseconds time = timeEnd - timeStart;
				minProcessing = std::min(minProcessing, time);
				maxProcessing = std::max(maxProcessing, time);
				totalTimeProcessing += time;
				totalIteration++;
				usleep(10000);
			}
		}
		filter = algo.getFilter();
	} else {
		APPL_INFO("***********************");
		APPL_INFO("**    NLMS (power)   **");
		APPL_INFO("***********************");
		audio::algo::aec::Nlms algo;
		if (filterSize != 0) {
			algo.setFilterSize(filterSize);
		}
		int32_t lastPourcent = -1;
		for (int32_t iii=0; iii<output.size()/blockSize; ++iii) {
			if (lastPourcent != 100*iii / (output.size()/blockSize)) {
				lastPourcent = 100*iii / (output.size()/blockSize);
				APPL_INFO("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize << " " << lastPourcent << "/100");
			} else {
				APPL_VERBOSE("Process : " << iii*blockSize << "/" << int32_t(output.size()/blockSize)*blockSize);
			}
			algo.process(&output[iii*blockSize], &fbData[iii*blockSize], &micData[iii*blockSize], blockSize);
		}
		filter = algo.getFilter();
	}
	if (perf == true) {
		APPL_INFO("Performance Result: ");
		APPL_INFO("    blockSize=" << blockSize << " sample");
		APPL_INFO("    min=" << minProcessing.count() << " ns");
		APPL_INFO("    max=" << maxProcessing.count() << " ns");
		APPL_INFO("    avg=" << totalTimeProcessing.count()/totalIteration << " ns");
		
		APPL_INFO("    min=" << (float((minProcessing.count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
		APPL_INFO("    max=" << (float((maxProcessing.count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
		APPL_INFO("    avg=" << (float(((totalTimeProcessing.count()/totalIteration)*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
	}
	etk::FSNodeWriteAllDataType<int16_t>("output.raw", output);
	etk::FSNodeWriteAllDataType<float>("filter.raw", filter);
	
}
예제 #19
0
파일: Main.cpp 프로젝트: biddyweb/ewol
		void unInit(ewol::Context& _context) {
			APPL_INFO("==> Un-Init APPL (START)");
			// nothing to do ...
			APPL_INFO("==> Un-Init APPL (END)");
		}
예제 #20
0
파일: TextViewer.cpp 프로젝트: HeeroYui/edn
void appl::TextViewer::onGetFocus() {
	showKeyboard();
	APPL_INFO("Focus - In");
	setCurrentSelect();
	markToRedraw();
}
예제 #21
0
파일: Main.cpp 프로젝트: atria-soft/ewol
		void onStop(ewol::Context& _context) override {
			APPL_INFO("==> STOP ... " PROJECT_NAME " (START)");
			// nothing to do ...
			APPL_INFO("==> STOP ... " PROJECT_NAME " (END)");
		}
예제 #22
0
파일: TextViewer.cpp 프로젝트: HeeroYui/edn
void appl::TextViewer::onLostFocus() {
	hideKeyboard();
	APPL_INFO("Focus - out");
	markToRedraw();
}
예제 #23
0
void appl::Windows::onCallbackPlay() {
	#if 0
		APPL_INFO("Play Requested ...");
		m_process = audio::blockEngine::Processing::create();
		if (m_process == null) {
			APPL_ERROR("can not create processing ...");
			return;
		}
		APPL_INFO("Create Generator ...");
		ememory::SharedPtr<audio::blockEngine::GeneratorFile> generator = audio::blockEngine::GeneratorFile::create();
		if (generator == null) {
			APPL_ERROR("can not create Generator ...");
			return;
		}
		generator->propertyName.set("myGenerator");
		m_process->addBlock(generator);
		
		APPL_INFO("Create DECODER ...");
		ememory::SharedPtr<audio::blockEngine::BlockDecoder> decoder = audio::blockEngine::BlockDecoder::create();
		if (decoder == null) {
			APPL_ERROR("can not create Generator ...");
			return;
		}
		decoder->propertyName.set("myDecoder");
		m_process->addBlock(decoder);
		
		APPL_INFO("Create Receiver ...");
		ememory::SharedPtr<audio::blockEngine::ReceiverRtAudio> receiver = audio::blockEngine::ReceiverRtAudio::create();
		if (receiver == null) {
			APPL_ERROR("can not create Receiver ...");
			return;
		}
		receiver->propertyName.set("myReceiver");
		m_process->addBlock(receiver);
		
		m_process->linkBlock("myGenerator", "out","myDecoder", "in");
		m_process->linkBlock("myDecoder", "out","myReceiver", "in");
		
		m_process->start();
		return;
	#else
		APPL_INFO("Play Requested ...");
		m_process = audio::blockEngine::Processing::create();
		if (m_process == null) {
			APPL_ERROR("can not create processing ...");
			return;
		}
		m_process->propertyName.set("main Process");
		APPL_INFO("Create Generator Sinus");
		ememory::SharedPtr<audio::blockEngine::GeneratorSignal> generator = audio::blockEngine::GeneratorSignal::create();
		if (generator == null) {
			APPL_ERROR("can not create Generator ...");
			return;
		}
		generator->propertyName.set("myGenerator");
		m_process->addBlock(generator);
		
		APPL_INFO("Create Receiver ...");
		ememory::SharedPtr<audio::blockEngine::ReceiverRiver> receiver = audio::blockEngine::ReceiverRiver::create();
		if (receiver == null) {
			APPL_ERROR("can not create Receiver ...");
			return;
		}
		receiver->propertyName.set("myReceiver");
		m_process->addBlock(receiver);
		
		m_process->linkBlock("myGenerator", "out","myReceiver", "in");
		
		m_process->start();
		return;
	#endif
}