-
Notifications
You must be signed in to change notification settings - Fork 0
/
t85playdefs.cpp
88 lines (60 loc) · 1.85 KB
/
t85playdefs.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef __T85PLAY_HPP_INCLUDED__
#define __T85PLAY_HPP_INCLUDED__
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <cwchar>
#include <filesystem>
#include <fstream>
#include <list>
#include <array>
#include <sndfile.hh>
#include <soundio/soundio.h>
#include "t85apu.hpp"
#include "NotchFilter.cpp"
// typedefs go here
struct __gd3;
typedef __gd3 gd3;
// utility wrapper to adapt locale-bound facets for wstring/wbuffer convert
template<class Facet>
struct deletable_facet : Facet
{
template<class... Args>
deletable_facet(Args&&... args) : Facet(std::forward<Args>(args)...) {}
~deletable_facet() {}
};
// constants
static const uint32_t currentFileVersion = 0x00000000; // 16.8.8 bits semantic versioning
static const uint32_t currentGd3Version = 0x00000100;
// global variables
t85APUHandle apu;
std::filesystem::path inFilePath;
bool inFileDefined = false;
std::ifstream regDumpFile;
std::filesystem::path outFilePath;
bool outFileDefined = false;
bool sepFileOutput = false;
uint32_t sampleRate = 44100;
bool sampleRateDefined = false;
BandFilter::BandFilter notchFilter;
bool notchFilterEnabled = false;
uint8_t outputMethod;
bool outputMethodOverride = false;
double ticksPerSample;
double sampleTickCounter = 0.0;
uint_fast16_t waitTimeCounter = 0;
uint32_t regDataLocation, gd3DataLocation, loopOffset, extraHeaderOffset, regDataLength;
uint32_t apuClock, totalSmpCount, loopLength, fadeTime;
char buffer[4];
bool ended = false;
bool fading = false;
std::list<uint16_t> regWrites;
std::wstring_convert<deletable_facet<std::codecvt<char16_t, char, std::mbstate_t>>, char16_t> utf16Converter;
gd3 * gd3Data;
typedef struct __extraDataForIndividualChannels {
std::array<SndfileHandle, 5> handles;
std::array<int16_t *, 5> buffers;
} edfic;
// functions
void emulationTick(std::ifstream & file);
#endif //__T85PLAY_HPP_INCLUDED__