Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libgambatte/src/sound/static_output_tester.h
2 views
1
/***************************************************************************
2
* Copyright (C) 2007 by Sindre Aamås *
3
* [email protected] *
4
* *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License version 2 as *
7
* published by the Free Software Foundation. *
8
* *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License version 2 for more details. *
13
* *
14
* You should have received a copy of the GNU General Public License *
15
* version 2 along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18
***************************************************************************/
19
#ifndef STATIC_OUTPUT_TESTER_H
20
#define STATIC_OUTPUT_TESTER_H
21
22
#include "envelope_unit.h"
23
24
namespace gambatte {
25
26
template<class Channel, class Unit>
27
class StaticOutputTester : public EnvelopeUnit::VolOnOffEvent {
28
const Channel &ch;
29
Unit &unit;
30
public:
31
StaticOutputTester(const Channel &ch, Unit &unit) : ch(ch), unit(unit) {}
32
void operator()(unsigned long cc);
33
};
34
35
template<class Channel, class Unit>
36
void StaticOutputTester<Channel, Unit>::operator()(const unsigned long cc) {
37
if (ch.soMask && ch.master && ch.envelopeUnit.getVolume())
38
unit.reviveCounter(cc);
39
else
40
unit.killCounter();
41
}
42
43
}
44
45
#endif
46
47