| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/midi/midi_message_queue.h" | 5 #include "media/midi/midi_message_queue.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "media/midi/midi_message_util.h" | 10 #include "media/midi/midi_message_util.h" |
| 11 | 11 |
| 12 namespace media { | 12 namespace media { |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 const uint8 kSysEx = 0xf0; | 15 const uint8 kSysEx = 0xf0; |
| 16 const uint8 kEndOfSysEx = 0xf7; | 16 const uint8 kEndOfSysEx = 0xf7; |
| 17 | 17 |
| 18 bool IsDataByte(uint8 data) { | 18 bool IsDataByte(uint8 data) { |
| 19 return (data & 0x80) == 0; | 19 return (data & 0x80) == 0; |
| 20 } | 20 } |
| 21 | 21 |
| 22 bool IsFirstStatusByte(uint8 data) { | 22 bool IsFirstStatusByte(uint8 data) { |
| 23 return !IsDataByte(data) && data != kEndOfSysEx; | 23 return !IsDataByte(data) && data != kEndOfSysEx; |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool IsSystemRealTimeMessage(uint8 data) { | 26 bool IsSystemRealTimeMessage(uint8 data) { |
| 27 return 0xf8 <= data && data <= 0xff; | 27 return 0xf8 <= data; |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 MidiMessageQueue::MidiMessageQueue(bool allow_running_status) | 32 MidiMessageQueue::MidiMessageQueue(bool allow_running_status) |
| 33 : allow_running_status_(allow_running_status) {} | 33 : allow_running_status_(allow_running_status) {} |
| 34 | 34 |
| 35 MidiMessageQueue::~MidiMessageQueue() {} | 35 MidiMessageQueue::~MidiMessageQueue() {} |
| 36 | 36 |
| 37 void MidiMessageQueue::Add(const std::vector<uint8>& data) { | 37 void MidiMessageQueue::Add(const std::vector<uint8>& data) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 next_message_.push_back(status_byte); | 110 next_message_.push_back(status_byte); |
| 111 } | 111 } |
| 112 return; | 112 return; |
| 113 } | 113 } |
| 114 | 114 |
| 115 NOTREACHED(); | 115 NOTREACHED(); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace media | 119 } // namespace media |
| OLD | NEW |