ScummVM API documentation
protracker.h
Go to the documentation of this file.
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (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
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
32
#ifndef AUDIO_MODS_PROTRACKER_H
33
#define AUDIO_MODS_PROTRACKER_H
34
35
#include "audio/mods/paula.h"
36
#include "audio/mods/module.h"
37
38
namespace
Common
{
39
class
SeekableReadStream;
40
}
41
42
namespace
Modules
{
43
44
class
ProtrackerStream
:
public
::Audio::Paula
{
45
protected
:
46
Module
*_module;
47
48
private
:
49
int
_tick;
50
int
_row;
51
int
_pos;
52
53
int
_speed;
54
int
_bpm;
55
56
// For effect 0xB - Jump To Pattern;
57
bool
_hasJumpToPattern;
58
int
_jumpToPattern;
59
60
// For effect 0xD - PatternBreak;
61
bool
_hasPatternBreak;
62
int
_skipRow;
63
64
// For effect 0xE6 - Pattern Loop
65
bool
_hasPatternLoop;
66
int
_patternLoopCount;
67
int
_patternLoopRow;
68
69
// For effect 0xEE - Pattern Delay
70
byte _patternDelay;
71
72
static
const
int16 sinetable[];
73
74
struct
Track {
75
byte sample;
76
byte lastSample;
77
uint16 period;
78
Offset
offset;
79
80
byte vol;
81
byte finetune;
82
83
// For effect 0x0 - Arpeggio
84
bool
arpeggio;
85
byte arpeggioNotes[3];
86
87
// For effect 0x3 - Porta to note
88
uint16 portaToNote;
89
byte portaToNoteSpeed;
90
91
// For effect 0x4 - Vibrato
92
int
vibrato;
93
byte vibratoPos;
94
byte vibratoSpeed;
95
byte vibratoDepth;
96
97
// For effect 0xED - Delay sample
98
byte delaySample;
99
byte delaySampleTick;
100
} _track[4];
101
102
public
:
103
ProtrackerStream
(
Common::SeekableReadStream
*stream,
int
offs,
int
rate,
bool
stereo);
104
105
protected
:
106
ProtrackerStream
(
int
rate,
bool
stereo);
107
108
public
:
109
virtual
~
ProtrackerStream
();
110
111
Modules::Module
*getModule() {
112
// Ordinarily, the Module is not meant to be seen outside of
113
// this class, but occasionally, it's useful to be able to
114
// manipulate it directly. The Hopkins engine uses this to
115
// repair a broken song.
116
return
_module;
117
}
118
119
private
:
120
void
interrupt()
override
;
121
122
void
doPorta(
int
track);
123
void
doVibrato(
int
track);
124
void
doVolSlide(
int
track, byte ex, byte ey);
125
126
void
updateRow();
127
void
updateEffects();
128
};
129
130
}
131
132
namespace
Audio
{
133
134
class
AudioStream;
135
136
/*
137
* Factory function for ProTracker streams. Reads all data from the
138
* given ReadStream and creates an AudioStream from this. No reference
139
* to the 'stream' object is kept, so you can safely delete it after
140
* invoking this factory.
141
*
142
* @param stream the ReadStream from which to read the ProTracker data
143
* @param rate TODO
144
* @param stereo TODO
145
* @param module can be used to return the Module object (rarely useful)
146
* @return a new AudioStream, or NULL, if an error occurred
147
*/
148
AudioStream *makeProtrackerStream(
Common::SeekableReadStream
*stream,
int
offs = 0,
int
rate = 44100,
bool
stereo =
true
,
Modules::Module
**module = 0);
149
150
}
// End of namespace Audio
151
152
#endif
Modules::Module
Definition:
module.h:62
Modules
Definition:
module.h:31
Modules::ProtrackerStream
Definition:
protracker.h:44
Audio::Paula::Offset
Definition:
paula.h:65
Common::SeekableReadStream
Definition:
stream.h:745
Common
Definition:
algorithm.h:29
Audio::Paula
Definition:
paula.h:36
Audio
Definition:
system.h:38
audio
mods
protracker.h
Generated on Wed Dec 18 2024 09:03:22 for ScummVM API documentation by
1.8.13