13
0

NOOP, reindent & whitespace

This commit is contained in:
Robin Gareus 2015-07-01 01:18:52 +02:00
parent b86cf68e1f
commit da0ca57539
2 changed files with 46 additions and 46 deletions

View File

@ -1586,8 +1586,8 @@ CoreAudioBackend::midi_process_byte (const uint8_t byte)
midi_record_byte (byte); midi_record_byte (byte);
return midi_prepare_buffered_event (); return midi_prepare_buffered_event ();
} }
_total_bytes = 0; _total_bytes = 0;
_unbuffered_bytes = 0; _unbuffered_bytes = 0;
_expected_bytes = 0; _expected_bytes = 0;
_status_byte = 0; _status_byte = 0;
return false; return false;
@ -1636,13 +1636,13 @@ CoreAudioBackend::midi_process_byte (const uint8_t byte)
return false; return false;
case 0xf6: case 0xf6:
// Tune Request // Tune Request
midi_prepare_byte_event(byte); midi_prepare_byte_event (byte);
_expected_bytes = 0; _expected_bytes = 0;
_status_byte = 0; _status_byte = 0;
return true; return true;
} }
} }
midi_record_byte(byte); midi_record_byte (byte);
return false; return false;
} }
// Data byte // Data byte
@ -1653,7 +1653,7 @@ CoreAudioBackend::midi_process_byte (const uint8_t byte)
return false; return false;
} }
if (! _total_bytes) { if (! _total_bytes) {
midi_record_byte(_status_byte); midi_record_byte (_status_byte);
} }
midi_record_byte(byte); midi_record_byte(byte);
return (_total_bytes == _expected_bytes) ? midi_prepare_buffered_event() : false; return (_total_bytes == _expected_bytes) ? midi_prepare_buffered_event() : false;

View File

@ -449,55 +449,55 @@ class CoreAudioBackend : public AudioBackend {
#ifdef USE_MIDI_PARSER #ifdef USE_MIDI_PARSER
bool midi_process_byte (const uint8_t); bool midi_process_byte (const uint8_t);
void midi_record_byte(uint8_t byte) { void midi_record_byte (uint8_t byte) {
if (_total_bytes < sizeof(_parser_buffer)) { if (_total_bytes < sizeof (_parser_buffer)) {
_parser_buffer[_total_bytes] = byte; _parser_buffer[_total_bytes] = byte;
} else { } else {
++_unbuffered_bytes; ++_unbuffered_bytes;
}
++_total_bytes;
} }
++_total_bytes;
}
void midi_prepare_byte_event(const uint8_t byte) { void midi_prepare_byte_event (const uint8_t byte) {
_parser_buffer[0] = byte; _parser_buffer[0] = byte;
_event.prepare(1); _event.prepare(1);
}
bool midi_prepare_buffered_event() {
const bool result = _unbuffered_bytes == 0;
if (result) {
_event.prepare(_total_bytes);
} }
_total_bytes = 0;
_unbuffered_bytes = 0; bool midi_prepare_buffered_event () {
if (_status_byte >= 0xf0) { const bool result = _unbuffered_bytes == 0;
_expected_bytes = 0; if (result) {
_status_byte = 0; _event.prepare (_total_bytes);
}
_total_bytes = 0;
_unbuffered_bytes = 0;
if (_status_byte >= 0xf0) {
_expected_bytes = 0;
_status_byte = 0;
}
return result;
} }
return result;
}
struct ParserEvent { struct ParserEvent {
size_t _size; size_t _size;
bool _pending; bool _pending;
ParserEvent (const size_t size) ParserEvent (const size_t size)
: _size(size) : _size(size)
, _pending(false) {} , _pending(false) {}
void prepare(const size_t size) { void prepare (const size_t size) {
_size = size; _size = size;
_pending = true; _pending = true;
} }
} _event; } _event;
bool _first_time; bool _first_time;
size_t _unbuffered_bytes; size_t _unbuffered_bytes;
size_t _total_bytes; size_t _total_bytes;
size_t _expected_bytes; size_t _expected_bytes;
uint8_t _status_byte; uint8_t _status_byte;
uint8_t _parser_buffer[1024]; uint8_t _parser_buffer[1024];
#endif #endif
}; // class CoreAudioBackend }; // class CoreAudioBackend