add an API to silence buffers (without session)
This commit is contained in:
parent
56cc3e2407
commit
2e4428bc97
|
@ -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.
|
||||
|
|
|
@ -638,6 +638,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 ()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user