Test for jack_set_port_rename_callback presence at both compile time and run time.
git-svn-id: file:///home/vcs/svn/jsweeper/trunk@41 6611ac79-6612-48ef-a1e9-b906f853523emaster
parent
c444ab7334
commit
66a92a0725
|
@ -4,6 +4,7 @@ PROJECT(jsweeper)
|
||||||
|
|
||||||
INCLUDE( ${CMAKE_ROOT}/Modules/FindPkgConfig.cmake )
|
INCLUDE( ${CMAKE_ROOT}/Modules/FindPkgConfig.cmake )
|
||||||
INCLUDE( ${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake )
|
INCLUDE( ${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake )
|
||||||
|
INCLUDE( CheckLibraryExists)
|
||||||
|
|
||||||
pkg_check_modules(JACK jack>=0.118)
|
pkg_check_modules(JACK jack>=0.118)
|
||||||
pkg_check_modules(GTKMM gtkmm-2.4>=2.4)
|
pkg_check_modules(GTKMM gtkmm-2.4>=2.4)
|
||||||
|
@ -60,6 +61,11 @@ INCLUDE_DIRECTORIES(
|
||||||
${PCRE_INCLUDE_DIRS}
|
${PCRE_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
CHECK_LIBRARY_EXISTS(jack jack_set_port_rename_callback ${JACK_INCLUDE_DIRS}/jack.h RENAME_FOUND)
|
||||||
|
IF (RENAME_FOUND)
|
||||||
|
ADD_DEFINITIONS(-DHAVE_RENAME)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
ADD_DEFINITIONS(-Wall -Wextra -ansi -pedantic)
|
ADD_DEFINITIONS(-Wall -Wextra -ansi -pedantic)
|
||||||
ADD_EXECUTABLE(jsweeper ${SOURCES})
|
ADD_EXECUTABLE(jsweeper ${SOURCES})
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,10 @@ Gui::Gui(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &builder)
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
Glib::signal_timeout().connect(sigc::mem_fun(*this, &Gui::on_timeout), 50);
|
Glib::signal_timeout().connect(sigc::mem_fun(*this, &Gui::on_timeout), 50);
|
||||||
#ifndef HAVE_RENAME
|
|
||||||
Glib::signal_timeout().connect(sigc::mem_fun(*this, &Gui::on_timeout_2), 1000);
|
if (!jack_set_port_rename_callback) {
|
||||||
#endif
|
Glib::signal_timeout().connect(sigc::mem_fun(*this, &Gui::on_timeout_2), 1000);
|
||||||
|
}
|
||||||
|
|
||||||
Glib::RefPtr<Gtk::UIManager> uim = Glib::RefPtr<Gtk::UIManager>::cast_static(builder->get_object("uimanager1"));
|
Glib::RefPtr<Gtk::UIManager> uim = Glib::RefPtr<Gtk::UIManager>::cast_static(builder->get_object("uimanager1"));
|
||||||
uim->get_action("/menubar1/menuitem1/menu_quit")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_quit));
|
uim->get_action("/menubar1/menuitem1/menu_quit")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_quit));
|
||||||
|
@ -176,7 +177,6 @@ bool Gui::on_timeout()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_RENAME
|
|
||||||
bool Gui::on_timeout_2()
|
bool Gui::on_timeout_2()
|
||||||
{
|
{
|
||||||
if (m_closing) return false;
|
if (m_closing) return false;
|
||||||
|
@ -188,7 +188,6 @@ bool Gui::on_timeout_2()
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void Gui::on_notebook_switch_page(GtkNotebookPage * /* page */, guint /* page_num */)
|
void Gui::on_notebook_switch_page(GtkNotebookPage * /* page */, guint /* page_num */)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,9 +30,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool on_timeout();
|
bool on_timeout();
|
||||||
#ifndef HAVE_RENAME
|
|
||||||
bool on_timeout_2();
|
bool on_timeout_2();
|
||||||
#endif
|
|
||||||
void on_notebook_switch_page(GtkNotebookPage * /* page */, guint /* page_num */);
|
void on_notebook_switch_page(GtkNotebookPage * /* page */, guint /* page_num */);
|
||||||
|
|
||||||
void on_quit();
|
void on_quit();
|
||||||
|
|
|
@ -37,11 +37,9 @@ void JackDriver::Connect()
|
||||||
jack_on_shutdown(m_client, &ShutdownCallbackHandler, this);
|
jack_on_shutdown(m_client, &ShutdownCallbackHandler, this);
|
||||||
jack_set_port_registration_callback(m_client, &PortRegistrationCallbackHandler, this);
|
jack_set_port_registration_callback(m_client, &PortRegistrationCallbackHandler, this);
|
||||||
jack_set_port_connect_callback(m_client, &PortConnectCallbackHandler, this);
|
jack_set_port_connect_callback(m_client, &PortConnectCallbackHandler, this);
|
||||||
#ifdef HAVE_RENAME
|
|
||||||
if (jack_set_port_rename_callback) {
|
if (jack_set_port_rename_callback) {
|
||||||
jack_set_port_rename_callback(m_client, &PortRenameCallbackHandler, this);
|
jack_set_port_rename_callback(m_client, &PortRenameCallbackHandler, this);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
jack_activate(m_client);
|
jack_activate(m_client);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
#include <jack/jack.h>
|
#include <jack/jack.h>
|
||||||
#include <jack/ringbuffer.h>
|
#include <jack/ringbuffer.h>
|
||||||
|
|
||||||
|
#ifndef HAVE_RENAME
|
||||||
|
typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void *arg);
|
||||||
|
int jack_set_port_rename_callback (jack_client_t *, JackPortRenameCallback rename_callback, void *arg) __attribute__((__weak__));
|
||||||
|
#endif
|
||||||
|
|
||||||
enum PortEventType
|
enum PortEventType
|
||||||
{
|
{
|
||||||
PET_REGISTER,
|
PET_REGISTER,
|
||||||
|
|
|
@ -89,9 +89,7 @@ struct Port : Base
|
||||||
Client *m_client;
|
Client *m_client;
|
||||||
PortGroup *m_group;
|
PortGroup *m_group;
|
||||||
PortList m_connections;
|
PortList m_connections;
|
||||||
#ifndef HAVE_RENAME
|
|
||||||
std::string m_real_name;
|
std::string m_real_name;
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual ConnectionMode ConnectedTo(Port *port);
|
virtual ConnectionMode ConnectedTo(Port *port);
|
||||||
virtual ConnectionMode ConnectedTo(PortGroup *group);
|
virtual ConnectionMode ConnectedTo(PortGroup *group);
|
||||||
|
|
|
@ -118,9 +118,7 @@ void PortManager::Add(jack_port_t *port)
|
||||||
p->m_port = port;
|
p->m_port = port;
|
||||||
p->m_is_input = (JackPortFlags)jack_port_flags(port) & JackPortIsInput;
|
p->m_is_input = (JackPortFlags)jack_port_flags(port) & JackPortIsInput;
|
||||||
|
|
||||||
#ifndef HAVE_RENAME
|
|
||||||
p->m_real_name = jack_port_name(port);
|
p->m_real_name = jack_port_name(port);
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string type = jack_port_type(port);
|
std::string type = jack_port_type(port);
|
||||||
p->m_is_midi = type == JACK_DEFAULT_MIDI_TYPE;
|
p->m_is_midi = type == JACK_DEFAULT_MIDI_TYPE;
|
||||||
|
@ -227,7 +225,6 @@ void PortManager::Rename(jack_port_t *port)
|
||||||
RefreshConnections();
|
RefreshConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_RENAME
|
|
||||||
bool PortManager::PollPortRenames()
|
bool PortManager::PollPortRenames()
|
||||||
{
|
{
|
||||||
// Queue for storing ports to be renamed, to avoid messing up the
|
// Queue for storing ports to be renamed, to avoid messing up the
|
||||||
|
@ -251,7 +248,6 @@ bool PortManager::PollPortRenames()
|
||||||
|
|
||||||
return queue.size() > 0;
|
return queue.size() > 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Client *PortManager::FindOrMakeClient(std::string name, bool is_input, bool is_midi)
|
Client *PortManager::FindOrMakeClient(std::string name, bool is_input, bool is_midi)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,9 +46,7 @@ public:
|
||||||
void Disconnect(jack_port_t *port_a, jack_port_t *port_b);
|
void Disconnect(jack_port_t *port_a, jack_port_t *port_b);
|
||||||
|
|
||||||
void Rename(jack_port_t *port);
|
void Rename(jack_port_t *port);
|
||||||
#ifndef HAVE_RENAME
|
|
||||||
bool PollPortRenames();
|
bool PollPortRenames();
|
||||||
#endif
|
|
||||||
|
|
||||||
Client *FindOrMakeClient(std::string name, bool is_input, bool is_midi);
|
Client *FindOrMakeClient(std::string name, bool is_input, bool is_midi);
|
||||||
PortGroup *FindOrMakeGroup(Client *client, std::string name);
|
PortGroup *FindOrMakeGroup(Client *client, std::string name);
|
||||||
|
|
Loading…
Reference in New Issue