63 const char * pl_bundle,
68 auto basename = io_path_get_basename (pl_bundle);
69 char * tmpdir = g_dir_make_tmp (
"zrythm_vst_XXXXXX",
nullptr);
70 auto dest_path = Glib::build_filename (tmpdir, basename);
71 if (g_str_has_suffix (pl_bundle,
"vst3"))
73 EXPECT_NO_THROW (io_copy_dir (dest_path, pl_bundle,
true,
true));
77 EXPECT_NO_THROW (io_copy_dir (dest_path, &pl_bundle[7],
true,
true));
81 GFile * pl_bundle_file = NULL;
82 pl_bundle_file = g_file_new_for_path (pl_bundle);
83 GFile * pl_bundle_file_in_tmp = g_file_new_for_path (dest_path.c_str ());
85 EXPECT_TRUE (g_file_copy (
86 pl_bundle_file, pl_bundle_file_in_tmp, G_FILE_COPY_NONE,
nullptr,
87 nullptr,
nullptr, &err));
91 g_setenv (
"VST3_PATH", tmpdir,
true);
92 g_setenv (
"LV2_PATH", tmpdir,
true);
93 g_setenv (
"VST_PATH", tmpdir,
true);
97 bool scan_finished =
false;
98 zrythm::gui::old_dsp::plugins::PluginManager::get_active_instance ()
100 zrythm::gui::old_dsp::plugins::PluginManager::get_active_instance ()
101 ->begin_scan (1.0,
nullptr, [&scan_finished] () { scan_finished =
true; });
102 while (!scan_finished)
104 g_main_context_iteration (
nullptr,
true);
107 zrythm::gui::old_dsp::plugins::PluginManager::get_active_instance ()
108 ->plugin_descriptors_);
110 std::optional<PluginDescriptor> descr;
112 const auto &cur_descr :
113 zrythm::gui::old_dsp::plugins::PluginManager::get_active_instance ()
114 ->plugin_descriptors_)
118 if (cur_descr.uri_ == pl_uri)
123 else if (cur_descr.protocol_ != ProtocolType::LV2)
125 auto basename = io_path_get_basename (pl_bundle);
126 auto descr_basename = io_path_get_basename (cur_descr.path_);
127 if (descr_basename == basename)
133 EXPECT_HAS_VALUE (descr);
135 PluginConfiguration setting (descr.value ());
138 setting.open_with_carla_ =
true;
141 setting->open_with_carla_ = with_carla;
163 const char * pl_bundle,
169 PluginConfiguration setting =
172 Track::Type track_type = Track::Type::AudioBus;
177 setting.descr_.category_ = PluginCategory::INSTRUMENT;
178 setting.descr_.category_str_ =
179 PluginDescriptor::category_to_string (setting.descr_.category_);
180 track_type = Track::Type::Instrument;
185 Track::create_with_action (
186 track_type, &setting,
nullptr,
nullptr, TRACKLIST->get_num_tracks (),
187 num_tracks, -1,
nullptr));
189 return TRACKLIST->get_num_tracks () - 1;
int test_plugin_manager_create_tracks_from_plugin(const char *pl_bundle, const char *pl_uri, bool is_instrument, bool with_carla, int num_tracks=1)
Creates num_tracks tracks for the given plugin.