More renaming, fixed bugs with disconnecting patch ports internally

git-svn-id: http://svn.drobilla.net/lad@74 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
dave 2006-06-21 07:03:30 +00:00
parent 69e29e497d
commit f12a33ee18
20 changed files with 107 additions and 127 deletions

View File

@ -5,10 +5,10 @@ AC_CONFIG_SRCDIR([src/common/interface/EngineInterface.h])
AC_CONFIG_SRCDIR([src/libs/engine/JackAudioDriver.cpp])
AC_CONFIG_SRCDIR([src/libs/engine/tests/node_tree_test.cpp])
AC_CONFIG_SRCDIR([src/libs/client/OSCController.cpp])
AC_CONFIG_SRCDIR([src/progs/engine/main.cpp])
AC_CONFIG_SRCDIR([src/progs/server/main.cpp])
AC_CONFIG_SRCDIR([src/progs/patch_loader/patch_loader.cpp])
AC_CONFIG_SRCDIR([src/progs/demolition/demolition.cpp])
AC_CONFIG_SRCDIR([src/progs/gtk/main.cpp])
AC_CONFIG_SRCDIR([src/progs/ingenuity/main.cpp])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE
@ -339,13 +339,13 @@ AC_CONFIG_FILES([src/libs/engine/Makefile])
AC_CONFIG_FILES([src/libs/engine/tests/Makefile])
AC_CONFIG_FILES([src/libs/client/Makefile])
AC_CONFIG_FILES([src/progs/Makefile])
AC_CONFIG_FILES([src/progs/om/Makefile])
AC_CONFIG_FILES([src/progs/server/Makefile])
AC_CONFIG_FILES([src/progs/supercollider/Makefile])
AC_CONFIG_FILES([src/progs/python/Makefile])
AC_CONFIG_FILES([src/progs/python/scripts/Makefile])
AC_CONFIG_FILES([src/progs/demolition/Makefile])
AC_CONFIG_FILES([src/progs/patch_loader/Makefile])
AC_CONFIG_FILES([src/progs/gtk/Makefile])
AC_CONFIG_FILES([src/progs/ingenuity/Makefile])
AC_CONFIG_FILES([patches/Makefile])
AC_CONFIG_FILES([doc/Doxyfile])
AC_OUTPUT
@ -354,7 +354,7 @@ AC_OUTPUT
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Ingen build configuration:])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Building engine: $build_engine])
AC_MSG_NOTICE([Building server: $build_engine])
AC_MSG_NOTICE([ Jack MIDI support: $build_jack_midi])
AC_MSG_NOTICE([ ALSA MIDI support: $build_alsa_midi])
AC_MSG_NOTICE([ LV2 Plugin support: $build_lv2])
@ -366,7 +366,7 @@ AC_MSG_NOTICE([Building in-process engine: $build_in_process_engine])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Building console clients: $build_console_clients])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Building gtk client: $build_gtk_client])
AC_MSG_NOTICE([Building Ingenuity (GTK): $build_gtk_client])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Building with flags: $CXXFLAGS])

View File

@ -33,12 +33,12 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_bindir}/om
%{_bindir}/om_gtk
%{_bindir}/ingenuity
%{_bindir}/om_patch_loader
%dir %{_datadir}/om
%{_datadir}/om/patches/*.om
%dir %{_datadir}/om-gtk
%{_datadir}/om-gtk/om_gtk.glade
%{_datadir}/om-gtk/ingenuity.glade
%{_datadir}/om-gtk/om-icon.png

View File

@ -5,9 +5,9 @@ AM_CXXFLAGS = @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ @LASH_CFLAGS@ @SLV2_CFLA
MAINTAINERCLEANFILES = Makefile.in
noinst_LTLIBRARIES = libom.la
noinst_LTLIBRARIES = libingen.la
libom_la_SOURCES = \
libingen_la_SOURCES = \
util.h \
tuning.h \
DataType.h \
@ -88,12 +88,12 @@ libom_la_SOURCES = \
AudioDriver.h \
MidiDriver.h \
midi.h \
../libom_la/util/Semaphore.h \
../libom_la/util/types.h \
../libom_la/util/Path.h \
../libom_la/util/Queue.h \
../libom_la/interface/ClientInterface.h \
../libom_la/interface/EngineInterface.h \
../libingen_la/util/Semaphore.h \
../libingen_la/util/types.h \
../libingen_la/util/Path.h \
../libingen_la/util/Queue.h \
../libingen_la/interface/ClientInterface.h \
../libingen_la/interface/EngineInterface.h \
instantiations.cpp \
events/RegisterClientEvent.h \
events/RegisterClientEvent.cpp \
@ -169,25 +169,25 @@ libom_la_SOURCES = \
# MidiOutputNode.cpp
if WITH_JACK_MIDI
libom_la_SOURCES += \
libingen_la_SOURCES += \
JackMidiDriver.h \
JackMidiDriver.cpp
endif
if WITH_ALSA_MIDI
libom_la_SOURCES += \
libingen_la_SOURCES += \
AlsaMidiDriver.h \
AlsaMidiDriver.cpp
endif
if WITH_LADSPA
libom_la_SOURCES += \
libingen_la_SOURCES += \
LADSPANode.h \
LADSPANode.cpp
endif
if WITH_DSSI
libom_la_SOURCES += \
libingen_la_SOURCES += \
DSSINode.h \
DSSINode.cpp \
events/DSSIConfigureEvent.cpp \
@ -201,13 +201,13 @@ libom_la_SOURCES += \
endif
if WITH_LV2
libom_la_SOURCES += \
libingen_la_SOURCES += \
LV2Node.h \
LV2Node.cpp
endif
if WITH_LASH
libom_la_SOURCES += \
libingen_la_SOURCES += \
LashDriver.h \
LashDriver.cpp \
LashRestoreDoneEvent.h

View File

@ -164,19 +164,17 @@ TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, O
assert(dst_port != NULL);
}
template <typename T>
TypedConnectionEvent<T>::~TypedConnectionEvent()
{
// FIXME: haaaack, prevent a double delete
// this class is unusable by anything other than ConnectionEvent because of this
//m_responder = NULL;
}
template <typename T>
void
TypedConnectionEvent<T>::pre_process()
{
{
if (m_dst_port->is_connected_to(m_src_port)) {
m_succeeded = false;
QueuedEvent::pre_process();
return;
}
Node* const src_node = m_src_port->parent_node();
Node* const dst_node = m_dst_port->parent_node();

View File

@ -81,7 +81,6 @@ class TypedConnectionEvent : public QueuedEvent
{
public:
TypedConnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port);
~TypedConnectionEvent();
void pre_process();
void execute(samplecount offset);

View File

@ -78,61 +78,63 @@ void
DisconnectionEvent::pre_process()
{
if (m_lookup) {
if (m_src_port_path.parent().parent() != m_dst_port_path.parent().parent()) {
if (m_src_port_path.parent().parent() != m_dst_port_path.parent().parent()
&& m_src_port_path.parent() != m_dst_port_path.parent().parent()
&& m_src_port_path.parent().parent() != m_dst_port_path.parent()) {
m_error = PARENT_PATCH_DIFFERENT;
QueuedEvent::pre_process();
return;
}
/*m_patch = om->object_store()->find_patch(m_src_port_path.parent().parent());
if (m_patch == NULL) {
m_error = PORT_NOT_FOUND;
QueuedEvent::pre_process();
return;
}*/
Port* port1 = om->object_store()->find_port(m_src_port_path);
Port* port2 = om->object_store()->find_port(m_dst_port_path);
if (port1 == NULL || port2 == NULL) {
if (m_patch == NULL) {
m_error = PORT_NOT_FOUND;
QueuedEvent::pre_process();
return;
}*/
m_src_port = om->object_store()->find_port(m_src_port_path);
m_dst_port = om->object_store()->find_port(m_dst_port_path);
if (m_src_port == NULL || m_dst_port == NULL) {
m_error = PORT_NOT_FOUND;
QueuedEvent::pre_process();
return;
}
if (port1->type() != port2->type()) {
if (m_src_port->type() != m_dst_port->type() || m_src_port->buffer_size() != m_dst_port->buffer_size()) {
m_error = TYPE_MISMATCH;
QueuedEvent::pre_process();
return;
}
if (port1->is_output() && port2->is_input()) {
m_src_port = port1;
m_dst_port = port2;
} else if (port2->is_output() && port1->is_input()) {
m_src_port = port2;
m_dst_port = port1;
/*if (port1->is_output() && port2->is_input()) {
m_src_port = port1;
m_dst_port = port2;
} else if (port2->is_output() && port1->is_input()) {
m_src_port = port2;
m_dst_port = port1;
} else {
m_error = TYPE_MISMATCH;
QueuedEvent::pre_process();
return;
}*/
// Create the typed event to actually do the work
const DataType type = m_src_port->type();
if (type == DataType::FLOAT) {
m_typed_event = new TypedDisconnectionEvent<sample>(m_responder,
dynamic_cast<OutputPort<sample>*>(m_src_port), dynamic_cast<InputPort<sample>*>(m_dst_port));
} else if (type == DataType::MIDI) {
m_typed_event = new TypedDisconnectionEvent<MidiMessage>(m_responder,
dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port));
} else {
m_error = TYPE_MISMATCH;
QueuedEvent::pre_process();
return;
}
}
// Create the typed event to actually do the work
const DataType type = m_src_port->type();
if (type == DataType::FLOAT) {
m_typed_event = new TypedDisconnectionEvent<sample>(m_responder,
dynamic_cast<OutputPort<sample>*>(m_src_port), dynamic_cast<InputPort<sample>*>(m_dst_port));
} else if (type == DataType::MIDI) {
m_typed_event = new TypedDisconnectionEvent<MidiMessage>(m_responder,
dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port));
} else {
m_error = TYPE_MISMATCH;
QueuedEvent::pre_process();
return;
}
m_typed_event->pre_process();
@ -157,7 +159,7 @@ DisconnectionEvent::post_process()
m_typed_event->post_process();
} else {
// FIXME: better error messages
string msg = "Unable to make connection ";
string msg = "Unable to disconnect ";
msg.append(m_src_port_path + " -> " + m_dst_port_path);
m_responder->respond_error(msg);
}
@ -181,14 +183,6 @@ TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> respon
assert(dst_port != NULL);
}
template <typename T>
TypedDisconnectionEvent<T>::~TypedDisconnectionEvent()
{
// FIXME: haaaack, prevent a double delete
// this class is unusable by anything other than DisconnectionEvent because of this
//m_responder = NULL;
}
template <typename T>
void
@ -202,8 +196,20 @@ TypedDisconnectionEvent<T>::pre_process()
Node* const src_node = m_src_port->parent_node();
Node* const dst_node = m_dst_port->parent_node();
m_patch = src_node->parent_patch();
if (src_node->parent_patch() != dst_node->parent_patch()) {
// Connection to a patch port from inside the patch
assert(src_node->parent() == dst_node || dst_node->parent() == src_node);
if (src_node->parent() == dst_node)
m_patch = dynamic_cast<Patch*>(dst_node);
else
m_patch = dynamic_cast<Patch*>(src_node);
} else {
// Normal connection between nodes with the same parent
m_patch = src_node->parent_patch();
}
assert(m_patch);
assert(m_patch == src_node->parent() || m_patch == dst_node->parent());
if (src_node == NULL || dst_node == NULL) {
m_succeeded = false;
@ -211,30 +217,17 @@ TypedDisconnectionEvent<T>::pre_process()
return;
}
if (src_node->parent() != m_patch || dst_node->parent() != m_patch) {
m_succeeded = false;
QueuedEvent::pre_process();
return;
}
bool removed = false;
for (List<Node*>::iterator i = dst_node->providers()->begin(); i != dst_node->providers()->end(); ++i)
if ((*i) == src_node) {
delete dst_node->providers()->remove(i);
removed = true;
break;
}
assert(removed);
removed = false;
for (List<Node*>::iterator i = src_node->dependants()->begin(); i != src_node->dependants()->end(); ++i)
if ((*i) == dst_node) {
delete src_node->dependants()->remove(i);
removed = true;
break;
}
assert(removed);
if (m_patch->process())
m_process_order = m_patch->build_process_order();

View File

@ -83,7 +83,6 @@ class TypedDisconnectionEvent : public QueuedEvent
{
public:
TypedDisconnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port);
~TypedDisconnectionEvent();
void pre_process();
void execute(samplecount offset);

View File

@ -2,14 +2,14 @@ AM_CXXFLAGS = -I$(top_srcdir)/src/common
DIST_SUBDIRS = python supercollider
SUBDIRS = om
SUBDIRS = server
if BUILD_CONSOLE_CLIENTS
SUBDIRS += patch_loader demolition
endif
if BUILD_GTK_CLIENT
SUBDIRS += gtk
SUBDIRS += ingenuity
endif

View File

@ -183,7 +183,7 @@ create_patch()
engine->create_patch_from_model(pm);
// Spread them out a bit for easier monitoring with om_gtk
// Spread them out a bit for easier monitoring with ingenuity
char tmp_buf[8];
snprintf(tmp_buf, 8, "%d", 1600 + rand()%800 - 400);
engine->set_metadata(pm->path(), "module-x", string(tmp_buf));
@ -226,7 +226,7 @@ add_node()
NodeModel* nm = new NodeModel(plugin, parent->path() +"/"+ random_name());
cout << "Adding node " << nm->path() << endl;
engine->create_node_from_model(nm);
// Spread them out a bit for easier monitoring with om_gtk
// Spread them out a bit for easier monitoring with ingenuity
char tmp_buf[8];
snprintf(tmp_buf, 8, "%d", 1600 + rand()%800 - 400);
engine->set_metadata(nm->path(), "module-x", tmp_buf);

View File

@ -154,7 +154,7 @@ DSSIController::attempt_to_show_gui()
const char* dllName = node_model()->plugin()->lib_name().c_str();
const char* label = node_model()->plugin()->plug_label().c_str();
const char* myName = "om_gtk";
const char* myName = "ingenuity";
const string& oscUrl = engine_url + "/dssi" + node_model()->path();
struct dirent* entry = NULL;

View File

@ -30,16 +30,16 @@ void
GladeFactory::find_glade_file()
{
// Check for the .glade file in current directory
glade_filename = "./om_gtk.glade";
glade_filename = "./ingenuity.glade";
ifstream fs(glade_filename.c_str());
if (fs.fail()) { // didn't find it, check PKGDATADIR
fs.clear();
glade_filename = PKGDATADIR;
glade_filename += "/om_gtk.glade";
glade_filename += "/ingenuity.glade";
fs.open(glade_filename.c_str());
if (fs.fail()) {
cerr << "[GladeFactory] Unable to find om_gtk.glade in current directory or " << PKGDATADIR << "." << endl;
cerr << "[GladeFactory] Unable to find ingenuity.glade in current directory or " << PKGDATADIR << "." << endl;
throw;
}
fs.close();

View File

@ -1,18 +1,18 @@
if BUILD_GTK_CLIENT
EXTRA_DIST = om_gtk.gladep
EXTRA_DIST = ingenuity.gladep
MAINTAINERCLEANFILES = Makefile.in
sharefilesdir = $(pkgdatadir)
dist_sharefiles_DATA = om_gtk.glade om-icon.png
dist_sharefiles_DATA = ingenuity.glade om-icon.png
AM_CXXFLAGS = -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs/client -DPKGDATADIR=\"$(pkgdatadir)\" @GTKMM_CFLAGS@ @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ @LOSC_CFLAGS@ @LASH_CFLAGS@ @FLOWCANVAS_CFLAGS@ -DWITH_RTTI
om_gtk_LDADD = @GTKMM_LIBS@ @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @LOSC_LIBS@ @LASH_LIBS@ @FLOWCANVAS_LIBS@ ../../libs/client/libomclient.la
om_gtk_DEPENDENCIES = ../../libs/client/libomclient.la
ingenuity_LDADD = @GTKMM_LIBS@ @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @LOSC_LIBS@ @LASH_LIBS@ @FLOWCANVAS_LIBS@ ../../libs/client/libomclient.la
ingenuity_DEPENDENCIES = ../../libs/client/libomclient.la
bin_PROGRAMS = om_gtk
om_gtk_SOURCES = \
bin_PROGRAMS = ingenuity
ingenuity_SOURCES = \
cmdline.h \
cmdline.c \
main.cpp \
@ -88,7 +88,7 @@ om_gtk_SOURCES = \
PatchTreeWindow.cpp
if WITH_LASH
om_gtk_SOURCES += LashController.h LashController.cpp
ingenuity_SOURCES += LashController.h LashController.cpp
endif

View File

@ -36,7 +36,7 @@ cmdline_parser_print_help (void)
"Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE);
printf(" -h --help Print help and exit\n");
printf(" -V --version Print version and exit\n");
printf(" -uSTRING --engine-url=STRING Om engine URL to connect to\n");
printf(" -uSTRING --engine-url=STRING Ingen OSC URL to connect to\n");
printf(" -pINT --client-port=INT Client port to listen on\n");
}
@ -106,7 +106,7 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i
cmdline_parser_print_version ();
exit (EXIT_SUCCESS);
case 'u': /* Om engine URL to connect to. */
case 'u': /* Ingen OSC URL to connect to. */
if (args_info->engine_url_given)
{
fprintf (stderr, "%s: `--engine-url' (`-u') option given more than once\n", CMDLINE_PARSER_PACKAGE);

View File

@ -1,7 +1,7 @@
# Process this file with gengetopt -u to generate the necessary code (in cmdline.h, cmdline.c)
package "om_gtk - A GUI client for the Om realtime modular synthesizer"
package "ingenuity - A GUI client for the Ingen realtime audio processor"
option "engine-url" u "Om engine URL to connect to" string no
option "engine-url" u "Ingen OSC URL to connect to" string no
option "client-port" p "Client port to listen on" int no

View File

@ -15,7 +15,7 @@ extern "C" {
#endif /* __cplusplus */
#ifndef CMDLINE_PARSER_PACKAGE
#define CMDLINE_PARSER_PACKAGE "om_gtk - A GUI client for the Om realtime modular synthesizer"
#define CMDLINE_PARSER_PACKAGE "ingenuity - A GUI client for the Ingen realtime audio processor"
#endif
#ifndef CMDLINE_PARSER_VERSION
@ -24,7 +24,7 @@ extern "C" {
struct gengetopt_args_info
{
char * engine_url_arg; /* Om engine URL to connect to. */
char * engine_url_arg; /* Ingen OSC URL to connect to. */
int client_port_arg; /* Client port to listen on. */
int help_given ; /* Whether help was given. */

View File

@ -1,9 +0,0 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
<glade-project>
<name>OmGtk</name>
<program_name>om_gtk</program_name>
<language>C++</language>
<gnome_support>FALSE</gnome_support>
</glade-project>

View File

@ -410,7 +410,7 @@ class Environment:
#~ * min-value (float) - Suggested maximum value
#~ * Note that in the event of loading a patch, this message could be followed immediately by a control change, meaning the default-value is not actually the current value of the port (ahem, Lachlan).
#~ * The minimum and maximum values are suggestions only, they are not enforced in any way, and going outside them is perfectly fine. Also note that the port ranges in om_gtk are not these ones! Those ranges are set as metadata.
#~ * The minimum and maximum values are suggestions only, they are not enforced in any way, and going outside them is perfectly fine. Also note that the port ranges in ingenuity are not these ones! Those ranges are set as metadata.
def __ingen__new_port(self,path,porttype,direction,hint,defaultvalue,minvalue,maxvalue):
port = self.getPort(path)
port.setPortType(porttype)

View File

@ -8,10 +8,10 @@ MAINTAINERCLEANFILES = Makefile.in
if BUILD_ENGINE
bin_PROGRAMS = ingen
om_DEPENDENCIES = ../../libs/engine/libingen.la
om_LDADD = @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ @LASH_LIBS@ @SLV2_LIBS@ -lrt ../../libs/engine/libingen.la
ingen_DEPENDENCIES = ../../libs/engine/libingen.la
ingen_LDADD = @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ @LASH_LIBS@ @SLV2_LIBS@ -lrt ../../libs/engine/libingen.la
om_SOURCES = \
ingen_SOURCES = \
main.cpp \
cmdline.h \
cmdline.c