| 4782 | } |
| 4783 | |
| 4784 | static v3_result V3_API create_instance(void* self, const v3_tuid class_id, const v3_tuid iid, void** const instance) |
| 4785 | { |
| 4786 | d_debug("dpf_factory::create_instance => %p %s %s %p", self, tuid2str(class_id), tuid2str(iid), instance); |
| 4787 | dpf_factory* const factory = *static_cast<dpf_factory**>(self); |
| 4788 | |
| 4789 | // query for host application |
| 4790 | v3_host_application** hostApplication = nullptr; |
| 4791 | if (factory->hostContext != nullptr) |
| 4792 | v3_cpp_obj_query_interface(factory->hostContext, v3_host_application_iid, &hostApplication); |
| 4793 | |
| 4794 | // create component |
| 4795 | if (v3_tuid_match(class_id, *(const v3_tuid*)&dpf_tuid_class) && (v3_tuid_match(iid, v3_component_iid) || |
| 4796 | v3_tuid_match(iid, v3_funknown_iid))) |
| 4797 | { |
| 4798 | dpf_component** const componentptr = new dpf_component*; |
| 4799 | *componentptr = new dpf_component(hostApplication); |
| 4800 | *instance = static_cast<void*>(componentptr); |
| 4801 | return V3_OK; |
| 4802 | } |
| 4803 | |
| 4804 | #if DPF_VST3_USES_SEPARATE_CONTROLLER |
| 4805 | // create edit controller |
| 4806 | if (v3_tuid_match(class_id, *(const v3_tuid*)&dpf_tuid_controller) && (v3_tuid_match(iid, v3_edit_controller_iid) || |
| 4807 | v3_tuid_match(iid, v3_funknown_iid))) |
| 4808 | { |
| 4809 | dpf_edit_controller** const controllerptr = new dpf_edit_controller*; |
| 4810 | *controllerptr = new dpf_edit_controller(hostApplication); |
| 4811 | *instance = static_cast<void*>(controllerptr); |
| 4812 | return V3_OK; |
| 4813 | } |
| 4814 | #endif |
| 4815 | |
| 4816 | // unsupported, roll back host application |
| 4817 | if (hostApplication != nullptr) |
| 4818 | v3_cpp_obj_unref(hostApplication); |
| 4819 | |
| 4820 | return V3_NO_INTERFACE; |
| 4821 | } |
| 4822 | |
| 4823 | // ---------------------------------------------------------------------------------------------------------------- |
| 4824 | // v3_plugin_factory_2 |
no test coverage detected