summaryrefslogtreecommitdiff
path: root/libs/ardour/port_manager.cc
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/port_manager.cc
parent56cc3e24071f504c7dcc2f6fd7bf98468c30c7ac (diff)
add an API to silence buffers (without session)
Diffstat (limited to 'libs/ardour/port_manager.cc')
-rw-r--r--libs/ardour/port_manager.cc39
1 files changed, 39 insertions, 0 deletions
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) {