Goal is to be able to call AudioBackendInfo::already_configured() from the right place.
namespace ARDOUR {
+struct LIBARDOUR_API AudioBackendInfo {
+ const char* name;
+
+ /** Using arg1 and arg2, initialize this audiobackend.
+ *
+ * Returns zero on success, non-zero otherwise.
+ */
+ int (*instantiate) (const std::string& arg1, const std::string& arg2);
+
+ /** Release all resources associated with this audiobackend
+ */
+ int (*deinstantiate) (void);
+
+ /** Factory method to create an AudioBackend-derived class.
+ *
+ * Returns a valid shared_ptr to the object if successfull,
+ * or a "null" shared_ptr otherwise.
+ */
+ boost::shared_ptr<AudioBackend> (*factory) (AudioEngine&);
+
+ /** Return true if the underlying mechanism/API has been
+ * configured and does not need (re)configuration in order
+ * to be usable. Return false otherwise.
+ *
+ * Note that this may return true if (re)configuration, even though
+ * not currently required, is still possible.
+ */
+ bool (*already_configured)();
+};
+
class LIBARDOUR_API AudioBackend : public PortEngine {
public:
- AudioBackend (AudioEngine& e) : PortEngine (e), engine (e) {}
+ AudioBackend (AudioEngine& e, AudioBackendInfo& i) : PortEngine (e), _info (i), engine (e) {}
virtual ~AudioBackend () {}
+
+ /** Return the AudioBackendInfo object from which this backend
+ was constructed.
+ */
+ AudioBackendInfo& info() const { return _info; }
/** Return the name of this backend.
*
}
protected:
- AudioEngine& engine;
-
- virtual int _start (bool for_latency_measurement) = 0;
-};
-
-struct LIBARDOUR_API AudioBackendInfo {
- const char* name;
-
- /** Using arg1 and arg2, initialize this audiobackend.
- *
- * Returns zero on success, non-zero otherwise.
- */
- int (*instantiate) (const std::string& arg1, const std::string& arg2);
-
- /** Release all resources associated with this audiobackend
- */
- int (*deinstantiate) (void);
+ AudioBackendInfo& _info;
+ AudioEngine& engine;
- /** Factory method to create an AudioBackend-derived class.
- *
- * Returns a valid shared_ptr to the object if successfull,
- * or a "null" shared_ptr otherwise.
- */
- boost::shared_ptr<AudioBackend> (*factory) (AudioEngine&);
-
- /** Return true if the underlying mechanism/API has been
- * configured and does not need (re)configuration in order
- * to be usable. Return false otherwise.
- *
- * Note that this may return true if (re)configuration, even though
- * not currently required, is still possible.
- */
- bool (*already_configured)();
+ virtual int _start (bool for_latency_measurement) = 0;
};
} // namespace
static std::string s_instance_name;
size_t DummyAudioBackend::_max_buffer_size = 8192;
-DummyAudioBackend::DummyAudioBackend (AudioEngine& e)
- : AudioBackend (e)
+DummyAudioBackend::DummyAudioBackend (AudioEngine& e, AudioBackendInfo& info)
+ : AudioBackend (e, info)
, _running (false)
, _freewheeling (false)
, _samplerate (48000)
static boost::shared_ptr<DummyAudioBackend> _instance;
+static boost::shared_ptr<AudioBackend> backend_factory (AudioEngine& e);
+static int instantiate (const std::string& arg1, const std::string& /* arg2 */);
+static int deinstantiate ();
+static bool already_configured ();
+
+static ARDOUR::AudioBackendInfo _descriptor = {
+ "Dummy",
+ instantiate,
+ deinstantiate,
+ backend_factory,
+ already_configured,
+};
+
static boost::shared_ptr<AudioBackend>
backend_factory (AudioEngine& e)
{
if (!_instance) {
- _instance.reset (new DummyAudioBackend (e));
+ _instance.reset (new DummyAudioBackend (e, _descriptor));
}
return _instance;
}
return false;
}
-static ARDOUR::AudioBackendInfo _descriptor = {
- "Dummy",
- instantiate,
- deinstantiate,
- backend_factory,
- already_configured,
-};
-
extern "C" ARDOURBACKEND_API ARDOUR::AudioBackendInfo* descriptor ()
{
return &_descriptor;
class DummyAudioBackend : public AudioBackend {
public:
- DummyAudioBackend (AudioEngine& e);
+ DummyAudioBackend (AudioEngine& e, AudioBackendInfo& info);
~DummyAudioBackend ();
/* AUDIOBACKEND API */
static boost::shared_ptr<JACKAudioBackend> backend;
static boost::shared_ptr<JackConnection> jack_connection;
+static boost::shared_ptr<AudioBackend> backend_factory (AudioEngine& ae);
+static int instantiate (const std::string& arg1, const std::string& arg2);
+static int deinstantiate ();
+static bool already_configured ();
+
+static ARDOUR::AudioBackendInfo _descriptor = {
+ "JACK",
+ instantiate,
+ deinstantiate,
+ backend_factory,
+ already_configured,
+};
+
static boost::shared_ptr<AudioBackend>
backend_factory (AudioEngine& ae)
{
}
if (!backend) {
- backend.reset (new JACKAudioBackend (ae, jack_connection));
+ backend.reset (new JACKAudioBackend (ae, _descriptor, jack_connection));
}
return backend;
return !JackConnection::in_control ();
}
-static ARDOUR::AudioBackendInfo _descriptor = {
- "JACK",
- instantiate,
- deinstantiate,
- backend_factory,
- already_configured,
-};
-
extern "C" ARDOURBACKEND_API ARDOUR::AudioBackendInfo* descriptor() { return &_descriptor; }
#define GET_PRIVATE_JACK_POINTER(localvar) jack_client_t* localvar = _jack_connection->jack(); if (!(localvar)) { return; }
#define GET_PRIVATE_JACK_POINTER_RET(localvar,r) jack_client_t* localvar = _jack_connection->jack(); if (!(localvar)) { return r; }
-JACKAudioBackend::JACKAudioBackend (AudioEngine& e, boost::shared_ptr<JackConnection> jc)
- : AudioBackend (e)
+JACKAudioBackend::JACKAudioBackend (AudioEngine& e, AudioBackendInfo& info, boost::shared_ptr<JackConnection> jc)
+ : AudioBackend (e, info)
, _jack_connection (jc)
, _running (false)
, _freewheeling (false)
class JACKAudioBackend : public AudioBackend {
public:
- JACKAudioBackend (AudioEngine& e, boost::shared_ptr<JackConnection>);
+ JACKAudioBackend (AudioEngine& e, AudioBackendInfo& info, boost::shared_ptr<JackConnection>);
~JACKAudioBackend ();
/* AUDIOBACKEND API */
using namespace ARDOUR;
+#ifdef __MINGW64__
+ extern "C" __declspec(dllexport) ARDOUR::AudioBackendInfo* descriptor ()
+#else
+ extern "C" ARDOURBACKEND_API ARDOUR::AudioBackendInfo* descriptor ()
+#endif
+{
+ // COMMENTED DBG LOGS */ std::cout << "waves_backend.dll : ARDOUR::AudioBackendInfo* descriptor (): " << std::endl;
+ return &WavesAudioBackend::backend_info ();
+}
+
void WavesAudioBackend::AudioDeviceManagerNotification (NotificationReason reason, void* parameter)
{
switch (reason) {
}
-WavesAudioBackend::WavesAudioBackend (AudioEngine& e)
- : AudioBackend (e)
+WavesAudioBackend::WavesAudioBackend (AudioEngine& e, AudioBackendInfo& info)
+ : AudioBackend (e, info)
, _audio_device_manager (this)
, _midi_device_manager (*this)
, _device (NULL)
{
// COMMENTED DBG LOGS */ std::cout << "WavesAudioBackend::__waves_backend_factory ():" << std::endl;
if (!__instance) {
- __instance.reset (new WavesAudioBackend (e));
+ __instance.reset (new WavesAudioBackend (e, descriptor()));
}
return __instance;
}
WavesAudioBackend::__already_configured,
};
-#ifdef __MINGW64__
- extern "C" __declspec(dllexport) ARDOUR::AudioBackendInfo* descriptor ()
-#else
- extern "C" ARDOURBACKEND_API ARDOUR::AudioBackendInfo* descriptor ()
-#endif
-{
- // COMMENTED DBG LOGS */ std::cout << "waves_backend.dll : ARDOUR::AudioBackendInfo* descriptor (): " << std::endl;
- return &WavesAudioBackend::backend_info ();
-}
class WavesAudioBackend : public AudioBackend, WCMRAudioDeviceManagerClient
{
public:
- WavesAudioBackend (AudioEngine& e);
+ WavesAudioBackend (AudioEngine& e, AudioBackendInfo&);
virtual ~WavesAudioBackend ();
/* AUDIOBACKEND API */