mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
Extract freewheel processing in PortAudioBackend into new method
This commit is contained in:
parent
cf81caa798
commit
f27d8e1e23
2 changed files with 36 additions and 20 deletions
|
|
@ -1574,29 +1574,10 @@ PortAudioBackend::main_blocking_process_thread ()
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Freewheelin'
|
|
||||||
|
|
||||||
// zero audio input buffers
|
if (!blocking_process_freewheel()) {
|
||||||
for (std::vector<PamPort*>::const_iterator it = _system_inputs.begin (); it != _system_inputs.end (); ++it) {
|
|
||||||
memset ((*it)->get_buffer (_samples_per_period), 0, _samples_per_period * sizeof (Sample));
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO clear midi or stop midi recv when entering fwheelin'
|
|
||||||
|
|
||||||
if (engine.process_callback (_samples_per_period)) {
|
|
||||||
_pcmio->close_stream();
|
|
||||||
_active = false;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop all outgoing MIDI messages
|
|
||||||
for (std::vector<PamPort*>::const_iterator it = _system_midi_out.begin (); it != _system_midi_out.end (); ++it) {
|
|
||||||
void *bptr = (*it)->get_buffer(0);
|
|
||||||
midi_clear(bptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
_dsp_load = 1.0;
|
|
||||||
Glib::usleep (100); // don't hog cpu
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process_port_connection_changes();
|
process_port_connection_changes();
|
||||||
|
|
@ -1614,6 +1595,39 @@ PortAudioBackend::main_blocking_process_thread ()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PortAudioBackend::blocking_process_freewheel ()
|
||||||
|
{
|
||||||
|
// zero audio input buffers
|
||||||
|
for (std::vector<PamPort*>::const_iterator it = _system_inputs.begin();
|
||||||
|
it != _system_inputs.end();
|
||||||
|
++it) {
|
||||||
|
memset((*it)->get_buffer(_samples_per_period),
|
||||||
|
0,
|
||||||
|
_samples_per_period * sizeof(Sample));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO clear midi or stop midi recv when entering fwheelin'
|
||||||
|
|
||||||
|
if (engine.process_callback(_samples_per_period)) {
|
||||||
|
_pcmio->close_stream();
|
||||||
|
_active = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// drop all outgoing MIDI messages
|
||||||
|
for (std::vector<PamPort*>::const_iterator it = _system_midi_out.begin();
|
||||||
|
it != _system_midi_out.end();
|
||||||
|
++it) {
|
||||||
|
void* bptr = (*it)->get_buffer(0);
|
||||||
|
midi_clear(bptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
_dsp_load = 1.0;
|
||||||
|
Glib::usleep(100); // don't hog cpu
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PortAudioBackend::process_port_connection_changes ()
|
PortAudioBackend::process_port_connection_changes ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -322,9 +322,11 @@ class PortAudioBackend : public AudioBackend {
|
||||||
private: // Methods
|
private: // Methods
|
||||||
bool start_blocking_process_thread ();
|
bool start_blocking_process_thread ();
|
||||||
bool stop_blocking_process_thread ();
|
bool stop_blocking_process_thread ();
|
||||||
|
bool blocking_process_freewheel ();
|
||||||
|
|
||||||
void process_port_connection_changes ();
|
void process_port_connection_changes ();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _instance_name;
|
std::string _instance_name;
|
||||||
PortAudioIO *_pcmio;
|
PortAudioIO *_pcmio;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue