2009-12-25 01:59:39 +01:00
|
|
|
|
|
|
|
/*******************************************************************************/
|
|
|
|
/* Copyright (C) 2009 Jonathan Moore Liles */
|
|
|
|
/* */
|
|
|
|
/* This program is free software; you can redistribute it and/or modify it */
|
|
|
|
/* under the terms of the GNU General Public License as published by the */
|
|
|
|
/* Free Software Foundation; either version 2 of the License, or (at your */
|
|
|
|
/* option) any later version. */
|
|
|
|
/* */
|
|
|
|
/* This program is distributed in the hope that it will be useful, but WITHOUT */
|
|
|
|
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
|
|
|
|
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
|
|
|
|
/* more details. */
|
|
|
|
/* */
|
|
|
|
/* You should have received a copy of the GNU General Public License along */
|
|
|
|
/* with This program; see the file COPYING. If not,write to the Free Software */
|
|
|
|
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
/*******************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Module.H"
|
2009-12-28 06:25:28 +01:00
|
|
|
#include "Loggable.H"
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-01-18 04:59:56 +01:00
|
|
|
class Fl_Menu_Button;
|
2010-01-20 08:43:22 +01:00
|
|
|
class Thread;
|
2010-01-18 04:59:56 +01:00
|
|
|
|
|
|
|
class Plugin_Module : public Module {
|
|
|
|
|
2010-01-20 08:43:22 +01:00
|
|
|
static Thread *plugin_discover_thread;
|
|
|
|
|
2010-01-18 04:59:56 +01:00
|
|
|
public:
|
|
|
|
|
2013-09-25 06:39:10 +02:00
|
|
|
class Plugin_Info
|
2010-01-18 04:59:56 +01:00
|
|
|
{
|
2013-09-25 06:39:10 +02:00
|
|
|
public:
|
2010-01-18 04:59:56 +01:00
|
|
|
const char *path;
|
|
|
|
unsigned long id;
|
2013-09-25 06:39:10 +02:00
|
|
|
std::string name;
|
|
|
|
std::string author;
|
|
|
|
std::string category;
|
2013-04-13 22:18:03 +02:00
|
|
|
int audio_inputs;
|
|
|
|
int audio_outputs;
|
|
|
|
const char *type;
|
|
|
|
bool favorite;
|
2010-01-18 04:59:56 +01:00
|
|
|
|
|
|
|
Plugin_Info ( )
|
|
|
|
{
|
|
|
|
path = 0;
|
|
|
|
id = 0;
|
2013-09-25 06:39:10 +02:00
|
|
|
|
2013-04-13 22:18:03 +02:00
|
|
|
audio_inputs = 0;
|
|
|
|
audio_outputs = 0;
|
|
|
|
type = "LADSPA";
|
|
|
|
favorite = 0;
|
2010-01-18 04:59:56 +01:00
|
|
|
}
|
2013-04-13 22:18:03 +02:00
|
|
|
|
2013-09-25 06:39:10 +02:00
|
|
|
|
2013-04-13 22:18:03 +02:00
|
|
|
bool operator< ( const Plugin_Info &rhs ) {
|
2013-09-25 06:39:10 +02:00
|
|
|
return strcmp( name.c_str(), rhs.name.c_str() ) < 1;
|
2013-04-13 22:18:03 +02:00
|
|
|
}
|
2010-01-18 04:59:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
bool load ( unsigned long id );
|
|
|
|
|
|
|
|
private:
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2013-08-24 23:21:44 +02:00
|
|
|
volatile nframes_t _latency;
|
|
|
|
nframes_t _last_latency;
|
2013-09-12 09:07:18 +02:00
|
|
|
|
2009-12-25 01:59:39 +01:00
|
|
|
void init ( void );
|
|
|
|
|
|
|
|
void bbox ( int &X, int &Y, int &W, int &H )
|
|
|
|
{
|
|
|
|
X = x();
|
|
|
|
Y = y() + 5;
|
|
|
|
W = w();
|
|
|
|
H = h() - 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cb_handle(Fl_Widget*);
|
|
|
|
static void cb_handle(Fl_Widget*, void*);
|
|
|
|
|
|
|
|
Fl_Button *close_button;
|
|
|
|
|
|
|
|
struct ImplementationData;
|
|
|
|
|
|
|
|
ImplementationData *_idata;
|
|
|
|
|
|
|
|
int _plugin_ins;
|
|
|
|
int _plugin_outs;
|
|
|
|
bool _crosswire;
|
|
|
|
|
2010-01-20 08:43:22 +01:00
|
|
|
static void *discover_thread ( void * );
|
2013-04-13 22:18:03 +02:00
|
|
|
|
2009-12-25 01:59:39 +01:00
|
|
|
|
|
|
|
void set_input_buffer ( int n, void *buf );
|
|
|
|
void set_output_buffer ( int n, void *buf );
|
|
|
|
void set_control_buffer ( int n, void *buf );
|
|
|
|
void activate ( void );
|
|
|
|
void deactivate ( void );
|
2013-10-01 04:10:17 +02:00
|
|
|
|
|
|
|
bool apply ( sample_t *buf, nframes_t nframes );
|
2009-12-25 01:59:39 +01:00
|
|
|
void process ( unsigned long nframes );
|
|
|
|
|
2009-12-25 20:16:07 +01:00
|
|
|
bool plugin_instances ( unsigned int );
|
|
|
|
|
|
|
|
void connect_ports ( void );
|
|
|
|
|
2013-03-16 01:47:38 +01:00
|
|
|
bool loaded ( void ) const;
|
2010-01-20 08:43:22 +01:00
|
|
|
|
2009-12-25 01:59:39 +01:00
|
|
|
public:
|
|
|
|
|
2013-10-01 04:10:17 +02:00
|
|
|
virtual bool get_impulse_response ( sample_t *buf, nframes_t nframes );
|
|
|
|
|
2013-09-15 04:27:03 +02:00
|
|
|
virtual nframes_t get_module_latency ( void ) const;
|
|
|
|
|
2013-08-24 23:21:44 +02:00
|
|
|
virtual void update ( void );
|
|
|
|
|
2013-04-13 22:18:03 +02:00
|
|
|
static std::list<Plugin_Info> get_all_plugins ( void );
|
|
|
|
|
2010-01-20 08:43:22 +01:00
|
|
|
static void spawn_discover_thread ( void );
|
2012-03-05 03:57:00 +01:00
|
|
|
static void join_discover_thread ( void );
|
2010-01-20 08:43:22 +01:00
|
|
|
|
2009-12-25 01:59:39 +01:00
|
|
|
Plugin_Module ( );
|
|
|
|
virtual ~Plugin_Module();
|
|
|
|
|
|
|
|
int plugin_ins ( void ) const { return _plugin_ins; }
|
|
|
|
int plugin_outs ( void ) const { return _plugin_outs; }
|
|
|
|
|
|
|
|
void select_plugin ( unsigned long id );
|
|
|
|
|
|
|
|
const char *name ( void ) const { return "Plugin"; }
|
|
|
|
|
|
|
|
int can_support_inputs ( int );
|
|
|
|
bool configure_inputs ( int );
|
|
|
|
|
2013-03-16 01:54:37 +01:00
|
|
|
virtual bool bypass ( void ) const { return _bypass; }
|
2013-03-14 02:02:45 +01:00
|
|
|
virtual void bypass ( bool v );
|
|
|
|
|
|
|
|
virtual void process ( nframes_t );
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2009-12-25 20:16:07 +01:00
|
|
|
void handle_port_connection_change ( void );
|
|
|
|
|
2009-12-28 06:25:28 +01:00
|
|
|
LOG_CREATE_FUNC( Plugin_Module );
|
|
|
|
|
2010-01-14 04:20:40 +01:00
|
|
|
MODULE_CLONE_FUNC( Plugin_Module );
|
|
|
|
|
2009-12-25 01:59:39 +01:00
|
|
|
protected:
|
|
|
|
|
2009-12-28 06:25:28 +01:00
|
|
|
void get ( Log_Entry &e ) const;
|
|
|
|
void set ( Log_Entry &e );
|
2009-12-25 01:59:39 +01:00
|
|
|
|
|
|
|
};
|