lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
plugins
FreeBoy
GbApuWrapper.h
Go to the documentation of this file.
1
/*
2
* GbApuWrapper.h - Gb_Apu subclass which allows direct buffer access
3
* Copyright (c) 2017 Tres Finocchiaro <tres.finocchiaro/at/gmail.com>
4
*
5
* This file is part of LMMS - https://lmms.io
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public
18
* License along with this program (see COPYING); if not, write to the
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
* Boston, MA 02110-1301 USA.
21
*
22
*/
23
24
#ifndef LMMS_GB_APU_WRAPPER_H
25
#define LMMS_GB_APU_WRAPPER_H
26
27
#include <Gb_Apu.h>
28
#include <Multi_Buffer.h>
29
30
namespace
lmms
31
{
32
33
34
class
GbApuWrapper
:
private
Gb_Apu
35
{
36
public
:
37
GbApuWrapper
() =
default
;
38
~GbApuWrapper
() =
default
;
39
40
blargg_err_t
setSampleRate
(
long
sampleRate,
long
clockRate);
41
void
writeRegister
(
unsigned
addr,
int
data) { Gb_Apu::write_register(
fakeClock
(), addr, data); }
42
long
samplesAvail
()
const
;
43
long
readSamples
(blip_sample_t* out,
long
count);
44
void
trebleEq
(
const
blip_eq_t& eq) { Gb_Apu::treble_eq(eq); }
45
void
bassFreq
(
int
freq);
46
void
endFrame
(blip_time_t endTime);
47
48
private
:
49
Stereo_Buffer
m_buf
;
50
51
// Fake CPU timing
52
blip_time_t
fakeClock
() {
return
m_time
+= 4; }
53
blip_time_t
m_time
= 0;
54
};
55
56
57
}
// namespace lmms
58
59
#endif
// LMMS_GB_APU_WRAPPER_H
lmms::GbApuWrapper::writeRegister
void writeRegister(unsigned addr, int data)
Definition
GbApuWrapper.h:41
lmms::GbApuWrapper::trebleEq
void trebleEq(const blip_eq_t &eq)
Definition
GbApuWrapper.h:44
lmms::GbApuWrapper::samplesAvail
long samplesAvail() const
Definition
GbApuWrapper.cpp:39
lmms::GbApuWrapper::m_time
blip_time_t m_time
Definition
GbApuWrapper.h:53
lmms::GbApuWrapper::setSampleRate
blargg_err_t setSampleRate(long sampleRate, long clockRate)
Definition
GbApuWrapper.cpp:31
lmms::GbApuWrapper::m_buf
Stereo_Buffer m_buf
Definition
GbApuWrapper.h:49
lmms::GbApuWrapper::endFrame
void endFrame(blip_time_t endTime)
Definition
GbApuWrapper.cpp:56
lmms::GbApuWrapper::~GbApuWrapper
~GbApuWrapper()=default
lmms::GbApuWrapper::GbApuWrapper
GbApuWrapper()=default
lmms::GbApuWrapper::bassFreq
void bassFreq(int freq)
Definition
GbApuWrapper.cpp:51
lmms::GbApuWrapper::readSamples
long readSamples(blip_sample_t *out, long count)
Definition
GbApuWrapper.cpp:45
lmms::GbApuWrapper::fakeClock
blip_time_t fakeClock()
Definition
GbApuWrapper.h:52
lmms
Definition
RemotePluginBase.cpp:34
Generated on
for lmms by
1.18.0