1// CountEventConsumer.h 2// -------------------- 3// A simple MIDI consumer that counts incoming MIDI events. 4// 5// Copyright 1999, Be Incorporated. All Rights Reserved. 6// This file may be used under the terms of the Be Sample Code License. 7 8#ifndef _CountEventConsumer_h 9#define _CountEventConsumer_h 10 11#include <MidiConsumer.h> 12#include <SupportDefs.h> 13 14class CountEventConsumer : public BMidiLocalConsumer 15{ 16public: 17 CountEventConsumer(const char* name) 18 : BMidiLocalConsumer(name), m_eventCount(0) 19 {} 20 void Reset() { m_eventCount = 0; } 21 int32 CountEvents() { return m_eventCount; } 22 23 void Data(uchar*, size_t, bool, bigtime_t) 24 { atomic_add(&m_eventCount, 1); } 25 26private: 27 int32 m_eventCount; 28}; 29 30#endif /* _CountEventConsumer_h */ 31