/***************************************************************************1* Copyright (C) 2007 by Sindre Aamås *2* [email protected] *3* *4* This program is free software; you can redistribute it and/or modify *5* it under the terms of the GNU General Public License version 2 as *6* published by the Free Software Foundation. *7* *8* This program is distributed in the hope that it will be useful, *9* but WITHOUT ANY WARRANTY; without even the implied warranty of *10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *11* GNU General Public License version 2 for more details. *12* *13* You should have received a copy of the GNU General Public License *14* version 2 along with this program; if not, write to the *15* Free Software Foundation, Inc., *16* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *17***************************************************************************/18#ifndef SOUND_UNIT_H19#define SOUND_UNIT_H2021namespace gambatte {2223class SoundUnit {24protected:25unsigned long counter;26public:27enum { COUNTER_MAX = 0x80000000u, COUNTER_DISABLED = 0xFFFFFFFFu };2829SoundUnit() : counter(COUNTER_DISABLED) {}30virtual ~SoundUnit() {}31virtual void event() = 0;32unsigned long getCounter() const { return counter; }33virtual void resetCounters(unsigned long /*oldCc*/) { if (counter != COUNTER_DISABLED) counter -= COUNTER_MAX; }34};3536}3738#endif394041