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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* @file
* Sound decoder used in engines:
* - agos
* - parallaction
* - gob
* - hopkins
* - chewy (subclass)
*/
#ifndef AUDIO_MODS_PROTRACKER_H
#define AUDIO_MODS_PROTRACKER_H
#include "audio/mods/paula.h"
#include "audio/mods/module.h"
namespace Common {
class SeekableReadStream;
}
namespace Modules {
class ProtrackerStream : public ::Audio::Paula {
protected:
Module *_module;
private:
int _tick;
int _row;
int _pos;
int _speed;
int _bpm;
// For effect 0xB - Jump To Pattern;
bool _hasJumpToPattern;
int _jumpToPattern;
// For effect 0xD - PatternBreak;
bool _hasPatternBreak;
int _skipRow;
// For effect 0xE6 - Pattern Loop
bool _hasPatternLoop;
int _patternLoopCount;
int _patternLoopRow;
// For effect 0xEE - Pattern Delay
byte _patternDelay;
static const int16 sinetable[];
struct Track {
byte sample;
byte lastSample;
uint16 period;
Offset offset;
byte vol;
byte finetune;
// For effect 0x0 - Arpeggio
bool arpeggio;
byte arpeggioNotes[3];
// For effect 0x3 - Porta to note
uint16 portaToNote;
byte portaToNoteSpeed;
// For effect 0x4 - Vibrato
int vibrato;
byte vibratoPos;
byte vibratoSpeed;
byte vibratoDepth;
// For effect 0xED - Delay sample
byte delaySample;
byte delaySampleTick;
} _track[4];
public:
ProtrackerStream(Common::SeekableReadStream *stream, int offs, int rate, bool stereo);
protected:
ProtrackerStream(int rate, bool stereo);
public:
virtual ~ProtrackerStream();
Modules::Module *getModule() {
// Ordinarily, the Module is not meant to be seen outside of
// this class, but occasionally, it's useful to be able to
// manipulate it directly. The Hopkins engine uses this to
// repair a broken song.
return _module;
}
private:
void interrupt() override;
void doPorta(int track);
void doVibrato(int track);
void doVolSlide(int track, byte ex, byte ey);
void updateRow();
void updateEffects();
};
}
namespace Audio {
class AudioStream;
/*
* Factory function for ProTracker streams. Reads all data from the
* given ReadStream and creates an AudioStream from this. No reference
* to the 'stream' object is kept, so you can safely delete it after
* invoking this factory.
*
* @param stream the ReadStream from which to read the ProTracker data
* @param rate TODO
* @param stereo TODO
* @param module can be used to return the Module object (rarely useful)
* @return a new AudioStream, or NULL, if an error occurred
*/
AudioStream *makeProtrackerStream(Common::SeekableReadStream *stream, int offs = 0, int rate = 44100, bool stereo = true, Modules::Module **module = 0);
} // End of namespace Audio
#endif
|