mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
[Summary] Audio Backend code cleanup - PORTION B
Conflicts: libs/backends/wavesaudio/waves_midi_device.cc
This commit is contained in:
parent
91f5eb9fef
commit
83001e7e52
6 changed files with 29 additions and 51 deletions
|
|
@ -785,8 +785,6 @@ WavesAudioBackend::stop ()
|
|||
|
||||
// COMMENTED DBG LOGS */ std::cout << "\t[" << _device->DeviceName () << "]" << std::endl;
|
||||
|
||||
_midi_device_manager.stop ();
|
||||
|
||||
if (_device) {
|
||||
wtErr = _device->SetStreaming (false);
|
||||
if (wtErr != eNoErr) {
|
||||
|
|
@ -795,6 +793,7 @@ WavesAudioBackend::stop ()
|
|||
}
|
||||
}
|
||||
|
||||
_midi_device_manager.stop ();
|
||||
_unregister_system_audio_ports ();
|
||||
_unregister_system_midi_ports ();
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ WavesAudioBackend::_changed_midi_devices ()
|
|||
return;
|
||||
}
|
||||
|
||||
_unregister_system_midi_ports ();
|
||||
_midi_device_manager.stop ();
|
||||
|
||||
if (_midi_device_manager.start () != 0) {
|
||||
|
|
@ -317,8 +318,7 @@ WavesAudioBackend::_read_midi_data_from_devices ()
|
|||
|
||||
if (timestamp_st < 0) {
|
||||
timestamp_st = 0;
|
||||
}
|
||||
else if (timestamp_st >= (int32_t)_buffer_size) {
|
||||
} else if (timestamp_st >= (int32_t)_buffer_size) {
|
||||
timestamp_st = _buffer_size - 1;
|
||||
}
|
||||
waves_midi_event->set_timestamp (timestamp_st);
|
||||
|
|
|
|||
|
|
@ -38,20 +38,7 @@ WavesMidiDevice::WavesMidiDevice (const std::string& device_name)
|
|||
, _output_pm_stream (NULL)
|
||||
, _incomplete_waves_midi_event (NULL)
|
||||
{
|
||||
validate ();
|
||||
}
|
||||
|
||||
WavesMidiDevice::~WavesMidiDevice ()
|
||||
{
|
||||
// COMMENTED DBG LOGS */ std::cout << "WavesMidiDevice::~WavesMidiDevice ():" << name () << std::endl;
|
||||
close ();
|
||||
}
|
||||
|
||||
void
|
||||
WavesMidiDevice::validate ()
|
||||
{
|
||||
_pm_input_id =
|
||||
_pm_output_id = pmNoDevice;
|
||||
_pm_input_id = _pm_output_id = pmNoDevice;
|
||||
int count = Pm_CountDevices ();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
|
@ -72,6 +59,12 @@ WavesMidiDevice::validate ()
|
|||
}
|
||||
}
|
||||
|
||||
WavesMidiDevice::~WavesMidiDevice ()
|
||||
{
|
||||
// COMMENTED DBG LOGS */ std::cout << "WavesMidiDevice::~WavesMidiDevice ():" << name () << std::endl;
|
||||
close ();
|
||||
}
|
||||
|
||||
int
|
||||
WavesMidiDevice::open (PmTimeProcPtr time_proc, void* time_info)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ public:
|
|||
|
||||
inline bool is_input () const { return _pm_input_id != pmNoDevice; };
|
||||
inline bool is_output () const { return _pm_output_id != pmNoDevice; };
|
||||
void validate ();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -110,12 +110,13 @@ WavesMidiDeviceManager::stop ()
|
|||
{
|
||||
// COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::stop ():" << std::endl;
|
||||
|
||||
if ( _active == false )
|
||||
if ( _active == false ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
stream (false);
|
||||
|
||||
_close_devices ();
|
||||
_delete_devices ();
|
||||
_active = false;
|
||||
|
||||
if (Pm_Terminate () != pmNoError) {
|
||||
|
|
@ -201,11 +202,7 @@ WavesMidiDeviceManager::_create_devices ()
|
|||
}
|
||||
|
||||
WavesMidiDevice *device = _get_device (pm_device_info->name);
|
||||
if (device) {
|
||||
device->validate ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!device) {
|
||||
device = new WavesMidiDevice (pm_device_info->name);
|
||||
_devices.push_back (device);
|
||||
if (device->open (__get_time_ms, (void*)&_audiobackend)) {
|
||||
|
|
@ -225,17 +222,9 @@ WavesMidiDeviceManager::_delete_devices ()
|
|||
while (!_devices.empty ()) {
|
||||
WavesMidiDevice * device = _devices.back ();
|
||||
_devices.pop_back ();
|
||||
device->close ();
|
||||
delete device;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WavesMidiDeviceManager::_close_devices ()
|
||||
{
|
||||
// COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::_close_devices ():" << std::endl;
|
||||
for (size_t i = 0; i < _devices.size (); i++) {
|
||||
_devices[i]->close ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ public:
|
|||
private:
|
||||
|
||||
int _create_devices ();
|
||||
void _close_devices ();
|
||||
|
||||
int _delete_devices ();
|
||||
static void __portmidi_callback (PtTimestamp timestamp, void * userData);
|
||||
void _portmidi_callback (PtTimestamp timestamp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue