| 1153 | */ |
| 1154 | |
| 1155 | int CsoundMidiOutputBuffer::GetStatus() |
| 1156 | { |
| 1157 | unsigned char st = (unsigned char) 0; |
| 1158 | |
| 1159 | if (bufBytes) { |
| 1160 | csoundLockMutex(mutex_); |
| 1161 | if (bufBytes > 0) { |
| 1162 | int nBytes; |
| 1163 | st = buf[bufReadPos] & (unsigned char) 0xFF; |
| 1164 | nBytes = (int) midiMessageByteCnt[(st & (unsigned char) 0xF8) >> 3]; |
| 1165 | if (nBytes <= 0 || bufBytes < nBytes) |
| 1166 | st = (unsigned char) 0; // invalid MIDI data |
| 1167 | if (nBytes > 1) |
| 1168 | st &= (unsigned char) 0xF0; // channel msg: remove channel number |
| 1169 | } |
| 1170 | csoundUnlockMutex(mutex_); |
| 1171 | } |
| 1172 | return (int) st; |
| 1173 | } |
| 1174 | |
| 1175 | /** |
| 1176 | * Returns the channel number (1 to 16) for the first message in the |
no test coverage detected