Path: blob/master/libgambatte/src/sound/static_output_tester.h
2 views
/***************************************************************************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 STATIC_OUTPUT_TESTER_H19#define STATIC_OUTPUT_TESTER_H2021#include "envelope_unit.h"2223namespace gambatte {2425template<class Channel, class Unit>26class StaticOutputTester : public EnvelopeUnit::VolOnOffEvent {27const Channel &ch;28Unit &unit;29public:30StaticOutputTester(const Channel &ch, Unit &unit) : ch(ch), unit(unit) {}31void operator()(unsigned long cc);32};3334template<class Channel, class Unit>35void StaticOutputTester<Channel, Unit>::operator()(const unsigned long cc) {36if (ch.soMask && ch.master && ch.envelopeUnit.getVolume())37unit.reviveCounter(cc);38else39unit.killCounter();40}4142}4344#endif454647