-
Notifications
You must be signed in to change notification settings - Fork 1
/
openpsf_c.cpp
125 lines (108 loc) · 2.24 KB
/
openpsf_c.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include "openpsf_c.h"
#include "openpsf.h"
Psf* instance(PSF* self) noexcept {
return static_cast<Psf*>(self);
}
bool openpsf_initialize_psx_core(const char* bios_path)
{
return Psf::initialize_psx_core(bios_path);
}
bool openpsf_is_our_path(const char* p_full_path, const char* p_extension)
{
return Psf::is_our_path(p_full_path, p_extension);
}
PSF* openpsf_create_with_params(bool reverb, bool simulate_frequency_response, bool suppress_opening_silence,
int end_silence_seconds)
{
PsfFlags flags = PsfDefaults;
if (reverb == false) {
flags = flags | NoReverb;
}
if (simulate_frequency_response == false) {
flags = flags | NoSimulateFrequencyResponse;
}
if (suppress_opening_silence == true) {
flags = flags | SuppressOpeningSilence;
}
return new Psf(flags, end_silence_seconds);
}
PSF* openpsf_create()
{
return new Psf();
}
void openpsf_destroy(PSF* self)
{
if (self != nullptr) {
delete instance(self);
}
}
bool openpsf_open(PSF* self, const char* p_path, bool infinite)
{
if (self == nullptr) {
return false;
}
return instance(self)->open(p_path, infinite);
}
void openpsf_close(PSF* self)
{
if (self == nullptr) {
return;
}
return instance(self)->close();
}
size_t openpsf_decode(PSF* self, int16_t* data, unsigned int sample_count)
{
if (self == nullptr) {
return 0;
}
return instance(self)->decode(data, sample_count);
}
bool openpsf_rewind(PSF* self)
{
if (self == nullptr) {
return false;
}
return instance(self)->rewind();
}
int openpsf_get_sample_count(PSF* self)
{
if (self == nullptr) {
return 0;
}
return instance(self)->get_sample_count();
}
int openpsf_get_sample_rate(PSF* self)
{
if (self == nullptr) {
return 0;
}
return instance(self)->get_sample_rate();
}
int openpsf_get_channel_count(PSF* self)
{
if (self == nullptr) {
return 0;
}
return instance(self)->get_channel_count();
}
int openpsf_get_bits_per_seconds(PSF* self)
{
if (self == nullptr) {
return 0;
}
return instance(self)->get_bits_per_seconds();
}
const char* openpsf_get_last_error(PSF* self)
{
if (self == nullptr) {
return nullptr;
}
return instance(self)->get_last_error();
}
const char* openpsf_get_last_status(PSF* self)
{
if (self == nullptr) {
return nullptr;
}
return instance(self)->get_last_status();
}