コード例 #1
0
MidiBridge::MidiBridge (string name,  PortRequest & req)
	: _name (name)
{
	// use only midi interface and talk directly to the engine via signals
	
	_port = 0;
	_done = false;
	_learning = false;
	_clockdone = false;
	_use_osc = false;
	_addr = 0;
	_midi_thread = 0;
	_clock_thread = 0;
	_output_clock = false;
	_getnext = false;
	_feedback_out = false;

	PortFactory factory;
	
	if ((_port = factory.create_port (req)) == 0) {
		cerr << "failed to create port" << endl;
		return;
	}

	// this is a callback that will be made from the parser
	_port->input()->any.connect (mem_fun (*this, &MidiBridge::incoming_midi));

	init_thread();
	init_clock_thread();
	_ok = true;
	
}
コード例 #2
0
MidiBridge::MidiBridge (string name, string oscurl, PortRequest & req)
	: _name (name), _oscurl(oscurl)
{
	// talk directly to the engine via signals AND send osc 

	_port = 0;
	_done = false;
	_learning = false;
	_use_osc = true;
	_addr = 0;
	_midi_thread = 0;
	_clock_thread = 0;
	_clockdone = false;
	_output_clock = false;
	_getnext = false;
	_feedback_out = false;

	_addr = lo_address_new_from_url (_oscurl.c_str());
	if (lo_address_errno (_addr) < 0) {
		fprintf(stderr, "MidiBridge:: addr error %d: %s\n", lo_address_errno(_addr), lo_address_errstr(_addr));
		_use_osc = false;
	}


	PortFactory factory;
	
	if ((_port = factory.create_port (req)) == 0) {
		return;
	}

	// this is a callback that will be made from the parser
	_port->input()->any.connect (mem_fun (*this, &MidiBridge::incoming_midi));

	init_thread();
	init_clock_thread();

	_ok = true;
}