| 769 | } |
| 770 | |
| 771 | bool MidiInApi::MidiQueue::pop( std::vector<unsigned char> *msg, double* timeStamp ) |
| 772 | { |
| 773 | // Local stack copies of front/back |
| 774 | unsigned int _back, _front, _size; |
| 775 | |
| 776 | // Get back/front indexes exactly once and calculate current size |
| 777 | _size = size( &_back, &_front ); |
| 778 | |
| 779 | if ( _size == 0 ) |
| 780 | return false; |
| 781 | |
| 782 | // Copy queued message to the vector pointer argument and then "pop" it. |
| 783 | msg->assign( ring[_front].bytes.begin(), ring[_front].bytes.end() ); |
| 784 | *timeStamp = ring[_front].timeStamp; |
| 785 | |
| 786 | // Update front |
| 787 | front = (front+1)%ringSize; |
| 788 | return true; |
| 789 | } |
| 790 | |
| 791 | //*********************************************************************// |
| 792 | // Common MidiOutApi Definitions |
no test coverage detected