| 1001 | */ |
| 1002 | |
| 1003 | int CsoundMidiInputBuffer::GetMidiData(unsigned char *buf, int nBytes) |
| 1004 | { |
| 1005 | int i; |
| 1006 | |
| 1007 | if (!bufBytes) |
| 1008 | return 0; |
| 1009 | csoundLockMutex(mutex_); |
| 1010 | for (i = 0; i < nBytes && bufBytes > 0; i++) { |
| 1011 | buf[i] = this->buf[bufReadPos]; |
| 1012 | bufReadPos = (bufReadPos < (bufSize - 1) ? bufReadPos + 1 : 0); |
| 1013 | bufBytes--; |
| 1014 | } |
| 1015 | csoundUnlockMutex(mutex_); |
| 1016 | return i; |
| 1017 | } |
| 1018 | |
| 1019 | // ---------------------------------------------------------------------------- |
| 1020 |
no test coverage detected