bool Ambix_rotator_zAudioProcessor::oscIn(bool arg) { if (arg) { if (!osc_in) { st = lo_server_thread_new(osc_in_port.toUTF8(), error); if (st != NULL) { lo_server_thread_add_method(st, "/rotation", "fff", rotation_handler, this); lo_server_thread_add_method(st, "/head_pose", "fffffff", headpose_handler, this); int res = lo_server_thread_start(st); if (res == 0) { arg = true; osc_in = true; osc_error = "OSC: receiving on port "; osc_error += osc_in_port; } } else { osc_error = "OSC: ERROR port is not free"; //osc_error.formatted("OSC: ERROR %s", lo_address_errstr()); arg = false; osc_in = false; } } else { oscIn(false); oscIn(true); } } else { // turn off osc if (osc_in) { lo_server_thread_stop(st); #ifndef _WIN32 lo_server_thread_free(st); // this crashes in windows #endif arg = false; osc_in = false; osc_error = "OSC: not receiving"; } } return arg; }
//-------------------------------------------------------------- void testApp::update(){ ofBackground(230, 230, 230); videohub.update(); oscIn(); getReceiveStatus(); isVideohubUpdate(); // cout<<videohub.getReceiveStatus()<<endl; }
Ambix_encoderAudioProcessor::~Ambix_encoderAudioProcessor() { Ambix_encoderAudioProcessor::s_ID--; // instance counter #if WITH_OSC oscIn(false); oscOut(false); #endif myProperties.closeFiles(); }
//============================================================================== Ambix_rotator_zAudioProcessor::Ambix_rotator_zAudioProcessor() : rot_z_param(0.5f), output_buffer(16, 256) { cos_z.resize(AMBI_ORDER+1); sin_z.resize(AMBI_ORDER+1); cos_z.set(0, 1.f); sin_z.set(0, 0.f); _cos_z.resize(AMBI_ORDER+1); _sin_z.resize(AMBI_ORDER+1); _cos_z.set(0, 1.f); _sin_z.set(0, 0.f); #ifdef WITH_OSC osc_in = false; osc_in_port ="7120"; #ifndef _WIN32 oscIn(true); // deactivate osc for windows in the moment.. #endif #endif }
Ambix_encoderAudioProcessor::Ambix_encoderAudioProcessor(): myProperties(), azimuth_param(0.5f), elevation_param(0.5f), size_param(0.f), width_param(0.125f), _azimuth_param(0.5f), // buffers _elevation_param(0.5f), _size_param(0.0f), _rms(0.f), _dpk(0.f), speed_param(0.25f), azimuth_set_param(0.5f), azimuth_set_rel_param(0.5f), azimuth_mv_param(0.5f), elevation_set_param(0.5f), elevation_set_rel_param(0.5f), elevation_mv_param(0.5f), InputBuffer(INPUT_CHANNELS, 512), rms(0.0f), dpk(0.0f) { // create encoders for (int i =0; i < INPUT_CHANNELS; i++) { AmbiEnc.add(new AmbixEncoder()); // call twice to set buffers zero AmbiEnc.getLast()->calcParams(); AmbiEnc.getLast()->calcParams(); } // azimuth, elevation, size // if more than one channel add width parameter: all sources are aligned along with equal distance NumParameters = 3; #if INPUT_CHANNELS > 1 NumParameters += 1; #endif // advanced control add set x2, setrelative x2, move x2 and movespeed #if WITH_ADVANCED_CONTROL NumParameters += 7; #endif //set encoder id Ambix_encoderAudioProcessor::s_ID++; m_id = Ambix_encoderAudioProcessor::s_ID; PropertiesFile::Options prop_options; prop_options.applicationName = "settings"; prop_options.commonToAllUsers = false; prop_options.filenameSuffix = "xml"; prop_options.folderName = "ambix/settings"; prop_options.storageFormat = PropertiesFile::storeAsXML; // options.storageFormat = PropertiesFile::storeAsBinary; prop_options.ignoreCaseOfKeyNames = true; prop_options.osxLibrarySubFolder = "Application Support"; myProperties.setStorageParameters(prop_options); #if WITH_OSC osc_in = false; osc_out = false; osc_in_port = "0"; osc_out_ip = myProperties.getUserSettings()->getValue("osc_out_ip", "localhost"); osc_out_port = myProperties.getUserSettings()->getValue("osc_out_port", "7130"); osc_interval = myProperties.getUserSettings()->getIntValue("osc_out_interval", 50); osc_out = myProperties.getUserSettings()->getBoolValue("osc_out", true); osc_in = myProperties.getUserSettings()->getBoolValue("osc_in", true); oscReceiver = new OSCReceiver; oscOut(osc_out); oscIn(osc_in); #endif }
Ambix_rotator_zAudioProcessor::~Ambix_rotator_zAudioProcessor() { #ifdef WITH_OSC oscIn(false); #endif }