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-2019 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 "bspf.hxx"
22#include "AudioChannel.hxx"
23#include "Serializable.hxx"
24
25class AudioQueue;
26
27class Audio : public Serializable
28{
29 public:
30 Audio();
31
32 void reset();
33
34 void setAudioQueue(shared_ptr<AudioQueue> queue);
35
36 void tick();
37
38 AudioChannel& channel0();
39
40 AudioChannel& channel1();
41
42 /**
43 Serializable methods (see that class for more information).
44 */
45 bool save(Serializer& out) const override;
46 bool load(Serializer& in) override;
47
48 private:
49 void phase1();
50
51 private:
52 shared_ptr<AudioQueue> myAudioQueue;
53
54 uInt8 myCounter;
55
56 AudioChannel myChannel0;
57 AudioChannel myChannel1;
58
59 Int16 myMixingTableSum[0x1e + 1];
60 Int16 myMixingTableIndividual[0x0f + 1];
61
62 Int16* myCurrentFragment;
63 uInt32 mySampleIndex;
64
65 private:
66 Audio(const Audio&) = delete;
67 Audio(Audio&&) = delete;
68 Audio& operator=(const Audio&) = delete;
69 Audio& operator=(Audio&&) = delete;
70};
71
72#endif // TIA_AUDIO_HXX
73