26 #include "lv_common.h"
27 #include "lv_plugin_registry.h"
35 VisPluginData* plugin;
37 std::function<bool(Audio&)> callback;
42 VisInputPlugin* get_input_plugin ()
const;
58 VisInputPlugin* Input::Impl::get_input_plugin ()
const
66 return {
new Input{name},
false};
68 catch (std::exception& error) {
74 Input::Input (std::string
const& name)
79 throw std::runtime_error {
"Input plugin not found"};
83 if (!m_impl->plugin) {
84 throw std::runtime_error {
"Failed to load input plugin"};
95 if (m_impl->callback) {
104 return m_impl->plugin;
109 m_impl->callback = callback;
112 Audio const& Input::get_audio ()
114 return m_impl->audio;
119 if (m_impl->callback) {
120 m_impl->callback (m_impl->audio);
124 auto input_plugin = m_impl->get_input_plugin ();
131 input_plugin->upload (m_impl->plugin, &m_impl->audio);