2020-02-20 07:12:36 -05:00
|
|
|
/*
|
2021-06-13 10:32:18 -04:00
|
|
|
* Copyright (C) 2020 Luciano Iam <oss@lucianoiam.com>
|
2020-02-20 07:12:36 -05:00
|
|
|
*
|
|
|
|
* 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; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2020-05-30 13:08:27 -04:00
|
|
|
#ifndef _ardour_surface_websockets_mixer_h_
|
|
|
|
#define _ardour_surface_websockets_mixer_h_
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-08-29 16:41:47 -04:00
|
|
|
#include <glibmm/threads.h>
|
|
|
|
|
2020-02-20 07:12:36 -05:00
|
|
|
#include "component.h"
|
|
|
|
#include "typed_value.h"
|
|
|
|
|
2020-08-30 15:15:07 -04:00
|
|
|
namespace ArdourSurface {
|
|
|
|
|
2020-08-30 16:50:25 -04:00
|
|
|
class ArdourMixerNotFoundException : public std::runtime_error
|
2020-08-29 11:01:35 -04:00
|
|
|
{
|
2020-08-30 15:15:33 -04:00
|
|
|
public:
|
|
|
|
ArdourMixerNotFoundException (std::string const & what)
|
2020-08-30 16:50:25 -04:00
|
|
|
: std::runtime_error (what)
|
2020-08-30 15:15:33 -04:00
|
|
|
, _what (what)
|
|
|
|
{}
|
2020-08-30 16:50:25 -04:00
|
|
|
|
|
|
|
~ArdourMixerNotFoundException() throw() {}
|
|
|
|
|
|
|
|
const char* what() const throw() { return _what.c_str(); }
|
|
|
|
|
2020-08-30 15:15:33 -04:00
|
|
|
private:
|
|
|
|
std::string _what;
|
2020-08-29 11:01:35 -04:00
|
|
|
};
|
|
|
|
|
2020-08-30 16:50:25 -04:00
|
|
|
class ArdourMixerPlugin : public PBD::ScopedConnectionList
|
2020-02-20 07:12:36 -05:00
|
|
|
{
|
2020-02-23 10:03:59 -05:00
|
|
|
public:
|
2020-08-29 11:01:35 -04:00
|
|
|
ArdourMixerPlugin (boost::shared_ptr<ARDOUR::PluginInsert>);
|
2020-08-29 16:41:47 -04:00
|
|
|
~ArdourMixerPlugin ();
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-09-05 07:12:04 -04:00
|
|
|
boost::shared_ptr<ARDOUR::PluginInsert> insert () const;
|
2020-08-29 14:06:00 -04:00
|
|
|
|
2020-08-29 11:01:35 -04:00
|
|
|
bool enabled () const;
|
|
|
|
void set_enabled (bool);
|
|
|
|
|
2020-08-29 16:41:47 -04:00
|
|
|
uint32_t param_count () const;
|
2020-08-29 11:01:35 -04:00
|
|
|
TypedValue param_value (uint32_t);
|
|
|
|
void set_param_value (uint32_t, TypedValue);
|
|
|
|
|
|
|
|
boost::shared_ptr<ARDOUR::AutomationControl> param_control (uint32_t) const;
|
|
|
|
|
|
|
|
static TypedValue param_value (boost::shared_ptr<ARDOUR::AutomationControl>);
|
|
|
|
|
|
|
|
private:
|
2020-09-05 07:12:04 -04:00
|
|
|
boost::shared_ptr<ARDOUR::PluginInsert> _insert;
|
2020-08-29 11:01:35 -04:00
|
|
|
};
|
|
|
|
|
2020-08-30 16:50:25 -04:00
|
|
|
class ArdourMixerStrip : public PBD::ScopedConnectionList
|
2020-08-29 11:01:35 -04:00
|
|
|
{
|
|
|
|
public:
|
2020-08-29 16:41:47 -04:00
|
|
|
ArdourMixerStrip (boost::shared_ptr<ARDOUR::Stripable>, PBD::EventLoop*);
|
|
|
|
~ArdourMixerStrip ();
|
|
|
|
|
2020-09-05 07:12:04 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Stripable> stripable () const;
|
2020-08-29 11:01:35 -04:00
|
|
|
|
2020-08-30 16:50:25 -04:00
|
|
|
typedef std::map<uint32_t, boost::shared_ptr<ArdourMixerPlugin> > PluginMap;
|
2020-08-29 14:06:00 -04:00
|
|
|
|
|
|
|
PluginMap& plugins ();
|
|
|
|
ArdourMixerPlugin& plugin (uint32_t);
|
2020-08-29 11:01:35 -04:00
|
|
|
|
|
|
|
double gain () const;
|
|
|
|
void set_gain (double);
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-09-01 16:28:00 -04:00
|
|
|
bool has_pan () const;
|
2020-08-29 11:01:35 -04:00
|
|
|
double pan () const;
|
|
|
|
void set_pan (double);
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-08-29 11:01:35 -04:00
|
|
|
bool mute () const;
|
|
|
|
void set_mute (bool);
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-08-29 11:01:35 -04:00
|
|
|
std::string name () const;
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-08-29 11:01:35 -04:00
|
|
|
float meter_level_db () const;
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-08-29 11:01:35 -04:00
|
|
|
static double to_db (double);
|
|
|
|
static double from_db (double);
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-09-05 07:12:04 -04:00
|
|
|
static int to_velocity (double);
|
|
|
|
static double from_velocity (int);
|
|
|
|
|
2020-08-29 11:01:35 -04:00
|
|
|
private:
|
2020-09-05 07:12:04 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Stripable> _stripable;
|
2020-08-29 14:06:00 -04:00
|
|
|
|
|
|
|
PluginMap _plugins;
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-09-05 07:12:04 -04:00
|
|
|
bool is_midi () const;
|
|
|
|
|
2020-08-29 11:01:35 -04:00
|
|
|
void on_drop_plugin (uint32_t);
|
|
|
|
|
|
|
|
};
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-08-29 11:01:35 -04:00
|
|
|
class ArdourMixer : public SurfaceComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ArdourMixer (ArdourSurface::ArdourWebsockets& surface)
|
|
|
|
: SurfaceComponent (surface){};
|
|
|
|
virtual ~ArdourMixer (){};
|
|
|
|
|
|
|
|
int start ();
|
|
|
|
int stop ();
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-08-30 16:50:25 -04:00
|
|
|
typedef std::map<uint32_t, boost::shared_ptr<ArdourMixerStrip> > StripMap;
|
2020-08-29 14:06:00 -04:00
|
|
|
|
|
|
|
StripMap& strips ();
|
|
|
|
ArdourMixerStrip& strip (uint32_t);
|
2020-08-29 11:01:35 -04:00
|
|
|
void on_drop_strip (uint32_t);
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-08-29 16:41:47 -04:00
|
|
|
Glib::Threads::Mutex& mutex ();
|
|
|
|
|
2020-02-23 10:03:59 -05:00
|
|
|
private:
|
2020-08-29 16:41:47 -04:00
|
|
|
StripMap _strips;
|
|
|
|
Glib::Threads::Mutex _mutex;
|
2020-02-20 07:12:36 -05:00
|
|
|
};
|
|
|
|
|
2020-08-30 15:15:07 -04:00
|
|
|
} // namespace ArdourSurface
|
|
|
|
|
2020-05-30 13:08:27 -04:00
|
|
|
#endif // _ardour_surface_websockets_mixer_h_
|