Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmeteor/include/ameteor/audio/sound2.hpp
2 views
1
// Meteor - A Nintendo Gameboy Advance emulator
2
// Copyright (C) 2009-2011 Philippe Daouadi
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 as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
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 for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
#ifndef __AUDIO_SOUND_2_H__
18
#define __AUDIO_SOUND_2_H__
19
20
#include <stdint.h>
21
#include <istream>
22
#include <ostream>
23
24
namespace AMeteor
25
{
26
namespace Audio
27
{
28
class Sound2
29
{
30
public :
31
Sound2 (uint16_t& cntl, uint16_t& cnth, uint16_t freq);
32
33
void Reset ();
34
35
// call this at the frequence given in constructor
36
void SoundTick ();
37
38
void ResetSound ();
39
void ResetEnvelope ()
40
{
41
m_envelope = 0;
42
}
43
44
int8_t GetSample () const
45
{
46
return m_sample;
47
}
48
49
bool IsOn () const
50
{
51
return m_on;
52
}
53
54
bool SaveState (std::ostream& stream);
55
bool LoadState (std::istream& stream);
56
57
private :
58
uint16_t &m_cntl, &m_cnth;
59
bool m_on;
60
uint32_t m_posP, m_posE;
61
int8_t m_sample;
62
uint16_t m_speriod;
63
uint8_t m_envelope;
64
uint32_t m_length;
65
bool m_timed;
66
};
67
}
68
}
69
70
#endif
71
72