Skip to content
Permalink
Browse files

Allow nodes to have dynamic list of ports.

- Currently only used for CustomCSound nodes.
- Bring back node parameters
- Add a ObjectListEditor widget.
  • Loading branch information...
odahoda committed Apr 6, 2019
1 parent 9f4dbd2 commit c3e5c3a88dcf7cfac5f13cd67601be0b8c2fe3a5
Showing with 1,976 additions and 482 deletions.
  1. +1 −1 3rdparty/protoc/setup.py
  2. +7 −5 3rdparty/typeshed/PyQt5/QtWidgets.pyi
  3. +3 −3 CMakeLists.txt
  4. +9 −11 listdeps
  5. +3 −0 noisicaa/audioproc/__init__.py
  6. +13 −0 noisicaa/audioproc/audioproc.proto
  7. +13 −0 noisicaa/audioproc/audioproc_process.py
  8. +3 −3 noisicaa/audioproc/engine/CMakeLists.txt
  9. +12 −3 noisicaa/audioproc/engine/csound_util.cpp
  10. +1 −0 noisicaa/audioproc/engine/csound_util.h
  11. +138 −57 noisicaa/audioproc/engine/graph.py
  12. +3 −0 noisicaa/audioproc/engine/plugin_host_process.py
  13. +16 −3 noisicaa/audioproc/engine/processor.cpp
  14. +5 −2 noisicaa/audioproc/engine/processor.h
  15. +1 −0 noisicaa/audioproc/engine/processor.pxd
  16. +3 −2 noisicaa/audioproc/engine/processor.pyi
  17. +5 −0 noisicaa/audioproc/engine/processor.pyx
  18. +7 −1 noisicaa/audioproc/engine/processor_csound_base.cpp
  19. +8 −4 noisicaa/audioproc/engine/processor_plugin.cpp
  20. +1 −1 noisicaa/audioproc/engine/processor_plugin.h
  21. +6 −2 noisicaa/audioproc/engine/{processor.proto → processor_plugin.proto}
  22. +14 −10 noisicaa/audioproc/engine/processor_plugin_test.py
  23. +3 −0 noisicaa/audioproc/public/CMakeLists.txt
  24. +3 −0 noisicaa/audioproc/public/__init__.py
  25. +2 −3 ...a/{builtin_nodes/custom_csound/processor_messages.proto → audioproc/public/node_parameters.proto}
  26. +0 −1 noisicaa/builtin_nodes/CMakeLists.txt
  27. +2 −1 noisicaa/builtin_nodes/client_registry.py
  28. +3 −0 noisicaa/builtin_nodes/commands_registry.proto
  29. +4 −8 noisicaa/builtin_nodes/custom_csound/CMakeLists.txt
  30. +11 −7 noisicaa/builtin_nodes/custom_csound/client_impl.py
  31. +22 −0 noisicaa/builtin_nodes/custom_csound/client_impl_test.py
  32. +15 −0 noisicaa/builtin_nodes/custom_csound/commands.proto
  33. +35 −0 noisicaa/builtin_nodes/custom_csound/commands.py
  34. +5 −0 noisicaa/builtin_nodes/custom_csound/model.proto
  35. +147 −2 noisicaa/builtin_nodes/custom_csound/model.py
  36. +0 −47 noisicaa/builtin_nodes/custom_csound/node_description.py
  37. +312 −2 noisicaa/builtin_nodes/custom_csound/node_ui.py
  38. +249 −0 noisicaa/builtin_nodes/custom_csound/node_ui_test.py
  39. +21 −82 noisicaa/builtin_nodes/custom_csound/processor.cpp
  40. +2 −1 noisicaa/builtin_nodes/custom_csound/processor.h
  41. +36 −0 noisicaa/builtin_nodes/custom_csound/processor.proto
  42. +0 −32 noisicaa/builtin_nodes/custom_csound/processor_messages.py
  43. +63 −45 noisicaa/builtin_nodes/custom_csound/processor_test.py
  44. +100 −29 noisicaa/builtin_nodes/custom_csound/server_impl.py
  45. +0 −39 noisicaa/builtin_nodes/custom_csound/server_impl_test.py
  46. +6 −3 noisicaa/builtin_nodes/instrument/processor.cpp
  47. +1 −0 noisicaa/builtin_nodes/model_registry.proto
  48. +0 −4 noisicaa/builtin_nodes/processor_message_registry.proto
  49. +4 −0 noisicaa/builtin_nodes/server_registry.py
  50. +0 −1 noisicaa/core/callbacks.py
  51. +1 −0 noisicaa/model/__init__.py
  52. +9 −1 noisicaa/model/project.proto
  53. +60 −11 noisicaa/model/project.py
  54. +2 −0 noisicaa/music/__init__.py
  55. +12 −0 noisicaa/music/commands.proto
  56. +67 −0 noisicaa/music/graph.py
  57. +2 −0 noisicaa/music/mutations.proto
  58. +5 −0 noisicaa/music/mutations.py
  59. +42 −1 noisicaa/music/pmodel.py
  60. +1 −0 noisicaa/music/project.py
  61. +21 −1 noisicaa/music/project_client.py
  62. +4 −0 noisicaa/music/project_client_model.py
  63. +1 −1 noisicaa/node_db/node_description.proto
  64. +1 −1 noisicaa/node_db/private/csound_scanner.py
  65. +1 −0 noisicaa/ui/CMakeLists.txt
  66. +20 −14 noisicaa/ui/control_value_dial.py
  67. +0 −2 noisicaa/ui/graph/__init__.py
  68. +41 −8 noisicaa/ui/graph/base_node.py
  69. +24 −10 noisicaa/ui/graph/generic_node.py
  70. +317 −0 noisicaa/ui/object_list_editor.py
  71. +2 −2 noisicaa/ui/project_view.py
  72. +1 −1 noisicaa/ui/track_list/toolbox.py
  73. +13 −11 noisicaa/ui/ui_base.py
  74. +11 −3 noisidev/uitest.py
@@ -29,7 +29,7 @@
import time
import zipfile

VERSION = '3.0.2'
VERSION = '3.7.1'
FILENAME = 'v%s.zip' % VERSION
DOWNLOAD_URL = 'https://github.com/google/protobuf/archive/%s' % FILENAME

@@ -444,6 +444,7 @@ class QAbstractButton(QWidget):


class QAbstractItemDelegate(QtCore.QObject):
commitData = ... # type: PYQT_SIGNAL

class EndEditHint(int): ...
NoHint = ... # type: 'QAbstractItemDelegate.EndEditHint'
@@ -456,7 +457,7 @@ class QAbstractItemDelegate(QtCore.QObject):

def sizeHintChanged(self, a0: QtCore.QModelIndex) -> None: ...
def closeEditor(self, editor: QWidget, hint: 'QAbstractItemDelegate.EndEditHint' = ...) -> None: ...
def commitData(self, editor: QWidget) -> None: ...
#def commitData(self, editor: QWidget) -> None: ...
def helpEvent(self, event: QtGui.QHelpEvent, view: 'QAbstractItemView', option: 'QStyleOptionViewItem', index: QtCore.QModelIndex) -> bool: ...
def editorEvent(self, event: QtCore.QEvent, model: QtCore.QAbstractItemModel, option: 'QStyleOptionViewItem', index: QtCore.QModelIndex) -> bool: ...
def destroyEditor(self, editor: QWidget, index: QtCore.QModelIndex) -> None: ...
@@ -1581,6 +1582,7 @@ class QColumnView(QAbstractItemView):

class QComboBox(QWidget):
currentIndexChanged = ... # type: PYQT_SIGNAL
activated = ... # type: PYQT_SIGNAL

class SizeAdjustPolicy(int): ...
AdjustToContents = ... # type: 'QComboBox.SizeAdjustPolicy'
@@ -1624,10 +1626,10 @@ class QComboBox(QWidget):
@typing.overload
def highlighted(self, a0: str) -> None: ...
def currentTextChanged(self, a0: str) -> None: ...
@typing.overload
def activated(self, index: int) -> None: ...
@typing.overload
def activated(self, a0: str) -> None: ...
# @typing.overload
# def activated(self, index: int) -> None: ...
# @typing.overload
# def activated(self, a0: str) -> None: ...
def editTextChanged(self, a0: str) -> None: ...
def setCurrentText(self, text: str) -> None: ...
def setEditText(self, text: str) -> None: ...
@@ -41,7 +41,7 @@ pkg_check_modules(LIBSNDFILE REQUIRED sndfile)
pkg_check_modules(LIBFLUIDSYNTH REQUIRED fluidsynth>=1.1.6)
pkg_check_modules(LIBAVUTIL REQUIRED libavutil)
pkg_check_modules(LIBSWRESAMPLE REQUIRED libswresample)
pkg_check_modules(LIBPROTOBUF REQUIRED protobuf>=3.0)
pkg_check_modules(LIBPROTOBUF REQUIRED protobuf>=3.7)
pkg_check_modules(LIBPORTAUDIO REQUIRED portaudio-2.0>=19)
pkg_check_modules(LIBUNWIND REQUIRED libunwind-generic>=1.1)

@@ -105,7 +105,7 @@ macro(py_proto src)
string(REGEX REPLACE "\\.proto$" "" base ${src})
add_custom_command(
OUTPUT ${base}_pb2.py
COMMAND LD_LIBRARY_PATH=$ENV{VIRTUAL_ENV}/lib protoc --python_out=${CMAKE_BINARY_DIR} --mypy_out=${CMAKE_BINARY_DIR} --proto_path=${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR}/${src}
COMMAND LD_LIBRARY_PATH=$ENV{VIRTUAL_ENV}/lib $ENV{VIRTUAL_ENV}/bin/protoc --python_out=${CMAKE_BINARY_DIR} --mypy_out=${CMAKE_BINARY_DIR} --proto_path=${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR}/${src}
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${src}
)
file(RELATIVE_PATH pkg_path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR})
@@ -117,7 +117,7 @@ macro(cpp_proto src)
string(REGEX REPLACE "\\.proto$" "" base ${src})
add_custom_command(
OUTPUT ${base}.pb.cc ${base}.pb.h
COMMAND LD_LIBRARY_PATH=$ENV{VIRTUAL_ENV}/lib protoc --cpp_out=${CMAKE_BINARY_DIR} --proto_path=${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR}/${src}
COMMAND LD_LIBRARY_PATH=$ENV{VIRTUAL_ENV}/lib $ENV{VIRTUAL_ENV}/bin/protoc --cpp_out=${CMAKE_BINARY_DIR} --proto_path=${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR}/${src}
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${src}
)
endmacro(cpp_proto)
@@ -57,15 +57,15 @@ PIP_DEPS = {
PKG('numpy'),
PKG('portalocker'),
PKG('posix_ipc'),
PKG('protobuf'),
PKG('protobuf==3.7.1'),
PKG('psutil'),
PKG('pyaudio'),
PKG('quamash'),
PKG('toposort'),
PKG('urwid'),
],
'build': [
PKG('./3rdparty/protoc/', 'ubuntu', '<17.10'),
PKG('./3rdparty/protoc/'),
PKG('cssutils'),
PKG('cython'),
PKG('pkgconfig'),
@@ -138,15 +138,13 @@ SYS_DEPS = {
PKG('libcsound64-dev', 'ubuntu', '>=17.10'),

# protocol buffers
PKG('autoconf', 'ubuntu', '<17.10'),
PKG('automake', 'ubuntu', '<17.10'),
PKG('libtool', 'ubuntu', '<17.10'),
PKG('curl', 'ubuntu', '<17.10'),
PKG('make', 'ubuntu', '<17.10'),
PKG('g++', 'ubuntu', '<17.10'),
PKG('unzip', 'ubuntu', '<17.10'),
PKG('libprotobuf-dev', 'ubuntu', '>=17.10'),
PKG('protobuf-compiler', 'ubuntu', '>=17.10'),
PKG('autoconf'),
PKG('automake'),
PKG('libtool'),
PKG('curl'),
PKG('make'),
PKG('g++'),
PKG('unzip'),

# libswresample
PKG('libswresample-dev'),
@@ -29,6 +29,8 @@
SetControlValue,
SetPluginState,
SetNodePortProperties,
SetNodeDescription,
SetNodeParameters,
)
from .audioproc_client import (
AbstractAudioProcClient,
@@ -57,4 +59,5 @@
BackendSettings,
HostParameters,
NodePortProperties,
NodeParameters,
)
@@ -27,6 +27,7 @@ import "noisicaa/node_db/node_description.proto";
import "noisicaa/audioproc/public/backend_settings.proto";
import "noisicaa/audioproc/public/control_value.proto";
import "noisicaa/audioproc/public/host_parameters.proto";
import "noisicaa/audioproc/public/node_parameters.proto";
import "noisicaa/audioproc/public/node_port_properties.proto";
import "noisicaa/audioproc/public/player_state.proto";
import "noisicaa/audioproc/public/plugin_state.proto";
@@ -77,6 +78,16 @@ message SetNodePortProperties {
required noisicaa.pb.NodePortProperties port_properties = 2;
}

message SetNodeDescription {
required string node_id = 1;
required noisicaa.pb.NodeDescription description = 2;
}

message SetNodeParameters {
required string node_id = 1;
required noisicaa.pb.NodeParameters parameters = 2;
}

message Mutation {
oneof type {
AddNode add_node = 1;
@@ -86,6 +97,8 @@ message Mutation {
SetControlValue set_control_value = 5;
SetPluginState set_plugin_state = 6;
SetNodePortProperties set_node_port_properties = 7;
SetNodeDescription set_node_description = 8;
SetNodeParameters set_node_parameters = 9;
}
}

@@ -270,6 +270,8 @@ def __handle_engine_notification(self, msg: engine_notification_pb2.EngineNotifi
request: audioproc_pb2.PipelineMutationRequest,
response: empty_message_pb2.EmptyMessage
) -> None:
logging.info("Pipeline mutation:\n%s", request)

realm = self.__engine.get_realm(request.realm)
graph = realm.graph

@@ -350,6 +352,17 @@ def __handle_engine_notification(self, msg: engine_notification_pb2.EngineNotifi
node.set_port_properties(set_node_port_properties.port_properties)
realm.update_spec()

elif mutation_type == 'set_node_description':
set_node_description = request.mutation.set_node_description
node = graph.find_node(set_node_description.node_id)
if await node.set_description(set_node_description.description):
realm.update_spec()

elif mutation_type == 'set_node_parameters':
set_node_parameters = request.mutation.set_node_parameters
node = graph.find_node(set_node_parameters.node_id)
node.set_parameters(set_node_parameters.parameters)

else:
raise ValueError(request.mutation)

@@ -72,11 +72,11 @@ set(LIB_SRCS
plugin_ui_host.cpp
plugin_ui_host_lv2.cpp
processor.cpp
processor.pb.cc
processor_null.cpp
processor_csound_base.cpp
processor_csound.cpp
processor_plugin.cpp
processor_plugin.pb.cc
processor_sound_file.cpp
profile.cpp
realtime.cpp
@@ -94,8 +94,8 @@ set(TEST_SRCS
py_proto(plugin_host.proto)
cpp_proto(plugin_host.proto)

py_proto(processor.proto)
cpp_proto(processor.proto)
py_proto(processor_plugin.proto)
cpp_proto(processor_plugin.proto)

add_library(noisicaa-audioproc-engine SHARED ${LIB_SRCS})
target_compile_options(noisicaa-audioproc-engine PRIVATE -fPIC -std=c++11 -Wall -Werror -pedantic -DHAVE_PTHREAD_SPIN_LOCK)
@@ -22,6 +22,7 @@

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "noisicaa/core/logging.h"
#include "noisicaa/core/perf_stats.h"
@@ -188,8 +189,16 @@ Status CSoundUtil::process_block(
return ERROR_STATUS(
"Excepted sequence in port '%s', got %d.", port.name.c_str(), seq->atom.type);
}

LV2_Atom_Event* event = lv2_atom_sequence_begin(&seq->body);
int instr = 1; // TODO: use port.csound_instr

char *e = nullptr;
int instr = strtol(port.csound_name.c_str(), &e, 10);
if (e == port.csound_name.c_str()) {
_logger->error("Invalid instrument name '%s'", port.csound_name.c_str());
instr = 1;
}

_event_input_ports[port_idx] = {seq, event, instr};
}
}
@@ -250,7 +259,7 @@ Status CSoundUtil::process_block(
RTUnsafe rtu; // csound might do RT unsafe stuff internally.
int rc = csoundScoreEvent(_csnd, 'i', p, 5);
if (rc < 0) {
return ERROR_STATUS("csoundScoreEvent failed (code %d).", rc);
_logger->warning("csoundScoreEvent failed (code %d).", rc);
}
} else if ((midi[0] & 0xf0) == 0x80) {
MYFLT p[3] = {
@@ -262,7 +271,7 @@ Status CSoundUtil::process_block(
RTUnsafe rtu; // csound might do RT unsafe stuff internally.
int rc = csoundScoreEvent(_csnd, 'i', p, 3);
if (rc < 0) {
return ERROR_STATUS("csoundScoreEvent failed (code %d).", rc);
_logger->warning("csoundScoreEvent failed (code %d).", rc);
}
} else {
_logger->warning("Ignoring unsupported midi event %d.", midi[0] & 0xf0);
@@ -55,6 +55,7 @@ class CSoundUtil {
string name;
pb::PortDescription::Type type;
pb::PortDescription::Direction direction;
string csound_name;
};

Status setup(const string& orchestra, const string& score, const vector<PortSpec>& ports);

0 comments on commit c3e5c3a

Please sign in to comment.
You can’t perform that action at this time.