blob: 5de16a1928204246ae38f8ee1583d59752ee3348 (
plain)
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
|
/*
* Paula.h
* -------
* Purpose: Emulating the Amiga's sound chip, Paula, by implementing resampling using band-limited steps (BLEPs)
* Notes : (currently none)
* Authors: OpenMPT Devs
* Antti S. Lankila
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "BuildSettings.h"
#include "Snd_defs.h"
OPENMPT_NAMESPACE_BEGIN
namespace Paula
{
const int PAULA_HZ = 3546895;
const int MINIMUM_INTERVAL = 16;
const int BLEP_SCALE = 17;
const int BLEP_SIZE = 2048;
const int MAX_BLEPS = (BLEP_SIZE / MINIMUM_INTERVAL);
class State
{
struct Blep
{
int16 level;
uint16 age;
};
public:
SamplePosition remainder, stepRemainder;
int numSteps; // Number of full-length steps
private:
uint16 activeBleps; // Count of simultaneous bleps to keep track of
int16 globalOutputLevel; // The instantenous value of Paula output
Blep blepState[MAX_BLEPS];
public:
State(uint32 sampleRate = 48000);
void Reset();
void InputSample(int16 sample);
int OutputSample(bool filter);
void Clock(int cycles);
};
}
OPENMPT_NAMESPACE_END
|