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 #ifndef MEDIA_MIDI_MIDI_MESSAGE_UTIL_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MESSAGE_UTIL_H_ |
6 #define MEDIA_MIDI_MIDI_MESSAGE_UTIL_H_ | 6 #define MEDIA_MIDI_MIDI_MESSAGE_UTIL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <deque> | 11 #include <deque> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "media/midi/midi_export.h" | 14 #include "media/midi/midi_export.h" |
15 | 15 |
16 namespace media { | |
17 namespace midi { | 16 namespace midi { |
18 | 17 |
19 // Returns the length of a MIDI message in bytes. Never returns 4 or greater. | 18 // Returns the length of a MIDI message in bytes. Never returns 4 or greater. |
20 // Returns 0 if |status_byte| is: | 19 // Returns 0 if |status_byte| is: |
21 // - not a valid status byte, namely data byte. | 20 // - not a valid status byte, namely data byte. |
22 // - MIDI System Exclusive message. | 21 // - MIDI System Exclusive message. |
23 // - End of System Exclusive message. | 22 // - End of System Exclusive message. |
24 // - Reserved System Common Message (0xf4, 0xf5) | 23 // - Reserved System Common Message (0xf4, 0xf5) |
25 MIDI_EXPORT size_t GetMidiMessageLength(uint8_t status_byte); | 24 MIDI_EXPORT size_t GetMidiMessageLength(uint8_t status_byte); |
26 | 25 |
27 const uint8_t kSysExByte = 0xf0; | 26 const uint8_t kSysExByte = 0xf0; |
28 const uint8_t kEndOfSysExByte = 0xf7; | 27 const uint8_t kEndOfSysExByte = 0xf7; |
29 | 28 |
30 const uint8_t kSysMessageBitMask = 0xf0; | 29 const uint8_t kSysMessageBitMask = 0xf0; |
31 const uint8_t kSysMessageBitPattern = 0xf0; | 30 const uint8_t kSysMessageBitPattern = 0xf0; |
32 const uint8_t kSysRTMessageBitMask = 0xf8; | 31 const uint8_t kSysRTMessageBitMask = 0xf8; |
33 const uint8_t kSysRTMessageBitPattern = 0xf8; | 32 const uint8_t kSysRTMessageBitPattern = 0xf8; |
34 | 33 |
35 } // namespace midi | 34 } // namespace midi |
36 } // namespace media | |
37 | 35 |
38 #endif // MEDIA_MIDI_MIDI_MESSAGE_UTIL_H_ | 36 #endif // MEDIA_MIDI_MIDI_MESSAGE_UTIL_H_ |
OLD | NEW |