Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
folium-app
GitHub Repository: folium-app/Folium
Path: blob/a-new-beginning/Cherry/Core/include/VgmRecorder.h
2 views
1
/*
2
* Gearcoleco - ColecoVision Emulator
3
* Copyright (C) 2021 Ignacio Sanchez
4
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see http://www.gnu.org/licenses/
17
*
18
*/
19
20
#ifndef VGM_RECORDER_H
21
#define VGM_RECORDER_H
22
23
#include "definitions.h"
24
#include <vector>
25
#include <string>
26
#include <fstream>
27
28
class VgmRecorder
29
{
30
public:
31
VgmRecorder();
32
~VgmRecorder();
33
34
void Start(const char* file_path, int clock_rate, bool is_pal);
35
void Stop();
36
bool IsRecording() const { return m_bRecording; }
37
38
void WritePSG(u8 data);
39
void WriteAY8910(u8 reg, u8 data);
40
void UpdateTiming(int elapsed_samples);
41
42
private:
43
void WriteCommand(u8 command);
44
void WriteCommand(u8 command, u8 data);
45
void WriteCommand(u8 command, u8 data1, u8 data2);
46
void WriteWait(int samples);
47
void FlushPendingWait();
48
49
private:
50
bool m_bRecording;
51
std::string m_FilePath;
52
std::vector<u8> m_CommandBuffer;
53
int m_PendingWait;
54
int m_TotalSamples;
55
int m_ClockRate;
56
bool m_bPAL;
57
bool m_bPSGUsed;
58
bool m_bAY8910Used;
59
};
60
61
#endif /* VGM_RECORDER_H */
62
63