COMMON: Remove unneeded audio-plugins that to my knowledge aren't used in any 3D-adventures
This commit is contained in:
parent
e126618cd2
commit
d1b0675f90
8 changed files with 4 additions and 4222 deletions
|
@ -20,12 +20,8 @@ MODULE_OBJS := \
|
||||||
softsynth/opl/dbopl.o \
|
softsynth/opl/dbopl.o \
|
||||||
softsynth/opl/dosbox.o \
|
softsynth/opl/dosbox.o \
|
||||||
softsynth/opl/mame.o \
|
softsynth/opl/mame.o \
|
||||||
softsynth/appleiigs.o \
|
|
||||||
softsynth/fluidsynth.o \
|
softsynth/fluidsynth.o \
|
||||||
softsynth/mt32.o \
|
softsynth/mt32.o
|
||||||
softsynth/pcspk.o \
|
|
||||||
softsynth/sid.o \
|
|
||||||
softsynth/wave6581.o
|
|
||||||
|
|
||||||
ifndef USE_ARM_SOUND_ASM
|
ifndef USE_ARM_SOUND_ASM
|
||||||
MODULE_OBJS += \
|
MODULE_OBJS += \
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
/* 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 2
|
|
||||||
* 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, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "audio/null.h"
|
|
||||||
|
|
||||||
// Plugin interface
|
|
||||||
// (This can only create a null driver since apple II gs support seeems not to be implemented
|
|
||||||
// and also is not part of the midi driver architecture. But we need the plugin for the options
|
|
||||||
// menu in the launcher and for MidiDriver::detectDevice() which is more or less used by all engines.)
|
|
||||||
|
|
||||||
class AppleIIGSMusicPlugin : public NullMusicPlugin {
|
|
||||||
public:
|
|
||||||
const char *getName() const {
|
|
||||||
return _s("Apple II GS Emulator (NOT IMPLEMENTED)");
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *getId() const {
|
|
||||||
return "appleIIgs";
|
|
||||||
}
|
|
||||||
|
|
||||||
MusicDevices getDevices() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
MusicDevices AppleIIGSMusicPlugin::getDevices() const {
|
|
||||||
MusicDevices devices;
|
|
||||||
devices.push_back(MusicDevice(this, "", MT_APPLEIIGS));
|
|
||||||
return devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
//#if PLUGIN_ENABLED_DYNAMIC(APPLEIIGS)
|
|
||||||
//REGISTER_PLUGIN_DYNAMIC(APPLEIIGS, PLUGIN_TYPE_MUSIC, AppleIIGSMusicPlugin);
|
|
||||||
//#else
|
|
||||||
REGISTER_PLUGIN_STATIC(APPLEIIGS, PLUGIN_TYPE_MUSIC, AppleIIGSMusicPlugin);
|
|
||||||
//#endif
|
|
||||||
|
|
|
@ -1,184 +0,0 @@
|
||||||
/* 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 2
|
|
||||||
* 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, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "audio/softsynth/pcspk.h"
|
|
||||||
#include "audio/null.h"
|
|
||||||
|
|
||||||
namespace Audio {
|
|
||||||
|
|
||||||
const PCSpeaker::generatorFunc PCSpeaker::generateWave[] =
|
|
||||||
{&PCSpeaker::generateSquare, &PCSpeaker::generateSine,
|
|
||||||
&PCSpeaker::generateSaw, &PCSpeaker::generateTriangle};
|
|
||||||
|
|
||||||
PCSpeaker::PCSpeaker(int rate) {
|
|
||||||
_rate = rate;
|
|
||||||
_wave = kWaveFormSquare;
|
|
||||||
_playForever = false;
|
|
||||||
_oscLength = 0;
|
|
||||||
_oscSamples = 0;
|
|
||||||
_remainingSamples = 0;
|
|
||||||
_mixedSamples = 0;
|
|
||||||
_volume = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
PCSpeaker::~PCSpeaker() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void PCSpeaker::play(WaveForm wave, int freq, int32 length) {
|
|
||||||
Common::StackLock lock(_mutex);
|
|
||||||
|
|
||||||
assert((wave >= kWaveFormSquare) && (wave <= kWaveFormTriangle));
|
|
||||||
|
|
||||||
_wave = wave;
|
|
||||||
_oscLength = _rate / freq;
|
|
||||||
_oscSamples = 0;
|
|
||||||
if (length == -1) {
|
|
||||||
_remainingSamples = 1;
|
|
||||||
_playForever = true;
|
|
||||||
} else {
|
|
||||||
_remainingSamples = (_rate * length) / 1000;
|
|
||||||
_playForever = false;
|
|
||||||
}
|
|
||||||
_mixedSamples = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PCSpeaker::stop(int32 delay) {
|
|
||||||
Common::StackLock lock(_mutex);
|
|
||||||
|
|
||||||
_remainingSamples = (_rate * delay) / 1000;
|
|
||||||
_playForever = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PCSpeaker::setVolume(byte volume) {
|
|
||||||
_volume = volume;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PCSpeaker::isPlaying() const {
|
|
||||||
return _remainingSamples != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int PCSpeaker::readBuffer(int16 *buffer, const int numSamples) {
|
|
||||||
Common::StackLock lock(_mutex);
|
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; _remainingSamples && (i < numSamples); i++) {
|
|
||||||
buffer[i] = generateWave[_wave](_oscSamples, _oscLength) * _volume;
|
|
||||||
if (_oscSamples++ >= _oscLength)
|
|
||||||
_oscSamples = 0;
|
|
||||||
if (!_playForever)
|
|
||||||
_remainingSamples--;
|
|
||||||
_mixedSamples++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the rest of the buffer
|
|
||||||
if (i < numSamples)
|
|
||||||
memset(buffer + i, 0, (numSamples - i) * sizeof(int16));
|
|
||||||
|
|
||||||
return numSamples;
|
|
||||||
}
|
|
||||||
|
|
||||||
int8 PCSpeaker::generateSquare(uint32 x, uint32 oscLength) {
|
|
||||||
return (x < (oscLength / 2)) ? 127 : -128;
|
|
||||||
}
|
|
||||||
|
|
||||||
int8 PCSpeaker::generateSine(uint32 x, uint32 oscLength) {
|
|
||||||
if (oscLength == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// TODO: Maybe using a look-up-table would be better?
|
|
||||||
return CLIP<int16>((int16) (128 * sin(2.0 * M_PI * x / oscLength)), -128, 127);
|
|
||||||
}
|
|
||||||
|
|
||||||
int8 PCSpeaker::generateSaw(uint32 x, uint32 oscLength) {
|
|
||||||
if (oscLength == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return ((x * (65536 / oscLength)) >> 8) - 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
int8 PCSpeaker::generateTriangle(uint32 x, uint32 oscLength) {
|
|
||||||
if (oscLength == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int y = ((x * (65536 / (oscLength / 2))) >> 8) - 128;
|
|
||||||
|
|
||||||
return (x <= (oscLength / 2)) ? y : (256 - y);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End of namespace Audio
|
|
||||||
|
|
||||||
|
|
||||||
// Plugin interface
|
|
||||||
// (This can only create a null driver since pc speaker support is not part of the
|
|
||||||
// midi driver architecture. But we need the plugin for the options menu in the launcher
|
|
||||||
// and for MidiDriver::detectDevice() which is more or less used by all engines.)
|
|
||||||
|
|
||||||
class PCSpeakerMusicPlugin : public NullMusicPlugin {
|
|
||||||
public:
|
|
||||||
const char *getName() const {
|
|
||||||
return _s("PC Speaker Emulator");
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *getId() const {
|
|
||||||
return "pcspk";
|
|
||||||
}
|
|
||||||
|
|
||||||
MusicDevices getDevices() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
MusicDevices PCSpeakerMusicPlugin::getDevices() const {
|
|
||||||
MusicDevices devices;
|
|
||||||
devices.push_back(MusicDevice(this, "", MT_PCSPK));
|
|
||||||
return devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
class PCjrMusicPlugin : public NullMusicPlugin {
|
|
||||||
public:
|
|
||||||
const char *getName() const {
|
|
||||||
return _s("IBM PCjr Emulator");
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *getId() const {
|
|
||||||
return "pcjr";
|
|
||||||
}
|
|
||||||
|
|
||||||
MusicDevices getDevices() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
MusicDevices PCjrMusicPlugin::getDevices() const {
|
|
||||||
MusicDevices devices;
|
|
||||||
devices.push_back(MusicDevice(this, "", MT_PCJR));
|
|
||||||
return devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
//#if PLUGIN_ENABLED_DYNAMIC(PCSPK)
|
|
||||||
//REGISTER_PLUGIN_DYNAMIC(PCSPK, PLUGIN_TYPE_MUSIC, PCSpeakerMusicPlugin);
|
|
||||||
//#else
|
|
||||||
REGISTER_PLUGIN_STATIC(PCSPK, PLUGIN_TYPE_MUSIC, PCSpeakerMusicPlugin);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//#if PLUGIN_ENABLED_DYNAMIC(PCJR)
|
|
||||||
//REGISTER_PLUGIN_DYNAMIC(PCJR, PLUGIN_TYPE_MUSIC, PCjrMusicPlugin);
|
|
||||||
//#else
|
|
||||||
REGISTER_PLUGIN_STATIC(PCJR, PLUGIN_TYPE_MUSIC, PCjrMusicPlugin);
|
|
||||||
//#endif
|
|
|
@ -1,84 +0,0 @@
|
||||||
/* 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 2
|
|
||||||
* 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, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SOUND_SOFTSYNTH_PCSPK_H
|
|
||||||
#define SOUND_SOFTSYNTH_PCSPK_H
|
|
||||||
|
|
||||||
#include "audio/audiostream.h"
|
|
||||||
#include "common/mutex.h"
|
|
||||||
|
|
||||||
namespace Audio {
|
|
||||||
|
|
||||||
class PCSpeaker : public AudioStream {
|
|
||||||
public:
|
|
||||||
enum WaveForm {
|
|
||||||
kWaveFormSquare = 0,
|
|
||||||
kWaveFormSine,
|
|
||||||
kWaveFormSaw,
|
|
||||||
kWaveFormTriangle
|
|
||||||
};
|
|
||||||
|
|
||||||
PCSpeaker(int rate = 44100);
|
|
||||||
~PCSpeaker();
|
|
||||||
|
|
||||||
/** Play a note for length ms.
|
|
||||||
*
|
|
||||||
* If length is negative, play until told to stop.
|
|
||||||
*/
|
|
||||||
void play(WaveForm wave, int freq, int32 length);
|
|
||||||
/** Stop the currently playing note after delay ms. */
|
|
||||||
void stop(int32 delay = 0);
|
|
||||||
/** Adjust the volume. */
|
|
||||||
void setVolume(byte volume);
|
|
||||||
|
|
||||||
bool isPlaying() const;
|
|
||||||
|
|
||||||
int readBuffer(int16 *buffer, const int numSamples);
|
|
||||||
|
|
||||||
bool isStereo() const { return false; }
|
|
||||||
bool endOfData() const { return false; }
|
|
||||||
bool endOfStream() const { return false; }
|
|
||||||
int getRate() const { return _rate; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Common::Mutex _mutex;
|
|
||||||
|
|
||||||
int _rate;
|
|
||||||
WaveForm _wave;
|
|
||||||
bool _playForever;
|
|
||||||
uint32 _oscLength;
|
|
||||||
uint32 _oscSamples;
|
|
||||||
uint32 _remainingSamples;
|
|
||||||
uint32 _mixedSamples;
|
|
||||||
byte _volume;
|
|
||||||
|
|
||||||
typedef int8 (*generatorFunc)(uint32, uint32);
|
|
||||||
static const generatorFunc generateWave[];
|
|
||||||
|
|
||||||
static int8 generateSquare(uint32 x, uint32 oscLength);
|
|
||||||
static int8 generateSine(uint32 x, uint32 oscLength);
|
|
||||||
static int8 generateSaw(uint32 x, uint32 oscLength);
|
|
||||||
static int8 generateTriangle(uint32 x, uint32 oscLength);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // End of namespace Audio
|
|
||||||
|
|
||||||
#endif // SOUND_SOFTSYNTH_PCSPEAKER_H
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,345 +0,0 @@
|
||||||
/* 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 2
|
|
||||||
* 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, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is based on reSID, a MOS6581 SID emulator engine.
|
|
||||||
* Copyright (C) 2004 Dag Lem <resid@nimrod.no>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __SID_H__
|
|
||||||
#define __SID_H__
|
|
||||||
|
|
||||||
// Inlining on/off.
|
|
||||||
#define RESID_INLINE inline
|
|
||||||
|
|
||||||
namespace Resid {
|
|
||||||
|
|
||||||
// We could have used the smallest possible data type for each SID register,
|
|
||||||
// however this would give a slower engine because of data type conversions.
|
|
||||||
// An int is assumed to be at least 32 bits (necessary in the types reg24,
|
|
||||||
// cycle_count, and sound_sample). GNU does not support 16-bit machines
|
|
||||||
// (GNU Coding Standards: Portability between CPUs), so this should be
|
|
||||||
// a valid assumption.
|
|
||||||
|
|
||||||
typedef unsigned int reg4;
|
|
||||||
typedef unsigned int reg8;
|
|
||||||
typedef unsigned int reg12;
|
|
||||||
typedef unsigned int reg16;
|
|
||||||
typedef unsigned int reg24;
|
|
||||||
|
|
||||||
typedef int cycle_count;
|
|
||||||
typedef int sound_sample;
|
|
||||||
typedef sound_sample fc_point[2];
|
|
||||||
|
|
||||||
|
|
||||||
class WaveformGenerator {
|
|
||||||
public:
|
|
||||||
WaveformGenerator();
|
|
||||||
|
|
||||||
void set_sync_source(WaveformGenerator*);
|
|
||||||
|
|
||||||
void updateClock(cycle_count delta_t);
|
|
||||||
void synchronize();
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
void writeFREQ_LO(reg8);
|
|
||||||
void writeFREQ_HI(reg8);
|
|
||||||
void writePW_LO(reg8);
|
|
||||||
void writePW_HI(reg8);
|
|
||||||
void writeCONTROL_REG(reg8);
|
|
||||||
reg8 readOSC();
|
|
||||||
|
|
||||||
// 12-bit waveform output.
|
|
||||||
reg12 output();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const WaveformGenerator* sync_source;
|
|
||||||
WaveformGenerator* sync_dest;
|
|
||||||
|
|
||||||
// Tell whether the accumulator MSB was set high on this cycle.
|
|
||||||
bool msb_rising;
|
|
||||||
|
|
||||||
reg24 accumulator;
|
|
||||||
reg24 shift_register;
|
|
||||||
|
|
||||||
// Fout = (Fn*Fclk/16777216)Hz
|
|
||||||
reg16 freq;
|
|
||||||
// PWout = (PWn/40.95)%
|
|
||||||
reg12 pw;
|
|
||||||
|
|
||||||
// The control register right-shifted 4 bits; used for output function
|
|
||||||
// table lookup.
|
|
||||||
reg8 waveform;
|
|
||||||
|
|
||||||
// The remaining control register bits.
|
|
||||||
reg8 test;
|
|
||||||
reg8 ring_mod;
|
|
||||||
reg8 sync;
|
|
||||||
// The gate bit is handled by the EnvelopeGenerator.
|
|
||||||
|
|
||||||
// 16 possible combinations of waveforms.
|
|
||||||
reg12 output____();
|
|
||||||
reg12 output___T();
|
|
||||||
reg12 output__S_();
|
|
||||||
reg12 output__ST();
|
|
||||||
reg12 output_P__();
|
|
||||||
reg12 output_P_T();
|
|
||||||
reg12 output_PS_();
|
|
||||||
reg12 output_PST();
|
|
||||||
reg12 outputN___();
|
|
||||||
reg12 outputN__T();
|
|
||||||
reg12 outputN_S_();
|
|
||||||
reg12 outputN_ST();
|
|
||||||
reg12 outputNP__();
|
|
||||||
reg12 outputNP_T();
|
|
||||||
reg12 outputNPS_();
|
|
||||||
reg12 outputNPST();
|
|
||||||
|
|
||||||
// Sample data for combinations of waveforms.
|
|
||||||
static const reg8 wave6581__ST[];
|
|
||||||
static const reg8 wave6581_P_T[];
|
|
||||||
static const reg8 wave6581_PS_[];
|
|
||||||
static const reg8 wave6581_PST[];
|
|
||||||
|
|
||||||
friend class Voice;
|
|
||||||
friend class SID;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Filter {
|
|
||||||
public:
|
|
||||||
Filter();
|
|
||||||
|
|
||||||
void enable_filter(bool enable);
|
|
||||||
|
|
||||||
void updateClock(cycle_count delta_t,
|
|
||||||
sound_sample voice1, sound_sample voice2, sound_sample voice3);
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
// Write registers.
|
|
||||||
void writeFC_LO(reg8);
|
|
||||||
void writeFC_HI(reg8);
|
|
||||||
void writeRES_FILT(reg8);
|
|
||||||
void writeMODE_VOL(reg8);
|
|
||||||
|
|
||||||
// SID audio output (16 bits).
|
|
||||||
sound_sample output();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void set_w0();
|
|
||||||
void set_Q();
|
|
||||||
|
|
||||||
// Filter enabled.
|
|
||||||
bool enabled;
|
|
||||||
|
|
||||||
// Filter cutoff frequency.
|
|
||||||
reg12 fc;
|
|
||||||
|
|
||||||
// Filter resonance.
|
|
||||||
reg8 res;
|
|
||||||
|
|
||||||
// Selects which inputs to route through filter.
|
|
||||||
reg8 filt;
|
|
||||||
|
|
||||||
// Switch voice 3 off.
|
|
||||||
reg8 voice3off;
|
|
||||||
|
|
||||||
// Highpass, bandpass, and lowpass filter modes.
|
|
||||||
reg8 hp_bp_lp;
|
|
||||||
|
|
||||||
// Output master volume.
|
|
||||||
reg4 vol;
|
|
||||||
|
|
||||||
// Mixer DC offset.
|
|
||||||
sound_sample mixer_DC;
|
|
||||||
|
|
||||||
// State of filter.
|
|
||||||
sound_sample Vhp; // highpass
|
|
||||||
sound_sample Vbp; // bandpass
|
|
||||||
sound_sample Vlp; // lowpass
|
|
||||||
sound_sample Vnf; // not filtered
|
|
||||||
|
|
||||||
// Cutoff frequency, resonance.
|
|
||||||
sound_sample w0, w0_ceil_1, w0_ceil_dt;
|
|
||||||
sound_sample _1024_div_Q;
|
|
||||||
|
|
||||||
// Cutoff frequency tables.
|
|
||||||
// FC is an 11 bit register.
|
|
||||||
sound_sample f0_6581[2048];
|
|
||||||
sound_sample* f0;
|
|
||||||
static fc_point f0_points_6581[];
|
|
||||||
fc_point* f0_points;
|
|
||||||
int f0_count;
|
|
||||||
|
|
||||||
friend class SID;
|
|
||||||
};
|
|
||||||
|
|
||||||
class EnvelopeGenerator {
|
|
||||||
public:
|
|
||||||
EnvelopeGenerator();
|
|
||||||
|
|
||||||
enum State { ATTACK, DECAY_SUSTAIN, RELEASE };
|
|
||||||
|
|
||||||
void updateClock(cycle_count delta_t);
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
void writeCONTROL_REG(reg8);
|
|
||||||
void writeATTACK_DECAY(reg8);
|
|
||||||
void writeSUSTAIN_RELEASE(reg8);
|
|
||||||
reg8 readENV();
|
|
||||||
|
|
||||||
// 8-bit envelope output.
|
|
||||||
reg8 output();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
reg16 rate_counter;
|
|
||||||
reg16 rate_period;
|
|
||||||
reg8 exponential_counter;
|
|
||||||
reg8 exponential_counter_period;
|
|
||||||
reg8 envelope_counter;
|
|
||||||
bool hold_zero;
|
|
||||||
|
|
||||||
reg4 attack;
|
|
||||||
reg4 decay;
|
|
||||||
reg4 sustain;
|
|
||||||
reg4 release;
|
|
||||||
|
|
||||||
reg8 gate;
|
|
||||||
|
|
||||||
State state;
|
|
||||||
|
|
||||||
// Lookup table to convert from attack, decay, or release value to rate
|
|
||||||
// counter period.
|
|
||||||
static reg16 rate_counter_period[];
|
|
||||||
|
|
||||||
// The 16 selectable sustain levels.
|
|
||||||
static reg8 sustain_level[];
|
|
||||||
|
|
||||||
friend class SID;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ExternalFilter {
|
|
||||||
public:
|
|
||||||
ExternalFilter();
|
|
||||||
|
|
||||||
void enable_filter(bool enable);
|
|
||||||
void set_sampling_parameter(double pass_freq);
|
|
||||||
|
|
||||||
void updateClock(cycle_count delta_t, sound_sample Vi);
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
// Audio output (20 bits).
|
|
||||||
sound_sample output();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// Filter enabled.
|
|
||||||
bool enabled;
|
|
||||||
|
|
||||||
// Maximum mixer DC offset.
|
|
||||||
sound_sample mixer_DC;
|
|
||||||
|
|
||||||
// State of filters.
|
|
||||||
sound_sample Vlp; // lowpass
|
|
||||||
sound_sample Vhp; // highpass
|
|
||||||
sound_sample Vo;
|
|
||||||
|
|
||||||
// Cutoff frequencies.
|
|
||||||
sound_sample w0lp;
|
|
||||||
sound_sample w0hp;
|
|
||||||
|
|
||||||
friend class SID;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Voice {
|
|
||||||
public:
|
|
||||||
Voice();
|
|
||||||
|
|
||||||
void set_sync_source(Voice*);
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
void writeCONTROL_REG(reg8);
|
|
||||||
|
|
||||||
// Amplitude modulated waveform output.
|
|
||||||
// Range [-2048*255, 2047*255].
|
|
||||||
sound_sample output() {
|
|
||||||
// Multiply oscillator output with envelope output.
|
|
||||||
return (wave.output() - wave_zero)*envelope.output() + voice_DC;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
WaveformGenerator wave;
|
|
||||||
EnvelopeGenerator envelope;
|
|
||||||
|
|
||||||
// Waveform D/A zero level.
|
|
||||||
sound_sample wave_zero;
|
|
||||||
|
|
||||||
// Multiplying D/A DC offset.
|
|
||||||
sound_sample voice_DC;
|
|
||||||
|
|
||||||
friend class SID;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class SID {
|
|
||||||
public:
|
|
||||||
SID();
|
|
||||||
~SID();
|
|
||||||
|
|
||||||
void enable_filter(bool enable);
|
|
||||||
void enable_external_filter(bool enable);
|
|
||||||
bool set_sampling_parameters(double clock_freq,
|
|
||||||
double sample_freq, double pass_freq = -1,
|
|
||||||
double filter_scale = 0.97);
|
|
||||||
|
|
||||||
void updateClock(cycle_count delta_t);
|
|
||||||
int updateClock(cycle_count& delta_t, short* buf, int n, int interleave = 1);
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
// Read/write registers.
|
|
||||||
reg8 read(reg8 offset);
|
|
||||||
void write(reg8 offset, reg8 value);
|
|
||||||
|
|
||||||
// 16-bit output (AUDIO OUT).
|
|
||||||
int output();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Voice voice[3];
|
|
||||||
Filter filter;
|
|
||||||
ExternalFilter extfilt;
|
|
||||||
|
|
||||||
reg8 bus_value;
|
|
||||||
cycle_count bus_value_ttl;
|
|
||||||
|
|
||||||
double clock_frequency;
|
|
||||||
|
|
||||||
// Fixpoint constants.
|
|
||||||
static const int FIXP_SHIFT;
|
|
||||||
static const int FIXP_MASK;
|
|
||||||
|
|
||||||
// Sampling variables.
|
|
||||||
cycle_count cycles_per_sample;
|
|
||||||
cycle_count sample_offset;
|
|
||||||
short sample_prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // not __SID_H__
|
|
File diff suppressed because it is too large
Load diff
|
@ -126,11 +126,11 @@ public:
|
||||||
LINK_PLUGIN(EAS)
|
LINK_PLUGIN(EAS)
|
||||||
#endif
|
#endif
|
||||||
LINK_PLUGIN(ADLIB)
|
LINK_PLUGIN(ADLIB)
|
||||||
LINK_PLUGIN(PCSPK)
|
// LINK_PLUGIN(PCSPK)
|
||||||
LINK_PLUGIN(PCJR)
|
// LINK_PLUGIN(PCJR)
|
||||||
LINK_PLUGIN(CMS)
|
LINK_PLUGIN(CMS)
|
||||||
#ifndef DISABLE_SID
|
#ifndef DISABLE_SID
|
||||||
LINK_PLUGIN(C64)
|
// LINK_PLUGIN(C64)
|
||||||
#endif
|
#endif
|
||||||
// LINK_PLUGIN(AMIGA)
|
// LINK_PLUGIN(AMIGA)
|
||||||
// LINK_PLUGIN(APPLEIIGS)
|
// LINK_PLUGIN(APPLEIIGS)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue