Debian Codegraph @

mednafen/pce_fast/psg.h

raw symbols SCIP
1 #ifndef _PCEFast_PSG_H
2 #define _PCEFast_PSG_H
3
4 #include "../include/blip/Blip_Buffer.h"
5
6 class PCEFast_PSG;
7
8 struct psg_channel
9 {
10 uint8 waveform[32]; /* Waveform data */
11 uint8 waveform_index; /* Waveform data index */
12 uint8 dda;
13 uint8 control; /* Channel enable, DDA, volume */
14 uint8 noisectrl; /* Noise enable/ctrl (channels 4,5 only) */
15
16 int32 vl[2]; //vll, vlr;
17
18 int32 counter;
19
20 void (PCEFast_PSG::*UpdateOutput)(const int32 timestamp, psg_channel *ch);
21
22 uint32 freq_cache;
23 uint32 noise_freq_cache; // Channel 4,5 only
24 int32 noisecount;
25 uint32 lfsr;
26
27 int32 samp_accum; // The result of adding up all the samples in the waveform buffer(part of an optimization for high-frequency playback).
28 int32 blip_prev_samp[2];
29 int32 lastts;
30
31 uint16 frequency; /* Channel frequency */
32 uint8 balance; /* Channel balance */
33 };
34
35 class PCEFast_PSG
36 {
37 public:
38
39 PCEFast_PSG(Blip_Buffer *bb_l, Blip_Buffer *bb_r) MDFN_COLD;
40 ~PCEFast_PSG() MDFN_COLD;
41
42 int StateAction(StateMem *sm, int load, int data_only) MDFN_COLD;
43
44 void Power(const int32 timestamp) MDFN_COLD;
45 void Write(int32 timestamp, uint8 A, uint8 V);
46
47 void SetVolume(double new_volume) MDFN_COLD;
48
49 void EndFrame(int32 timestamp);
50
51 private:
52
53 void Update(int32 timestamp);
54
55 void UpdateSubLFO(int32 timestamp);
56 void UpdateSubNonLFO(int32 timestamp);
57
58 void RecalcUOFunc(int chnum);
59 void UpdateOutput_Off(const int32 timestamp, psg_channel *ch);
60 void UpdateOutput_Accum(const int32 timestamp, psg_channel *ch);
61 void UpdateOutput_Norm(const int32 timestamp, psg_channel *ch);
62 void UpdateOutput_Noise(const int32 timestamp, psg_channel *ch);
63
64 int32 GetVL(const int chnum, const int lr);
65
66 void RecalcFreqCache(int chnum);
67 void RecalcNoiseFreqCache(int chnum);
68 template<bool LFO_On>
69 void RunChannel(int chc, int32 timestamp);
70 double OutputVolume;
71
72 uint8 select; /* Selected channel (0-5) */
73 uint8 globalbalance; /* Global sound balance */
74 uint8 lfofreq; /* LFO frequency */
75 uint8 lfoctrl; /* LFO control */
76
77 int32 vol_update_counter;
78 int32 vol_update_which;
79 int32 vol_update_vllatch;
80 bool vol_pending;
81
82 psg_channel channel[6];
83
84 int32 lastts;
85
86 Blip_Buffer *sbuf[2];
87 Blip_Synth<blip_good_quality, 8192> Synth;
88
89 int32 dbtable_volonly[32];
90
91 int32 dbtable[32][32];
92 };
93
94 #endif