summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-05-03 23:06:21 +0200
committerRobin Gareus <robin@gareus.org>2015-05-03 23:06:21 +0200
commit2e4428bc979b29eaa640144d992b41d6cb4495fb (patch)
tree48c15b94870df3e3ba3d02981f3a16ca37293853 /libs/ardour
parent56cc3e24071f504c7dcc2f6fd7bf98468c30c7ac (diff)
add an API to silence buffers (without session)
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/port_manager.h1
-rw-r--r--libs/ardour/port_manager.cc39
2 files changed, 40 insertions, 0 deletions
diff --git a/libs/ardour/ardour/port_manager.h b/libs/ardour/ardour/port_manager.h
index 6ced0e7dd1..8c55b69022 100644
--- a/libs/ardour/ardour/port_manager.h
+++ b/libs/ardour/ardour/port_manager.h
@@ -149,6 +149,7 @@ class LIBARDOUR_API PortManager
void fade_out (gain_t, gain_t, pframes_t);
void silence (pframes_t nframes);
+ void silence_physical (pframes_t nframes);
void check_monitoring ();
/** Signal the start of an audio cycle.
* This MUST be called before any reading/writing for this cycle.
diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc
index de78dfd319..37970cc708 100644
--- a/libs/ardour/port_manager.cc
+++ b/libs/ardour/port_manager.cc
@@ -639,6 +639,45 @@ PortManager::silence (pframes_t nframes)
}
void
+PortManager::silence_physical (pframes_t nframes)
+{
+ std::vector<std::string> port_names;
+ if (get_ports("", DataType::AUDIO, IsInput, port_names)) {
+ for (std::vector<std::string>::iterator p = port_names.begin(); p != port_names.end(); ++p) {
+ if (!port_is_mine(*p)) {
+ continue;
+ }
+ PortEngine::PortHandle ph = _backend->get_port_by_name (*p);
+ if (!ph) {
+ continue;
+ }
+ void *buf = _backend->get_buffer(ph, nframes);
+ if (!buf) {
+ continue;
+ }
+ memset (buf, 0, sizeof(float) * nframes);
+ }
+ }
+
+ if (get_ports("", DataType::MIDI, IsInput, port_names)) {
+ for (std::vector<std::string>::iterator p = port_names.begin(); p != port_names.end(); ++p) {
+ if (!port_is_mine(*p)) {
+ continue;
+ }
+ PortEngine::PortHandle ph = _backend->get_port_by_name (*p);
+ if (!ph) {
+ continue;
+ }
+ void *buf = _backend->get_buffer(ph, nframes);
+ if (!buf) {
+ continue;
+ }
+ _backend->midi_clear (buf);
+ }
+ }
+}
+
+void
PortManager::check_monitoring ()
{
for (Ports::iterator i = _cycle_ports->begin(); i != _cycle_ports->end(); ++i) {