bool OscToShmdata::init() { init_startable(this); port_spec_ = custom_props_->make_int_property("Port", "OSC port to listen", 1, 65536, port_, (GParamFlags) G_PARAM_READWRITE, set_port, get_port, this); install_property_by_pspec(custom_props_->get_gobject(), port_spec_, "port", "Port"); return true; }
bool PulseSrc::init() { init_startable(this); if (!pulsesrc_ || !shmsink_) return false; shmpath_ = make_file_name("audio"); g_object_set(G_OBJECT(pulsesrc_.get_raw()), "client-name", get_name().c_str(), nullptr); g_object_set(G_OBJECT(shmsink_.get_raw()), "socket-path", shmpath_.c_str(), nullptr); std::unique_lock<std::mutex> lock(devices_mutex_); GstUtils::g_idle_add_full_with_context(mainloop_->get_main_context(), G_PRIORITY_DEFAULT_IDLE, async_get_pulse_devices, this, nullptr); // waiting for devices to be updated devices_cond_.wait(lock); if (!connected_to_pulse_) { g_message("ERROR:Not connected to pulse, cannot initialize."); return false; } volume_id_ = pmanage<MPtr(&PContainer::push)>( "volume", GPropToProp::to_prop(G_OBJECT(pulsesrc_.get_raw()), "volume")); mute_id_ = pmanage<MPtr(&PContainer::push)>( "mute", GPropToProp::to_prop(G_OBJECT(pulsesrc_.get_raw()), "mute")); return true; }
AudioTestSource::AudioTestSource(const std::string &): gst_pipeline_(std2::make_unique<GstPipeliner>(nullptr, nullptr)){ init_startable(this); }
bool PostureMerge::init() { init_startable(this); shmcntr_.install_connect_method([this](const std::string path){return connect(path);}, [this](const std::string path){return disconnect(path);}, [this](){return disconnect_all();}, [this](const std::string caps ){return can_sink_caps(caps);}, 8); calibration_path_prop_ = custom_props_->make_string_property("calibration_path", "Path to the calibration file", calibration_path_.c_str(), (GParamFlags) G_PARAM_READWRITE, PostureMerge::set_calibration_path, PostureMerge::get_calibration_path, this); install_property_by_pspec(custom_props_->get_gobject(), calibration_path_prop_, "calibration_path", "Path to the calibration file"); devices_path_prop_ = custom_props_->make_string_property("devices_path", "Path to the devices description file", devices_path_.c_str (), (GParamFlags) G_PARAM_READWRITE, PostureMerge::set_devices_path, PostureMerge::get_devices_path, this); install_property_by_pspec(custom_props_->get_gobject(), devices_path_prop_, "devices", "Path to the devices description file"); compress_cloud_prop_ = custom_props_->make_boolean_property("compress_cloud", "Compress the cloud if true", compress_cloud_, (GParamFlags) G_PARAM_READWRITE, PostureMerge::set_compress_cloud, PostureMerge::get_compress_cloud, this); install_property_by_pspec(custom_props_->get_gobject(), compress_cloud_prop_, "compress_cloud", "Compress the cloud if true"); reload_calibration_prop_ = custom_props_->make_boolean_property("reload_calibration", "Reload calibration at each frame", reload_calibration_, (GParamFlags) G_PARAM_READWRITE, PostureMerge::set_reload_calibration, PostureMerge::get_reload_calibration, this); install_property_by_pspec(custom_props_->get_gobject(), reload_calibration_prop_, "reload_calibration", "Reload calibration at each frame"); save_cloud_prop_ = custom_props_->make_boolean_property("save_cloud", "Save the current cloud if true", save_cloud_, (GParamFlags) G_PARAM_READWRITE, PostureMerge::set_save_cloud, PostureMerge::get_save_cloud, this); install_property_by_pspec(custom_props_->get_gobject(), save_cloud_prop_, "save_cloud", "Save the current cloud if true"); downsample_prop_ = custom_props_->make_boolean_property("downsample", "Activate the cloud downsampling", downsample_, (GParamFlags) G_PARAM_READWRITE, PostureMerge::set_downsample_active, PostureMerge::get_downsample_active, this); install_property_by_pspec(custom_props_->get_gobject(), downsample_prop_, "downsample", "Activate the cloud downsampling"); return true; }
bool PostureMerge::init() { init_startable(this); shmcntr_.install_connect_method([this](const std::string path) { return connect(path); }, [this](const std::string path) { return disconnect(path); }, [this]() { return disconnect_all(); }, [this](const std::string caps) { return can_sink_caps(caps); }, 8); pmanage<MPtr(&PContainer::make_string)>( "calibration_path", [this](const std::string& val) { calibration_path_ = val; if (calibration_reader_) { calibration_reader_->loadCalibration(calibration_path_); merger_->setCalibration(calibration_reader_->getCalibrationParams()); } return true; }, [this]() { return calibration_path_; }, "Calibration path", "Path to the calibration file", calibration_path_); pmanage<MPtr(&PContainer::make_bool)>("compress_cloud", [this](const bool& val) { compress_cloud_ = val; return true; }, [this]() { return compress_cloud_; }, "Compression", "Compress the cloud if true", compress_cloud_); pmanage<MPtr(&PContainer::make_bool)>("reload_calibration", [this](const bool& val) { reload_calibration_ = val; return true; }, [this]() { return reload_calibration_; }, "Reload calibration", "Reload calibration at each frame", reload_calibration_); pmanage<MPtr(&PContainer::make_bool)>("save_cloud", [this](const bool& val) { save_cloud_ = val; return true; }, [this]() { return save_cloud_; }, "Save current cloud", "Save the current cloud if true", save_cloud_); pmanage<MPtr(&PContainer::make_bool)>( "downsample", [this](const bool& active) { if (downsample_ != active && active == true) { downsample_ = active; downsample_resolution_id_ = pmanage<MPtr(&PContainer::make_double)>( "downsample_resolution", [this](const double& val) { downsample_resolution_ = val; if (merger_ != nullptr) merger_->setDownsampling(downsample_, downsample_resolution_); return true; }, [this]() { return downsample_resolution_; }, "Resampling resolution", "Resampling resolution", downsample_resolution_, 0.01, 1.0); } else if (downsample_ != active && active == false) { downsample_ = false; pmanage<MPtr(&PContainer::remove)>(downsample_resolution_id_); } if (merger_ != nullptr) merger_->setDownsampling(downsample_, downsample_resolution_); return true; }, [this]() { return downsample_; }, "Downsample", "Activate the cloud downsampling", downsample_); return true; }
JackToShmdata::JackToShmdata(quid::Config&& conf) : Quiddity(std::forward<quid::Config>(conf)), client_name_(get_name()), jack_client_(client_name_, conf.tree_config_->branch_has_data("server_name") ? conf.tree_config_->branch_get_value("server_name").copy_as<std::string>() : std::string(), &JackToShmdata::jack_process, this, [this](uint n) { on_xrun(n); }, [this](jack_port_t* port) { on_port(port); }, [this]() { auto thread = std::thread([this]() { if (!qcontainer_->remove(qcontainer_->get_id(get_name()))) warning("% did not self destruct after jack shutdown", get_name()); }); thread.detach(); }) { if (jack_client_) client_name_ = jack_client_.get_name(); if (!jack_client_) { message("ERROR:JackClient cannot be instanciated (is jack server running?)"); is_valid_ = false; return; } init_startable(this); unsigned int max_number_of_channels = kMaxNumberOfChannels; if (config<MPtr(&InfoTree::branch_has_data)>("max_number_of_channels")) max_number_of_channels = config<MPtr(&InfoTree::branch_get_value)>("max_number_of_channels").copy_as<unsigned int>(); client_name_id_ = pmanage<MPtr(&PContainer::make_string)>("jack-client-name", [this](const std::string& val) { client_name_ = val; return true; }, [this]() { return client_name_; }, "Client Name", "The jack client name", client_name_); auto_connect_id_ = pmanage<MPtr(&PContainer::make_bool)>( "auto_connect", [this](const bool& val) { auto_connect_ = val; update_port_to_connect(); if (auto_connect_) { pmanage<MPtr(&PContainer::enable)>(connect_to_id_); pmanage<MPtr(&PContainer::enable)>(index_id_); } else { static const std::string why_disabled = "this property is available only when auto connect is enabled"; pmanage<MPtr(&PContainer::disable)>(connect_to_id_, why_disabled); pmanage<MPtr(&PContainer::disable)>(index_id_, why_disabled); } return true; }, [this]() { return auto_connect_; }, "Auto Connect", "Auto Connect to another client", auto_connect_); connect_to_id_ = pmanage<MPtr(&PContainer::make_string)>("connect-to", [this](const std::string& val) { connect_to_ = val; update_port_to_connect(); return true; }, [this]() { return connect_to_; }, "Connect To", "Auto connect to an other client", connect_to_); index_id_ = pmanage<MPtr(&PContainer::make_int)>("index", [this](const int& val) { index_ = val; update_port_to_connect(); return true; }, [this]() { return index_; }, "Channel", "Start connecting to other client from this index", num_channels_, 1, max_number_of_channels); num_channels_id_ = pmanage<MPtr(&PContainer::make_int)>("channels", [this](const int& val) { num_channels_ = val; update_port_to_connect(); return true; }, [this]() { return num_channels_; }, "Number of channels", "Number of channels", num_channels_, 1, max_number_of_channels); update_port_to_connect(); register_writer_suffix("audio"); }