Debian Codegraph @

src/engine/platform/sound/tia/Audio.h

raw
1 //============================================================================
2 //
3 // SSSS tt lll lll
4 // SS SS tt ll ll
5 // SS tttttt eeee ll ll aaaa
6 // SSSS tt ee ee ll ll aa
7 // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 // SS SS tt ee ll ll aa aa
9 // SSSS ttt eeeee llll llll aaaaa
10 //
11 // Copyright (c) 1995-2021 by Bradford W. Mott, Stephen Anthony
12 // and the Stella Team
13 //
14 // See the file "License.txt" for information on usage and redistribution of
15 // this file, and for a DISCLAIMER OF ALL WARRANTIES.
16 //============================================================================
17
18 #ifndef TIA_AUDIO_HXX
19 #define TIA_AUDIO_HXX
20
21 #include "AudioChannel.h"
22 #include <array>
23
24 namespace TIA {
25 class Audio
26 {
27 public:
28 Audio();
29
30 void reset(bool stereo);
31
32 void tick(int len);
33
34 void write(unsigned char addr, unsigned char val);
35
36 AudioChannel& channel0();
37
38 AudioChannel& channel1();
39
40 short myCurrentSample[2];
41 short myChannelOut[2];
42
43 private:
44 void phase1();
45 void addSample(unsigned char sample0, unsigned char sample1);
46
47 public:
48 int myCounter;
49 unsigned char myPhase;
50
51 private:
52 AudioChannel myChannel0;
53 AudioChannel myChannel1;
54
55 bool stereo;
56
57 std::array<short, 0x1e + 1> myMixingTableSum;
58 std::array<short, 0x0f + 1> myMixingTableIndividual;
59
60 unsigned int mySampleIndex{0};
61 #ifdef GUI_SUPPORT
62 bool myRewindMode{false};
63 mutable ByteArray mySamples;
64 #endif
65
66 private:
67 Audio(const Audio&) = delete;
68 Audio(Audio&&) = delete;
69 Audio& operator=(const Audio&) = delete;
70 Audio& operator=(Audio&&) = delete;
71 };
72 }
73
74 #endif // TIA_AUDIO_HXX