[Summary] Very seldom crash. Cleared temp data gave almost stable work
Conflicts: libs/backends/wavesaudio/waves_midi_device.cc
This commit is contained in:
parent
23214f6e61
commit
22d68d14ce
@ -75,48 +75,86 @@ WavesMidiDevice::validate ()
|
||||
int
|
||||
WavesMidiDevice::open (PmTimeProcPtr time_proc, void* time_info)
|
||||
{
|
||||
// COMMENTED DBG LOGS */ std::cout << "WavesMidiDevice::open ():" << name () << std::endl;
|
||||
|
||||
if (is_input () && !_input_pm_stream) {
|
||||
if (pmNoError != Pm_OpenInput (&_input_pm_stream,
|
||||
_pm_input_id,
|
||||
NULL,
|
||||
1024,
|
||||
time_proc,
|
||||
time_info)) {
|
||||
std::cerr << "WavesMidiDevice::open (): Pm_OpenInput () failed for " << _pm_input_id << "-[" << name () << "]!" << std::endl;
|
||||
_input_pm_stream = NULL;
|
||||
_pm_input_id = pmNoDevice;
|
||||
return -1;
|
||||
DEBUG_TRACE (DEBUG::WavesMIDI, string_compose ("WavesMidiDevice::open (): %1", name ()));
|
||||
|
||||
if (is_input () ) {
|
||||
std::cout << "WavesMidiDevice::open (): INPUT" << _pm_input_id << "-[" << name () << "]!" << std::endl;
|
||||
if (!_input_queue) {
|
||||
_input_queue = Pm_QueueCreate (QUEUE_LENGTH, sizeof (const WavesMidiEvent*));
|
||||
if (NULL == _input_queue) {
|
||||
std::cerr << "WavesMidiDevice::open (): _input_queue = Pm_QueueCreate () failed for " << _pm_input_id << "-[" << name () << "]!" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_input_pm_stream) {
|
||||
if (pmNoError != Pm_OpenInput (&_input_pm_stream,
|
||||
_pm_input_id,
|
||||
NULL,
|
||||
1024,
|
||||
time_proc,
|
||||
time_info)) {
|
||||
char* err_msg = new char[256];
|
||||
Pm_GetHostErrorText(err_msg, 256);
|
||||
std::cerr << "WavesMidiDevice::open (): Pm_OpenInput () failed for " << _pm_input_id << "-[" << name () << "]!" << std::endl;
|
||||
std::cerr << "Error: " << err_msg << std::endl;
|
||||
_input_pm_stream = NULL;
|
||||
_pm_input_id = pmNoDevice;
|
||||
close ();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
_input_queue = Pm_QueueCreate (QUEUE_LENGTH, sizeof (const WavesMidiEvent*));
|
||||
if (NULL == _input_queue) {
|
||||
std::cerr << "WavesMidiDevice::open (): _input_queue = Pm_QueueCreate () failed for " << _pm_input_id << "-[" << name () << "]!" << std::endl;
|
||||
close ();
|
||||
return -1;
|
||||
|
||||
if (is_output () ) {
|
||||
std::cout << "WavesMidiDevice::open (): OUTPUT" << _pm_output_id << "-[" << name () << "]!" << std::endl;
|
||||
if (_output_queue) {
|
||||
_output_queue = Pm_QueueCreate (QUEUE_LENGTH, sizeof (const WavesMidiEvent*));
|
||||
if (NULL == _output_queue) {
|
||||
std::cerr << "WavesMidiDevice::open (): _output_queue = Pm_QueueCreate () failed for " << _pm_output_id << "-[" << name () << "]!" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_output_pm_stream) {
|
||||
if (pmNoError != Pm_OpenOutput (&_output_pm_stream,
|
||||
_pm_output_id,
|
||||
NULL,
|
||||
1024,
|
||||
time_proc,
|
||||
time_info,
|
||||
LATENCY)) {
|
||||
char* err_msg = new char[256];
|
||||
Pm_GetHostErrorText(err_msg, 256);
|
||||
std::cerr << "WavesMidiDevice::open (): Pm_OpenOutput () failed for " << _pm_output_id << "-[" << name () << "]!" << std::endl;
|
||||
std::cerr << "Error: " << err_msg << std::endl;
|
||||
_output_pm_stream = NULL;
|
||||
_pm_output_id = pmNoDevice;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_output () && !_output_pm_stream) {
|
||||
if (pmNoError != Pm_OpenOutput (&_output_pm_stream,
|
||||
_pm_output_id,
|
||||
NULL,
|
||||
1024,
|
||||
time_proc,
|
||||
time_info,
|
||||
LATENCY)) {
|
||||
std::cerr << "WavesMidiDevice::open (): Pm_OpenOutput () failed for " << _pm_output_id << "-[" << name () << "]!" << std::endl;
|
||||
_output_pm_stream = NULL;
|
||||
_pm_output_id = pmNoDevice;
|
||||
return -1;
|
||||
if (is_output () && !_output_pm_stream) {
|
||||
if (pmNoError != Pm_OpenOutput (&_output_pm_stream,
|
||||
_pm_output_id,
|
||||
NULL,
|
||||
1024,
|
||||
time_proc,
|
||||
time_info,
|
||||
LATENCY)) {
|
||||
std::cerr << "WavesMidiDevice::open (): Pm_OpenOutput () failed for " << _pm_output_id << "-[" << name () << "]!" << std::endl;
|
||||
_output_pm_stream = NULL;
|
||||
_pm_output_id = pmNoDevice;
|
||||
return -1;
|
||||
}
|
||||
_output_queue = Pm_QueueCreate (QUEUE_LENGTH, sizeof (const WavesMidiEvent*));
|
||||
if (NULL == _output_queue) {
|
||||
std::cerr << "WavesMidiDevice::open (): _output_queue = Pm_QueueCreate () failed for " << _pm_output_id << "-[" << name () << "]!" << std::endl;
|
||||
close ();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
_output_queue = Pm_QueueCreate (QUEUE_LENGTH, sizeof (const WavesMidiEvent*));
|
||||
if (NULL == _output_queue) {
|
||||
std::cerr << "WavesMidiDevice::open (): _output_queue = Pm_QueueCreate () failed for " << _pm_output_id << "-[" << name () << "]!" << std::endl;
|
||||
close ();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -127,6 +165,7 @@ WavesMidiDevice::close ()
|
||||
DEBUG_TRACE (DEBUG::WavesMIDI, string_compose ("WavesMidiDevice::close (): %1\n", name ()));
|
||||
WavesMidiEvent *waves_midi_event;
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (_input_pm_stream) {
|
||||
PmError err = Pm_Close (_input_pm_stream);
|
||||
|
||||
@ -139,6 +178,9 @@ WavesMidiDevice::close ()
|
||||
Pm_Abort (_input_pm_stream);
|
||||
}
|
||||
|
||||
=======
|
||||
if (_input_queue) {
|
||||
>>>>>>> b7d650c... [Summary] Very seldom crash. Cleared temp data gave almost stable work
|
||||
while (1 == Pm_Dequeue (_input_queue, &waves_midi_event)) {
|
||||
delete waves_midi_event; // XXX possible dup free in ~WavesMidiBuffer() (?)
|
||||
}
|
||||
@ -148,11 +190,11 @@ WavesMidiDevice::close ()
|
||||
_input_pm_stream = NULL;
|
||||
_pm_input_id = pmNoDevice;
|
||||
}
|
||||
|
||||
|
||||
if ( _output_pm_stream ) {
|
||||
PmError err = Pm_Close (_output_pm_stream);
|
||||
|
||||
if (_input_pm_stream) {
|
||||
PmError err = Pm_Close (_input_pm_stream);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (err != pmNoError) {
|
||||
std::cerr << "WavesMidiDevice::close (): Pm_Close () failed for " << _pm_output_id << "-[" << name () << "]!" << std::endl;
|
||||
char* err_msg = new char[256];
|
||||
@ -162,6 +204,15 @@ WavesMidiDevice::close ()
|
||||
Pm_Abort (_output_pm_stream);
|
||||
}
|
||||
|
||||
=======
|
||||
if (err != pmNoError) {
|
||||
std::cerr << "WavesMidiDevice::close (): Pm_Close () failed for " << _pm_input_id << "-[" << name () << "]!" << std::endl;
|
||||
std::cerr << "Error: " << err << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (_output_queue) {
|
||||
>>>>>>> b7d650c... [Summary] Very seldom crash. Cleared temp data gave almost stable work
|
||||
while (1 == Pm_Dequeue (_output_queue, &waves_midi_event)) {
|
||||
delete waves_midi_event; // XXX possible dup free in ~WavesMidiBuffer() (?)
|
||||
}
|
||||
@ -171,6 +222,15 @@ WavesMidiDevice::close ()
|
||||
_output_pm_stream = NULL;
|
||||
_pm_output_id = pmNoDevice;
|
||||
}
|
||||
|
||||
if ( _output_pm_stream ) {
|
||||
PmError err = Pm_Close (_output_pm_stream);
|
||||
|
||||
if (err != pmNoError) {
|
||||
std::cerr << "WavesMidiDevice::close (): Pm_Close () failed for " << _pm_output_id << "-[" << name () << "]!" << std::endl;
|
||||
std::cerr << "Error: " << err << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user