示例#1
0
文件: feed.c 项目: pmyadlowsky/mash
static void init_feed(FEED *feed) {
	feed->sock = 0;
	feed->converter = NULL;
	feed->src_data_in = NULL;
	feed->src_data_size = 0;
	init_unit(&(feed->unit));
	feed->thread_id = 0;
	feed->running = 0;
	feed->cbuf = NULL;
	init_fader(&(feed->unit.fader), 1.0);
	return;
	}
示例#2
0
//==============================================================================
bool CC_Base::execute(int argc, char *argv[])
{
	po::options_description desc;
	init_options(desc);

	try
	{
		po::variables_map vm;
		po::store(po::parse_command_line(argc, argv, desc), vm);
		po::notify(vm);

		if (vm.count("log"))
			init_log(argc, argv, option_log_name_);

		if (!read_options(desc, vm))
			return false;

		if (init_programmer() && init_unit())
		{
			log_info("main, start task processing");
			process_tasks();
			log_info("main, finish task processing");
			programmer_.unit_close();
			return true;
		}
	}
	catch (std::runtime_error& e) // usb, file error
	{
		std::cout << "  Error occured";
		if (strlen(e.what()))
		{
			std::cout << ": " << e.what();
			log_info("%s", e.what());
		}
		std::cout << "\n";
	}
	catch (po::error& e) //command line error
	{
		std::cout << "  Bad command line options";
		if (strlen(e.what()))
			std::cout << " (" << e.what() << ")";
		std::cout << "\n  Try --help for more information\n";
	}
	return false;
}