2
0
Fork 0

Basic project setup.

This commit is contained in:
bruce 2013-09-04 21:37:36 +08:00
commit d7e1629618
22 changed files with 3740 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
Builds
JuceLibraryCode

65
JuceOPLVSTi.jucer Normal file
View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<JUCERPROJECT id="wUKQiT" name="JuceOPLVSTi" projectType="audioplug" version="1.0.0"
bundleIdentifier="com.plainweave.JuceOPLVSTi" buildVST="1" buildAU="1"
pluginName="JuceOPLVSTi" pluginDesc="JuceOPLVSTi" pluginManufacturer="Plainweave Software"
pluginManufacturerCode="Manu" pluginCode="Plug" pluginChannelConfigs="{0, 1}"
pluginIsSynth="1" pluginWantsMidiIn="1" pluginProducesMidiOut="0"
pluginSilenceInIsSilenceOut="0" pluginEditorRequiresKeys="0"
pluginAUExportPrefix="JuceOPLVSTiAU" pluginRTASCategory="" aaxIdentifier="com.yourcompany.JuceOPLVSTi"
pluginAAXCategory="AAX_ePlugInCategory_Dynamics" jucerVersion="3.1.0">
<MAINGROUP id="TOefyq" name="JuceOPLVSTi">
<GROUP id="{DCA755EB-7953-0641-E719-95C7850E5B2B}" name="Source">
<FILE id="BZFxoj" name="adlib.h" compile="0" resource="0" file="Source/adlib.h"/>
<FILE id="c6G4EF" name="config.h" compile="0" resource="0" file="Source/config.h"/>
<FILE id="TnpE3r" name="dbopl.cpp" compile="1" resource="0" file="Source/dbopl.cpp"/>
<FILE id="r3zBZz" name="dbopl.h" compile="0" resource="0" file="Source/dbopl.h"/>
<FILE id="pXX3j1" name="dosbox.h" compile="0" resource="0" file="Source/dosbox.h"/>
<FILE id="TLHYVa" name="hardware.h" compile="0" resource="0" file="Source/hardware.h"/>
<FILE id="fZWteg" name="hiopl.cpp" compile="1" resource="0" file="Source/hiopl.cpp"/>
<FILE id="OiMwKI" name="hiopl.h" compile="0" resource="0" file="Source/hiopl.h"/>
<FILE id="mZbr8b" name="inout.h" compile="0" resource="0" file="Source/inout.h"/>
<FILE id="ZBjR5F" name="logging.h" compile="0" resource="0" file="Source/logging.h"/>
<FILE id="aR7Eu7" name="mixer.h" compile="0" resource="0" file="Source/mixer.h"/>
<FILE id="KCyK6B" name="opl.h" compile="0" resource="0" file="Source/opl.h"/>
<FILE id="t6cmDm" name="pic.h" compile="0" resource="0" file="Source/pic.h"/>
<FILE id="Phxzxb" name="PluginProcessor.cpp" compile="1" resource="0"
file="Source/PluginProcessor.cpp"/>
<FILE id="IvGocs" name="PluginProcessor.h" compile="0" resource="0"
file="Source/PluginProcessor.h"/>
<FILE id="PUM7RE" name="PluginEditor.cpp" compile="1" resource="0"
file="Source/PluginEditor.cpp"/>
<FILE id="jHO5FF" name="PluginEditor.h" compile="0" resource="0" file="Source/PluginEditor.h"/>
<FILE id="ep2XEF" name="setup.h" compile="0" resource="0" file="Source/setup.h"/>
</GROUP>
</MAINGROUP>
<MODULES>
<MODULE id="juce_core" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_events" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_graphics" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_data_structures" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_gui_basics" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_gui_extra" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_gui_audio" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_cryptography" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_video" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_opengl" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_audio_basics" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_audio_devices" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_audio_formats" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_audio_processors" showAllCode="1" useLocalCopy="1"/>
<MODULE id="juce_audio_plugin_client" showAllCode="1" useLocalCopy="1"/>
</MODULES>
<JUCEOPTIONS JUCE_QUICKTIME="disabled"/>
<EXPORTFORMATS>
<VS2012 targetFolder="Builds/VisualStudio2012" juceFolder="..\..\..\..\Users\bruce\Documents\juce\modules"
vstFolder="c:\SDKs\vstsdk2.4">
<CONFIGURATIONS>
<CONFIGURATION name="Debug" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
isDebug="1" optimisation="1" targetName="JuceOPLVSTi"/>
<CONFIGURATION name="Release" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
isDebug="0" optimisation="2" targetName="JuceOPLVSTi"/>
</CONFIGURATIONS>
</VS2012>
</EXPORTFORMATS>
</JUCERPROJECT>

181
Source/OplGui.cpp Normal file
View file

@ -0,0 +1,181 @@
/*
==============================================================================
This is an automatically generated GUI class created by the Introjucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Introjucer version: 3.1.0
------------------------------------------------------------------------------
The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-13 by Raw Material Software Ltd.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
//[/Headers]
#include "OplGui.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
NewComponent::NewComponent ()
{
addAndMakeVisible (label = new Label ("new label",
"Carrier waveform"));
label->setFont (Font (15.00f, Font::plain));
label->setJustificationType (Justification::centredLeft);
label->setEditable (false, false, false);
label->setColour (TextEditor::textColourId, Colours::black);
label->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
addAndMakeVisible (wav_car_sin = new ToggleButton ("new toggle button"));
wav_car_sin->setButtonText ("Sine");
wav_car_sin->addListener (this);
addAndMakeVisible (toggleButton2 = new ToggleButton ("new toggle button"));
toggleButton2->setButtonText ("Half Sine");
toggleButton2->addListener (this);
addAndMakeVisible (toggleButton3 = new ToggleButton ("new toggle button"));
toggleButton3->setButtonText ("Abs Sine");
toggleButton3->addListener (this);
addAndMakeVisible (toggleButton4 = new ToggleButton ("new toggle button"));
toggleButton4->setButtonText ("Quarter Sine");
toggleButton4->addListener (this);
//[UserPreSize]
//[/UserPreSize]
setSize (600, 400);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
NewComponent::~NewComponent()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
label = nullptr;
wav_car_sin = nullptr;
toggleButton2 = nullptr;
toggleButton3 = nullptr;
toggleButton4 = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void NewComponent::paint (Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]
g.fillAll (Colours::white);
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
void NewComponent::resized()
{
label->setBounds (8, 8, 150, 24);
wav_car_sin->setBounds (152, 8, 150, 24);
toggleButton2->setBounds (152, 32, 150, 24);
toggleButton3->setBounds (152, 56, 150, 24);
toggleButton4->setBounds (152, 80, 150, 24);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void NewComponent::buttonClicked (Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
//[/UserbuttonClicked_Pre]
if (buttonThatWasClicked == wav_car_sin)
{
//[UserButtonCode_wav_car_sin] -- add your button handler code here..
//[/UserButtonCode_wav_car_sin]
}
else if (buttonThatWasClicked == toggleButton2)
{
//[UserButtonCode_toggleButton2] -- add your button handler code here..
//[/UserButtonCode_toggleButton2]
}
else if (buttonThatWasClicked == toggleButton3)
{
//[UserButtonCode_toggleButton3] -- add your button handler code here..
//[/UserButtonCode_toggleButton3]
}
else if (buttonThatWasClicked == toggleButton4)
{
//[UserButtonCode_toggleButton4] -- add your button handler code here..
//[/UserButtonCode_toggleButton4]
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
//[/MiscUserCode]
//==============================================================================
#if 0
/* -- Introjucer information section --
This is where the Introjucer stores the metadata that describe this GUI layout, so
make changes in here at your peril!
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Component" className="NewComponent" componentName=""
parentClasses="public Component" constructorParams="" variableInitialisers=""
snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.33"
fixedSize="0" initialWidth="600" initialHeight="400">
<BACKGROUND backgroundColour="ffffffff"/>
<LABEL name="new label" id="40d227ec2225494a" memberName="label" virtualName=""
explicitFocusOrder="0" pos="8 8 150 24" edTextCol="ff000000"
edBkgCol="0" labelText="Carrier waveform" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="15" bold="0" italic="0" justification="33"/>
<TOGGLEBUTTON name="new toggle button" id="bfb505f78994ec5d" memberName="wav_car_sin"
virtualName="" explicitFocusOrder="0" pos="152 8 150 24" buttonText="Sine"
connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/>
<TOGGLEBUTTON name="new toggle button" id="f565d4caaf1be1c8" memberName="toggleButton2"
virtualName="" explicitFocusOrder="0" pos="152 32 150 24" buttonText="Half Sine"
connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/>
<TOGGLEBUTTON name="new toggle button" id="c8242ddebab8a74f" memberName="toggleButton3"
virtualName="" explicitFocusOrder="0" pos="152 56 150 24" buttonText="Abs Sine"
connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/>
<TOGGLEBUTTON name="new toggle button" id="86bf0db3d1bd0f34" memberName="toggleButton4"
virtualName="" explicitFocusOrder="0" pos="152 80 150 24" buttonText="Quarter Sine"
connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//[EndFile] You can add extra defines here...
//[/EndFile]

74
Source/OplGui.h Normal file
View file

@ -0,0 +1,74 @@
/*
==============================================================================
This is an automatically generated GUI class created by the Introjucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Introjucer version: 3.1.0
------------------------------------------------------------------------------
The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-13 by Raw Material Software Ltd.
==============================================================================
*/
#ifndef __JUCE_HEADER_A8B78202A92195B5__
#define __JUCE_HEADER_A8B78202A92195B5__
//[Headers] -- You can add your own extra header files here --
#include "JuceHeader.h"
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Introjucer.
Describe your class and how it works here!
//[/Comments]
*/
class NewComponent : public Component,
public ButtonListener
{
public:
//==============================================================================
NewComponent ();
~NewComponent();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
//[/UserMethods]
void paint (Graphics& g);
void resized();
void buttonClicked (Button* buttonThatWasClicked);
private:
//[UserVariables] -- You can add your own custom variables in this section.
//[/UserVariables]
//==============================================================================
ScopedPointer<Label> label;
ScopedPointer<ToggleButton> wav_car_sin;
ScopedPointer<ToggleButton> toggleButton2;
ScopedPointer<ToggleButton> toggleButton3;
ScopedPointer<ToggleButton> toggleButton4;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NewComponent)
};
//[EndFile] You can add extra defines here...
//[/EndFile]
#endif // __JUCE_HEADER_A8B78202A92195B5__

36
Source/PluginEditor.cpp Normal file
View file

@ -0,0 +1,36 @@
/*
==============================================================================
This file was auto-generated by the Introjucer!
It contains the basic startup code for a Juce application.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
//==============================================================================
JuceOplvstiAudioProcessorEditor::JuceOplvstiAudioProcessorEditor (JuceOplvstiAudioProcessor* ownerFilter)
: AudioProcessorEditor (ownerFilter)
{
// This is where our plugin's editor size is set.
setSize (400, 300);
}
JuceOplvstiAudioProcessorEditor::~JuceOplvstiAudioProcessorEditor()
{
}
//==============================================================================
void JuceOplvstiAudioProcessorEditor::paint (Graphics& g)
{
g.fillAll (Colours::white);
g.setColour (Colours::black);
g.setFont (15.0f);
g.drawFittedText ("Hello World!",
0, 0, getWidth(), getHeight(),
Justification::centred, 1);
}

33
Source/PluginEditor.h Normal file
View file

@ -0,0 +1,33 @@
/*
==============================================================================
This file was auto-generated by the Introjucer!
It contains the basic startup code for a Juce application.
==============================================================================
*/
#ifndef PLUGINEDITOR_H_INCLUDED
#define PLUGINEDITOR_H_INCLUDED
#include "../JuceLibraryCode/JuceHeader.h"
#include "PluginProcessor.h"
//==============================================================================
/**
*/
class JuceOplvstiAudioProcessorEditor : public AudioProcessorEditor
{
public:
JuceOplvstiAudioProcessorEditor (JuceOplvstiAudioProcessor* ownerFilter);
~JuceOplvstiAudioProcessorEditor();
//==============================================================================
// This is just a standard Juce paint method...
void paint (Graphics& g);
};
#endif // PLUGINEDITOR_H_INCLUDED

191
Source/PluginProcessor.cpp Normal file
View file

@ -0,0 +1,191 @@
/*
==============================================================================
This file was auto-generated!
It contains the basic startup code for a Juce application.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
#include "hiopl.h"
//==============================================================================
JuceOplvstiAudioProcessor::JuceOplvstiAudioProcessor()
{
Opl = new Hiopl(buflen);
Opl->SetSampleRate(SAMPLE_RATE);
}
JuceOplvstiAudioProcessor::~JuceOplvstiAudioProcessor()
{
}
//==============================================================================
const String JuceOplvstiAudioProcessor::getName() const
{
return JucePlugin_Name;
}
int JuceOplvstiAudioProcessor::getNumParameters()
{
return 0;
}
float JuceOplvstiAudioProcessor::getParameter (int index)
{
return 0.0f;
}
void JuceOplvstiAudioProcessor::setParameter (int index, float newValue)
{
}
const String JuceOplvstiAudioProcessor::getParameterName (int index)
{
return String::empty;
}
const String JuceOplvstiAudioProcessor::getParameterText (int index)
{
return String::empty;
}
const String JuceOplvstiAudioProcessor::getInputChannelName (int channelIndex) const
{
return String (channelIndex + 1);
}
const String JuceOplvstiAudioProcessor::getOutputChannelName (int channelIndex) const
{
return String (channelIndex + 1);
}
bool JuceOplvstiAudioProcessor::isInputChannelStereoPair (int index) const
{
return true;
}
bool JuceOplvstiAudioProcessor::isOutputChannelStereoPair (int index) const
{
return true;
}
bool JuceOplvstiAudioProcessor::acceptsMidi() const
{
#if JucePlugin_WantsMidiInput
return true;
#else
return false;
#endif
}
bool JuceOplvstiAudioProcessor::producesMidi() const
{
#if JucePlugin_ProducesMidiOutput
return true;
#else
return false;
#endif
}
bool JuceOplvstiAudioProcessor::silenceInProducesSilenceOut() const
{
return false;
}
double JuceOplvstiAudioProcessor::getTailLengthSeconds() const
{
return 0.0;
}
int JuceOplvstiAudioProcessor::getNumPrograms()
{
return 0;
}
int JuceOplvstiAudioProcessor::getCurrentProgram()
{
return 0;
}
void JuceOplvstiAudioProcessor::setCurrentProgram (int index)
{
}
const String JuceOplvstiAudioProcessor::getProgramName (int index)
{
return String::empty;
}
void JuceOplvstiAudioProcessor::changeProgramName (int index, const String& newName)
{
}
//==============================================================================
void JuceOplvstiAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
// Use this method as the place to do any pre-playback
// initialisation that you need..
}
void JuceOplvstiAudioProcessor::releaseResources()
{
// When playback stops, you can use this as an opportunity to free up any
// spare memory, etc.
}
void JuceOplvstiAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
// This is the place where you'd normally do the guts of your plugin's
// audio processing...
for (int channel = 0; channel < getNumInputChannels(); ++channel)
{
float* channelData = buffer.getSampleData (channel);
// ..do something to the data...
}
// In case we have more outputs than inputs, we'll clear any output
// channels that didn't contain input data, (because these aren't
// guaranteed to be empty - they may contain garbage).
for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
{
buffer.clear (i, 0, buffer.getNumSamples());
}
}
//==============================================================================
bool JuceOplvstiAudioProcessor::hasEditor() const
{
return true; // (change this to false if you choose to not supply an editor)
}
AudioProcessorEditor* JuceOplvstiAudioProcessor::createEditor()
{
return new JuceOplvstiAudioProcessorEditor (this);
}
//==============================================================================
void JuceOplvstiAudioProcessor::getStateInformation (MemoryBlock& destData)
{
// You should use this method to store your parameters in the memory block.
// You could do that either as raw data, or use the XML or ValueTree classes
// as intermediaries to make it easy to save and load complex data.
}
void JuceOplvstiAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
// You should use this method to restore your parameters from this memory block,
// whose contents will have been created by the getStateInformation() call.
}
//==============================================================================
// This creates new instances of the plugin..
AudioProcessor* JUCE_CALLTYPE createPluginFilter()
{
return new JuceOplvstiAudioProcessor();
}

74
Source/PluginProcessor.h Normal file
View file

@ -0,0 +1,74 @@
/*
==============================================================================
This file was auto-generated!
It contains the basic startup code for a Juce application.
==============================================================================
*/
#ifndef PLUGINPROCESSOR_H_INCLUDED
#define PLUGINPROCESSOR_H_INCLUDED
#include "../JuceLibraryCode/JuceHeader.h"
//==============================================================================
/**
*/
class JuceOplvstiAudioProcessor : public AudioProcessor
{
public:
//==============================================================================
JuceOplvstiAudioProcessor();
~JuceOplvstiAudioProcessor();
//==============================================================================
void prepareToPlay (double sampleRate, int samplesPerBlock);
void releaseResources();
void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
//==============================================================================
AudioProcessorEditor* createEditor();
bool hasEditor() const;
//==============================================================================
const String getName() const;
int getNumParameters();
float getParameter (int index);
void setParameter (int index, float newValue);
const String getParameterName (int index);
const String getParameterText (int index);
const String getInputChannelName (int channelIndex) const;
const String getOutputChannelName (int channelIndex) const;
bool isInputChannelStereoPair (int index) const;
bool isOutputChannelStereoPair (int index) const;
bool acceptsMidi() const;
bool producesMidi() const;
bool silenceInProducesSilenceOut() const;
double getTailLengthSeconds() const;
//==============================================================================
int getNumPrograms();
int getCurrentProgram();
void setCurrentProgram (int index);
const String getProgramName (int index);
void changeProgramName (int index, const String& newName);
//==============================================================================
void getStateInformation (MemoryBlock& destData);
void setStateInformation (const void* data, int sizeInBytes);
private:
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceOplvstiAudioProcessor)
};
#endif // PLUGINPROCESSOR_H_INCLUDED

153
Source/adlib.h Normal file
View file

@ -0,0 +1,153 @@
/*
* Copyright (C) 2002-2010 The DOSBox Team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: adlib.h,v 1.5 2009-04-28 21:45:43 c2woody Exp $ */
#ifndef DOSBOX_ADLIB_H
#define DOSBOX_ADLIB_H
#include "dosbox.h"
#include "mixer.h"
#include "inout.h"
#include "setup.h"
#include "pic.h"
#include "hardware.h"
namespace Adlib {
struct Timer {
double start;
double delay;
bool enabled, overflow, masked;
Bit8u counter;
Timer() {
masked = false;
overflow = false;
enabled = false;
counter = 0;
delay = 0;
}
//Call update before making any further changes
void Update( double time ) {
if ( !enabled || !delay )
return;
double deltaStart = time - start;
//Only set the overflow flag when not masked
if ( deltaStart >= 0 && !masked ) {
overflow = 1;
}
}
//On a reset make sure the start is in sync with the next cycle
void Reset(const double& time ) {
overflow = false;
if ( !delay || !enabled )
return;
double delta = (time - start);
double rem = fmod( delta, delay );
double next = delay - rem;
start = time + next;
}
void Stop( ) {
enabled = false;
}
void Start( const double& time, Bits scale ) {
//Don't enable again
if ( enabled ) {
return;
}
enabled = true;
delay = 0.001 * (256 - counter ) * scale;
start = time + delay;
}
};
struct Chip {
//Last selected register
Timer timer[2];
//Check for it being a write to the timer
bool Write( Bit32u addr, Bit8u val );
//Read the current timer state, will use current double
Bit8u Read( );
};
//The type of handler this is
typedef enum {
MODE_OPL2,
MODE_DUALOPL2,
MODE_OPL3
} Mode;
class Handler {
public:
//Write an address to a chip, returns the address the chip sets
virtual Bit32u WriteAddr( Bit32u port, Bit8u val ) = 0;
//Write to a specific register in the chip
virtual void WriteReg( Bit32u addr, Bit8u val ) = 0;
//Generate a certain amount of samples
virtual void Generate( Bitu samples, Bit32s *buffer ) = 0;
//Initialize at a specific sample rate and mode
virtual void Init( Bitu rate ) = 0;
virtual ~Handler() {
}
};
//The cache for 2 chips or an opl3
typedef Bit8u RegisterCache[512];
//Internal class used for dro capturing
class Capture;
class Module: public Module_base {
IO_ReadHandleObject ReadHandler[3];
IO_WriteHandleObject WriteHandler[3];
MixerObject mixerObject;
//Mode we're running in
Mode mode;
//Last selected address in the chip for the different modes
union {
Bit32u normal;
Bit8u dual[2];
} reg;
void CacheWrite( Bit32u reg, Bit8u val );
void DualWrite( Bit8u index, Bit8u reg, Bit8u val );
public:
static OPL_Mode oplmode;
MixerChannel* mixerChan;
Bit32u lastUsed; //Ticks when adlib was last used to turn of mixing after a few second
Handler* handler; //Handler that will generate the sound
RegisterCache cache;
Capture* capture;
Chip chip[2];
//Handle port writes
void PortWrite( Bitu port, Bitu val, Bitu iolen );
Bitu PortRead( Bitu port, Bitu iolen );
void Init( Mode m );
Module( Section* configuration);
~Module();
};
} //Adlib namespace
#endif

78
Source/config.h Normal file
View file

@ -0,0 +1,78 @@
#define VERSION "0.74"
/* Define to 1 to enable internal debugger, requires libcurses */
#define C_DEBUG 0
/* Define to 1 to enable screenshots, requires libpng */
#define C_SSHOT 1
/* Define to 1 to use opengl display output support */
#define C_OPENGL 1
/* Define to 1 to enable internal modem support, requires SDL_net */
#define C_MODEM 1
/* Define to 1 to enable IPX networking support, requires SDL_net */
#define C_IPX 1
/* Enable some heavy debugging options */
#define C_HEAVY_DEBUG 0
/* The type of cpu this host has */
#define C_TARGETCPU X86
//#define C_TARGETCPU X86_64
/* Define to 1 to use x86 dynamic cpu core */
#define C_DYNAMIC_X86 1
/* Define to 1 to use recompiling cpu core. Can not be used together with the dynamic-x86 core */
#define C_DYNREC 0
/* Enable memory function inlining in */
#define C_CORE_INLINE 0
/* Enable the FPU module, still only for beta testing */
#define C_FPU 1
/* Define to 1 to use a x86 assembly fpu core */
#define C_FPU_X86 1
/* Define to 1 to use a unaligned memory access */
#define C_UNALIGNED_MEMORY 1
/* environ is defined */
#define ENVIRON_INCLUDED 1
/* environ can be linked */
#define ENVIRON_LINKED 1
/* Define to 1 if you have the <ddraw.h> header file. */
#define HAVE_DDRAW_H 1
/* Define to 1 if you want serial passthrough support (Win32 only). */
#define C_DIRECTSERIAL 1
#define GCC_ATTRIBUTE(x) /* attribute not supported */
#define GCC_UNLIKELY(x) (x)
#define GCC_LIKELY(x) (x)
#define INLINE __forceinline
#define DB_FASTCALL __fastcall
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#pragma warning(disable : 4996)
#endif
typedef double Real64;
/* The internal types */
typedef unsigned char Bit8u;
typedef signed char Bit8s;
typedef unsigned short Bit16u;
typedef signed short Bit16s;
typedef unsigned long Bit32u;
typedef signed long Bit32s;
typedef unsigned __int64 Bit64u;
typedef signed __int64 Bit64s;
typedef unsigned int Bitu;
typedef signed int Bits;

1526
Source/dbopl.cpp Normal file

File diff suppressed because it is too large Load diff

257
Source/dbopl.h Normal file
View file

@ -0,0 +1,257 @@
/*
* Copyright (C) 2002-2010 The DOSBox Team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "adlib.h"
#include "dosbox.h"
//Use 8 handlers based on a small logatirmic wavetabe and an exponential table for volume
#define WAVE_HANDLER 10
//Use a logarithmic wavetable with an exponential table for volume
#define WAVE_TABLELOG 11
//Use a linear wavetable with a multiply table for volume
#define WAVE_TABLEMUL 12
//Select the type of wave generator routine
#define DBOPL_WAVE WAVE_TABLEMUL
namespace DBOPL {
struct Chip;
struct Operator;
struct Channel;
#if (DBOPL_WAVE == WAVE_HANDLER)
typedef Bits ( DB_FASTCALL *WaveHandler) ( Bitu i, Bitu volume );
#endif
typedef Bits ( DBOPL::Operator::*VolumeHandler) ( );
typedef Channel* ( DBOPL::Channel::*SynthHandler) ( Chip* chip, Bit32u samples, Bit32s* output );
//Different synth modes that can generate blocks of data
typedef enum {
sm2AM,
sm2FM,
sm3AM,
sm3FM,
sm4Start,
sm3FMFM,
sm3AMFM,
sm3FMAM,
sm3AMAM,
sm6Start,
sm2Percussion,
sm3Percussion,
} SynthMode;
//Shifts for the values contained in chandata variable
enum {
SHIFT_KSLBASE = 16,
SHIFT_KEYCODE = 24,
};
struct Operator {
public:
//Masks for operator 20 values
enum {
MASK_KSR = 0x10,
MASK_SUSTAIN = 0x20,
MASK_VIBRATO = 0x40,
MASK_TREMOLO = 0x80,
};
typedef enum {
OFF,
RELEASE,
SUSTAIN,
DECAY,
ATTACK,
} State;
VolumeHandler volHandler;
#if (DBOPL_WAVE == WAVE_HANDLER)
WaveHandler waveHandler; //Routine that generate a wave
#else
Bit16s* waveBase;
Bit32u waveMask;
Bit32u waveStart;
#endif
Bit32u waveIndex; //WAVE_BITS shifted counter of the frequency index
Bit32u waveAdd; //The base frequency without vibrato
Bit32u waveCurrent; //waveAdd + vibratao
Bit32u chanData; //Frequency/octave and derived data coming from whatever channel controls this
Bit32u freqMul; //Scale channel frequency with this, TODO maybe remove?
Bit32u vibrato; //Scaled up vibrato strength
Bit32s sustainLevel; //When stopping at sustain level stop here
Bit32s totalLevel; //totalLevel is added to every generated volume
Bit32u currentLevel; //totalLevel + tremolo
Bit32s volume; //The currently active volume
Bit32u attackAdd; //Timers for the different states of the envelope
Bit32u decayAdd;
Bit32u releaseAdd;
Bit32u rateIndex; //Current position of the evenlope
Bit8u rateZero; //Bits for the different states of the envelope having no changes
Bit8u keyOn; //Bitmask of different values that can generate keyon
//Registers, also used to check for changes
Bit8u reg20, reg40, reg60, reg80, regE0;
//Active part of the envelope we're in
Bit8u state;
//0xff when tremolo is enabled
Bit8u tremoloMask;
//Strength of the vibrato
Bit8u vibStrength;
//Keep track of the calculated KSR so we can check for changes
Bit8u ksr;
private:
void SetState( Bit8u s );
void UpdateAttack( const Chip* chip );
void UpdateRelease( const Chip* chip );
void UpdateDecay( const Chip* chip );
public:
void UpdateAttenuation();
void UpdateRates( const Chip* chip );
void UpdateFrequency( );
void Write20( const Chip* chip, Bit8u val );
void Write40( const Chip* chip, Bit8u val );
void Write60( const Chip* chip, Bit8u val );
void Write80( const Chip* chip, Bit8u val );
void WriteE0( const Chip* chip, Bit8u val );
bool Silent() const;
void Prepare( const Chip* chip );
void KeyOn( Bit8u mask);
void KeyOff( Bit8u mask);
template< State state>
Bits TemplateVolume( );
Bit32s RateForward( Bit32u add );
Bitu ForwardWave();
Bitu ForwardVolume();
Bits GetSample( Bits modulation );
Bits GetWave( Bitu index, Bitu vol );
public:
Operator();
};
struct Channel {
Operator op[2];
inline Operator* Op( Bitu index ) {
return &( ( this + (index >> 1) )->op[ index & 1 ]);
}
SynthHandler synthHandler;
Bit32u chanData; //Frequency/octave and derived values
Bit32s old[2]; //Old data for feedback
Bit8u feedback; //Feedback shift
Bit8u regB0; //Register values to check for changes
Bit8u regC0;
//This should correspond with reg104, bit 6 indicates a Percussion channel, bit 7 indicates a silent channel
Bit8u fourMask;
Bit8s maskLeft; //Sign extended values for both channel's panning
Bit8s maskRight;
//Forward the channel data to the operators of the channel
void SetChanData( const Chip* chip, Bit32u data );
//Change in the chandata, check for new values and if we have to forward to operators
void UpdateFrequency( const Chip* chip, Bit8u fourOp );
void WriteA0( const Chip* chip, Bit8u val );
void WriteB0( const Chip* chip, Bit8u val );
void WriteC0( const Chip* chip, Bit8u val );
void ResetC0( const Chip* chip );
//call this for the first channel
template< bool opl3Mode >
void GeneratePercussion( Chip* chip, Bit32s* output );
//Generate blocks of data in specific modes
template<SynthMode mode>
Channel* BlockTemplate( Chip* chip, Bit32u samples, Bit32s* output );
Channel();
};
struct Chip {
//This is used as the base counter for vibrato and tremolo
Bit32u lfoCounter;
Bit32u lfoAdd;
Bit32u noiseCounter;
Bit32u noiseAdd;
Bit32u noiseValue;
//Frequency scales for the different multiplications
Bit32u freqMul[16];
//Rates for decay and release for rate of this chip
Bit32u linearRates[76];
//Best match attack rates for the rate of this chip
Bit32u attackRates[76];
//18 channels with 2 operators each
Channel chan[18];
Bit8u reg104;
Bit8u reg08;
Bit8u reg04;
Bit8u regBD;
Bit8u vibratoIndex;
Bit8u tremoloIndex;
Bit8s vibratoSign;
Bit8u vibratoShift;
Bit8u tremoloValue;
Bit8u vibratoStrength;
Bit8u tremoloStrength;
//Mask for allowed wave forms
Bit8u waveFormMask;
//0 or -1 when enabled
Bit8s opl3Active;
//Return the maximum amount of samples before and LFO change
Bit32u ForwardLFO( Bit32u samples );
Bit32u ForwardNoise();
void WriteBD( Bit8u val );
void WriteReg(Bit32u reg, Bit8u val );
Bit32u WriteAddr( Bit32u port, Bit8u val );
void GenerateBlock2( Bitu samples, Bit32s* output );
void GenerateBlock3( Bitu samples, Bit32s* output );
void Generate( Bitu samples, Bit32s *buffer );
void Setup( Bit32u r );
Chip();
};
struct Handler : public Adlib::Handler {
DBOPL::Chip chip;
virtual Bit32u WriteAddr( Bit32u port, Bit8u val );
virtual void WriteReg( Bit32u addr, Bit8u val );
virtual void Generate( Bitu samples, Bit32s *buffer );
virtual void Init( Bitu rate );
};
}; //Namespace

76
Source/dosbox.h Normal file
View file

@ -0,0 +1,76 @@
/*
* Copyright (C) 2002-2010 The DOSBox Team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dosbox.h,v 1.32 2009-05-27 09:15:41 qbix79 Exp $ */
#ifndef DOSBOX_DOSBOX_H
#define DOSBOX_DOSBOX_H
#include "config.h"
void E_Exit(const char * message,...) GCC_ATTRIBUTE( __format__(__printf__, 1, 2));
void MSG_Add(const char*,const char*); //add messages to the internal langaugefile
const char* MSG_Get(char const *); //get messages from the internal langaugafile
class Section;
typedef Bitu (LoopHandler)(void);
void DOSBOX_RunMachine();
void DOSBOX_SetLoop(LoopHandler * handler);
void DOSBOX_SetNormalLoop();
void DOSBOX_Init(void);
class Config;
extern Config * control;
enum MachineType {
MCH_HERC,
MCH_CGA,
MCH_TANDY,
MCH_PCJR,
MCH_EGA,
MCH_VGA
};
enum SVGACards {
SVGA_None,
SVGA_S3Trio,
SVGA_TsengET4K,
SVGA_TsengET3K,
SVGA_ParadisePVGA1A
};
extern SVGACards svgaCard;
extern MachineType machine;
extern bool SDLNetInited;
#define IS_TANDY_ARCH ((machine==MCH_TANDY) || (machine==MCH_PCJR))
#define IS_EGAVGA_ARCH ((machine==MCH_EGA) || (machine==MCH_VGA))
#define IS_VGA_ARCH (machine==MCH_VGA)
#define TANDY_ARCH_CASE MCH_TANDY: case MCH_PCJR
#define EGAVGA_ARCH_CASE MCH_EGA: case MCH_VGA
#define VGA_ARCH_CASE MCH_VGA
#ifndef DOSBOX_LOGGING_H
#include "logging.h"
#endif // the logging system.
#endif /* DOSBOX_DOSBOX_H */

55
Source/hardware.h Normal file
View file

@ -0,0 +1,55 @@
/*
* Copyright (C) 2002-2010 The DOSBox Team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: hardware.h,v 1.17 2009-06-23 17:46:05 c2woody Exp $ */
#ifndef DOSBOX_HARDWARE_H
#define DOSBOX_HARDWARE_H
#include <stdio.h>
class Section;
enum OPL_Mode {
OPL_none,OPL_cms,OPL_opl2,OPL_dualopl2,OPL_opl3
};
#define CAPTURE_WAVE 0x01
#define CAPTURE_OPL 0x02
#define CAPTURE_MIDI 0x04
#define CAPTURE_IMAGE 0x08
#define CAPTURE_VIDEO 0x10
extern Bitu CaptureState;
void OPL_Init(Section* sec,OPL_Mode mode);
void CMS_Init(Section* sec);
void OPL_ShutDown(Section* sec);
void CMS_ShutDown(Section* sec);
bool SB_Get_Address(Bitu& sbaddr, Bitu& sbirq, Bitu& sbdma);
bool TS_Get_Address(Bitu& tsaddr, Bitu& tsirq, Bitu& tsdma);
extern Bit8u adlib_commandreg;
FILE * OpenCaptureFile(const char * type,const char * ext);
void CAPTURE_AddWave(Bit32u freq, Bit32u len, Bit16s * data);
#define CAPTURE_FLAG_DBLW 0x1
#define CAPTURE_FLAG_DBLH 0x2
void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, float fps, Bit8u * data, Bit8u * pal);
void CAPTURE_AddMidi(bool sysex, Bitu len, Bit8u * data);
#endif

49
Source/hiopl.cpp Normal file
View file

@ -0,0 +1,49 @@
#include "Hiopl.h"
#include <assert.h>
// A higher level wrapper around the DOSBox OPL emulator.
Hiopl::Hiopl(int buflen) {
adlib = new DBOPL::Handler();
Buf32 = new Bit32s[buflen];
}
void Hiopl::Generate(int length, short* buffer) {
//printf("Generating %d samples\n", length);
adlib->Generate(length, Buf32);
for (int i = 0; i < length; i++) {
buffer[i] = (short)(Buf32[i]);
}
}
void Hiopl::SetSampleRate(int hz) {
adlib->Init(hz);
}
void Hiopl::_WriteReg(Bit32u reg, Bit8u value) {
adlib->WriteReg(reg, value);
regCache[reg] = value;
}
void Hiopl::SetWaveform(int ch, int osc, Waveform wave) {
assert(_CheckParams(ch, osc));
_WriteReg(0xe0+2*ch+osc, wave);
}
Waveform Hiopl::GetWaveform(int ch, int osc) {
assert(_CheckParams(ch, osc));
return static_cast<Waveform>(regCache[0xe0+2*ch+osc]);
}
void Hiopl::KeyOn(int ch, int frq) {
}
Hiopl::~Hiopl() {
delete Buf32;
};
bool Hiopl::_CheckParams(int ch, int osc) {
return ch >= 0 && ch < CHANNELS && osc >= 0 && osc < OSCILLATORS;
}

32
Source/hiopl.h Normal file
View file

@ -0,0 +1,32 @@
#include "adlib.h"
#include "dbopl.h"
enum Waveform
{
SIN = 0, HALF_SIN = 1, ABS_SIN = 2, QUART_SIN = 3
};
enum Oscillator
{
CAR = 0, MOD = 1
};
const int CHANNELS = 9;
const int OSCILLATORS = 2;
class Hiopl {
public:
Hiopl(int buflen);
void Generate(int length, short* buffer);
void SetSampleRate(int hz);
void SetWaveform(int ch, int osc, Waveform wave);
Waveform GetWaveform(int ch, int osc);
void Hiopl::KeyOn(int ch, int frq);
void _WriteReg(Bit32u reg, Bit8u value);
~Hiopl();
private:
Adlib::Handler *adlib;
Bit8u regCache[256];
Bit32s *Buf32;
bool _CheckParams(int ch, int osc);
};

78
Source/inout.h Normal file
View file

@ -0,0 +1,78 @@
/*
* Copyright (C) 2002-2010 The DOSBox Team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: inout.h,v 1.13 2009-05-27 09:15:41 qbix79 Exp $ */
#ifndef DOSBOX_INOUT_H
#define DOSBOX_INOUT_H
#define IO_MAX (64*1024+3)
#define IO_MB 0x1
#define IO_MW 0x2
#define IO_MD 0x4
#define IO_MA (IO_MB | IO_MW | IO_MD )
typedef Bitu IO_ReadHandler(Bitu port,Bitu iolen);
typedef void IO_WriteHandler(Bitu port,Bitu val,Bitu iolen);
extern IO_WriteHandler * io_writehandlers[3][IO_MAX];
extern IO_ReadHandler * io_readhandlers[3][IO_MAX];
void IO_RegisterReadHandler(Bitu port,IO_ReadHandler * handler,Bitu mask,Bitu range=1);
void IO_RegisterWriteHandler(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range=1);
void IO_FreeReadHandler(Bitu port,Bitu mask,Bitu range=1);
void IO_FreeWriteHandler(Bitu port,Bitu mask,Bitu range=1);
void IO_WriteB(Bitu port,Bitu val);
void IO_WriteW(Bitu port,Bitu val);
void IO_WriteD(Bitu port,Bitu val);
Bitu IO_ReadB(Bitu port);
Bitu IO_ReadW(Bitu port);
Bitu IO_ReadD(Bitu port);
/* Classes to manage the IO objects created by the various devices.
* The io objects will remove itself on destruction.*/
class IO_Base{
protected:
bool installed;
Bitu m_port, m_mask,m_range;
public:
IO_Base():installed(false){};
};
class IO_ReadHandleObject: private IO_Base{
public:
void Install(Bitu port,IO_ReadHandler * handler,Bitu mask,Bitu range=1);
~IO_ReadHandleObject();
};
class IO_WriteHandleObject: private IO_Base{
public:
void Install(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range=1);
~IO_WriteHandleObject();
};
static INLINE void IO_Write(Bitu port,Bit8u val) {
IO_WriteB(port,val);
}
static INLINE Bit8u IO_Read(Bitu port){
return (Bit8u)IO_ReadB(port);
}
#endif

67
Source/logging.h Normal file
View file

@ -0,0 +1,67 @@
#ifndef DOSBOX_LOGGING_H
#define DOSBOX_LOGGING_H
enum LOG_TYPES {
LOG_ALL,
LOG_VGA, LOG_VGAGFX,LOG_VGAMISC,LOG_INT10,
LOG_SB,LOG_DMACONTROL,
LOG_FPU,LOG_CPU,LOG_PAGING,
LOG_FCB,LOG_FILES,LOG_IOCTL,LOG_EXEC,LOG_DOSMISC,
LOG_PIT,LOG_KEYBOARD,LOG_PIC,
LOG_MOUSE,LOG_BIOS,LOG_GUI,LOG_MISC,
LOG_IO,
LOG_MAX
};
enum LOG_SEVERITIES {
LOG_NORMAL,
LOG_WARN,
LOG_ERROR
};
#if C_DEBUG
class LOG
{
LOG_TYPES d_type;
LOG_SEVERITIES d_severity;
public:
LOG (LOG_TYPES type , LOG_SEVERITIES severity):
d_type(type),
d_severity(severity)
{}
void operator() (char const* buf, ...) GCC_ATTRIBUTE(__format__(__printf__, 2, 3)); //../src/debug/debug_gui.cpp
};
void DEBUG_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2));
#define LOG_MSG DEBUG_ShowMsg
#else //C_DEBUG
struct LOG
{
LOG(LOG_TYPES , LOG_SEVERITIES ) { }
void operator()(char const* ) { }
void operator()(char const* , double ) { }
void operator()(char const* , double , double ) { }
void operator()(char const* , double , double , double ) { }
void operator()(char const* , double , double , double , double ) { }
void operator()(char const* , double , double , double , double , double ) { }
void operator()(char const* , char const* ) { }
void operator()(char const* , char const* , double ) { }
void operator()(char const* , char const* , double ,double ) { }
void operator()(char const* , double , char const* ) { }
void operator()(char const* , double , double, char const* ) { }
void operator()(char const* , char const*, char const*) { }
}; //add missing operators to here
//try to avoid anything smaller than bit32...
void GFX_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2));
#define LOG_MSG GFX_ShowMsg
#endif //C_DEBUG
#endif //DOSBOX_LOGGING_H

114
Source/mixer.h Normal file
View file

@ -0,0 +1,114 @@
/*
* Copyright (C) 2002-2010 The DOSBox Team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: mixer.h,v 1.19 2009-04-28 21:48:24 harekiet Exp $ */
#ifndef DOSBOX_MIXER_H
#define DOSBOX_MIXER_H
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
typedef void (*MIXER_MixHandler)(Bit8u * sampdate,Bit32u len);
typedef void (*MIXER_Handler)(Bitu len);
enum BlahModes {
MIXER_8MONO,MIXER_8STEREO,
MIXER_16MONO,MIXER_16STEREO
};
enum MixerModes {
M_8M,M_8S,
M_16M,M_16S
};
#define MIXER_BUFSIZE (16*1024)
#define MIXER_BUFMASK (MIXER_BUFSIZE-1)
extern Bit8u MixTemp[MIXER_BUFSIZE];
#define MAX_AUDIO ((1<<(16-1))-1)
#define MIN_AUDIO -(1<<(16-1))
class MixerChannel {
public:
void SetVolume(float _left,float _right);
void SetScale( float f );
void UpdateVolume(void);
void SetFreq(Bitu _freq);
void Mix(Bitu _needed);
void AddSilence(void); //Fill up until needed
template<class Type,bool stereo,bool signeddata,bool nativeorder>
void AddSamples(Bitu len, const Type* data);
void AddSamples_m8(Bitu len, const Bit8u * data);
void AddSamples_s8(Bitu len, const Bit8u * data);
void AddSamples_m8s(Bitu len, const Bit8s * data);
void AddSamples_s8s(Bitu len, const Bit8s * data);
void AddSamples_m16(Bitu len, const Bit16s * data);
void AddSamples_s16(Bitu len, const Bit16s * data);
void AddSamples_m16u(Bitu len, const Bit16u * data);
void AddSamples_s16u(Bitu len, const Bit16u * data);
void AddSamples_m32(Bitu len, const Bit32s * data);
void AddSamples_s32(Bitu len, const Bit32s * data);
void AddSamples_m16_nonnative(Bitu len, const Bit16s * data);
void AddSamples_s16_nonnative(Bitu len, const Bit16s * data);
void AddSamples_m16u_nonnative(Bitu len, const Bit16u * data);
void AddSamples_s16u_nonnative(Bitu len, const Bit16u * data);
void AddSamples_m32_nonnative(Bitu len, const Bit32s * data);
void AddSamples_s32_nonnative(Bitu len, const Bit32s * data);
void AddStretched(Bitu len,Bit16s * data); //Strech block up into needed data
void FillUp(void);
void Enable(bool _yesno);
MIXER_Handler handler;
float volmain[2];
float scale;
Bit32s volmul[2];
Bitu freq_add,freq_index;
Bitu done,needed;
Bits last[2];
const char * name;
bool enabled;
MixerChannel * next;
};
MixerChannel * MIXER_AddChannel(MIXER_Handler handler,Bitu freq,const char * name);
MixerChannel * MIXER_FindChannel(const char * name);
/* Find the device you want to delete with findchannel "delchan gets deleted" */
void MIXER_DelChannel(MixerChannel* delchan);
/* Object to maintain a mixerchannel; As all objects it registers itself with create
* and removes itself when destroyed. */
class MixerObject{
private:
bool installed;
char m_name[32];
public:
MixerObject():installed(false){};
MixerChannel* Install(MIXER_Handler handler,Bitu freq,const char * name);
~MixerObject();
};
/* PC Speakers functions, tightly related to the timer functions */
void PCSPEAKER_SetCounter(Bitu cntr,Bitu mode);
void PCSPEAKER_SetType(Bitu mode);
#endif

201
Source/opl.h Normal file
View file

@ -0,0 +1,201 @@
/*
* Copyright (C) 2002-2010 The DOSBox Team
* OPL2/OPL3 emulation library
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* Originally based on ADLIBEMU.C, an AdLib/OPL2 emulation library by Ken Silverman
* Copyright (C) 1998-2001 Ken Silverman
* Ken Silverman's official web site: "http://www.advsys.net/ken"
*/
#define fltype double
/*
define Bits, Bitu, Bit32s, Bit32u, Bit16s, Bit16u, Bit8s, Bit8u here
*/
/*
#include <stdint.h>
typedef uintptr_t Bitu;
typedef intptr_t Bits;
typedef uint32_t Bit32u;
typedef int32_t Bit32s;
typedef uint16_t Bit16u;
typedef int16_t Bit16s;
typedef uint8_t Bit8u;
typedef int8_t Bit8s;
*/
/*
define attribution that inlines/forces inlining of a function (optional)
*/
#define OPL_INLINE INLINE
#undef NUM_CHANNELS
#if defined(OPLTYPE_IS_OPL3)
#define NUM_CHANNELS 18
#else
#define NUM_CHANNELS 9
#endif
#define MAXOPERATORS (NUM_CHANNELS*2)
#define FL05 ((fltype)0.5)
#define FL2 ((fltype)2.0)
#define PI ((fltype)3.1415926535897932384626433832795)
#define FIXEDPT 0x10000 // fixed-point calculations using 16+16
#define FIXEDPT_LFO 0x1000000 // fixed-point calculations using 8+24
#define WAVEPREC 1024 // waveform precision (10 bits)
#define INTFREQU ((fltype)(14318180.0 / 288.0)) // clocking of the chip
#define OF_TYPE_ATT 0
#define OF_TYPE_DEC 1
#define OF_TYPE_REL 2
#define OF_TYPE_SUS 3
#define OF_TYPE_SUS_NOKEEP 4
#define OF_TYPE_OFF 5
#define ARC_CONTROL 0x00
#define ARC_TVS_KSR_MUL 0x20
#define ARC_KSL_OUTLEV 0x40
#define ARC_ATTR_DECR 0x60
#define ARC_SUSL_RELR 0x80
#define ARC_FREQ_NUM 0xa0
#define ARC_KON_BNUM 0xb0
#define ARC_PERC_MODE 0xbd
#define ARC_FEEDBACK 0xc0
#define ARC_WAVE_SEL 0xe0
#define ARC_SECONDSET 0x100 // second operator set for OPL3
#define OP_ACT_OFF 0x00
#define OP_ACT_NORMAL 0x01 // regular channel activated (bitmasked)
#define OP_ACT_PERC 0x02 // percussion channel activated (bitmasked)
#define BLOCKBUF_SIZE 512
// vibrato constants
#define VIBTAB_SIZE 8
#define VIBFAC 70/50000 // no braces, integer mul/div
// tremolo constants and table
#define TREMTAB_SIZE 53
#define TREM_FREQ ((fltype)(3.7)) // tremolo at 3.7hz
/* operator struct definition
For OPL2 all 9 channels consist of two operators each, carrier and modulator.
Channel x has operators x as modulator and operators (9+x) as carrier.
For OPL3 all 18 channels consist either of two operators (2op mode) or four
operators (4op mode) which is determined through register4 of the second
adlib register set.
Only the channels 0,1,2 (first set) and 9,10,11 (second set) can act as
4op channels. The two additional operators for a channel y come from the
2op channel y+3 so the operatorss y, (9+y), y+3, (9+y)+3 make up a 4op
channel.
*/
typedef struct operator_struct {
Bit32s cval, lastcval; // current output/last output (used for feedback)
Bit32u tcount, wfpos, tinc; // time (position in waveform) and time increment
fltype amp, step_amp; // and amplification (envelope)
fltype vol; // volume
fltype sustain_level; // sustain level
Bit32s mfbi; // feedback amount
fltype a0, a1, a2, a3; // attack rate function coefficients
fltype decaymul, releasemul; // decay/release rate functions
Bit32u op_state; // current state of operator (attack/decay/sustain/release/off)
Bit32u toff;
Bit32s freq_high; // highest three bits of the frequency, used for vibrato calculations
Bit16s* cur_wform; // start of selected waveform
Bit32u cur_wmask; // mask for selected waveform
Bit32u act_state; // activity state (regular, percussion)
bool sus_keep; // keep sustain level when decay finished
bool vibrato,tremolo; // vibrato/tremolo enable bits
// variables used to provide non-continuous envelopes
Bit32u generator_pos; // for non-standard sample rates we need to determine how many samples have passed
Bits cur_env_step; // current (standardized) sample position
Bits env_step_a,env_step_d,env_step_r; // number of std samples of one step (for attack/decay/release mode)
Bit8u step_skip_pos_a; // position of 8-cyclic step skipping (always 2^x to check against mask)
Bits env_step_skip_a; // bitmask that determines if a step is skipped (respective bit is zero then)
#if defined(OPLTYPE_IS_OPL3)
bool is_4op,is_4op_attached; // base of a 4op channel/part of a 4op channel
Bit32s left_pan,right_pan; // opl3 stereo panning amount
#endif
} op_type;
// per-chip variables
Bitu chip_num;
op_type op[MAXOPERATORS];
Bits int_samplerate;
Bit8u status;
Bit32u opl_index;
#if defined(OPLTYPE_IS_OPL3)
Bit8u adlibreg[512]; // adlib register set (including second set)
Bit8u wave_sel[44]; // waveform selection
#else
Bit8u adlibreg[256]; // adlib register set
Bit8u wave_sel[22]; // waveform selection
#endif
// vibrato/tremolo increment/counter
Bit32u vibtab_pos;
Bit32u vibtab_add;
Bit32u tremtab_pos;
Bit32u tremtab_add;
// enable an operator
void enable_operator(Bitu regbase, op_type* op_pt);
// functions to change parameters of an operator
void change_frequency(Bitu chanbase, Bitu regbase, op_type* op_pt);
void change_attackrate(Bitu regbase, op_type* op_pt);
void change_decayrate(Bitu regbase, op_type* op_pt);
void change_releaserate(Bitu regbase, op_type* op_pt);
void change_sustainlevel(Bitu regbase, op_type* op_pt);
void change_waveform(Bitu regbase, op_type* op_pt);
void change_keepsustain(Bitu regbase, op_type* op_pt);
void change_vibrato(Bitu regbase, op_type* op_pt);
void change_feedback(Bitu chanbase, op_type* op_pt);
// general functions
void adlib_init(Bit32u samplerate);
void adlib_write(Bitu idx, Bit8u val);
void adlib_getsample(Bit16s* sndptr, Bits numsamples);
Bitu adlib_reg_read(Bitu port);
void adlib_write_index(Bitu port, Bit8u val);
static Bit32u generator_add; // should be a chip parameter

67
Source/pic.h Normal file
View file

@ -0,0 +1,67 @@
/*
* Copyright (C) 2002-2010 The DOSBox Team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef DOSBOX_PIC_H
#define DOSBOX_PIC_H
/* CPU Cycle Timing */
extern Bit32s CPU_Cycles;
extern Bit32s CPU_CycleLeft;
extern Bit32s CPU_CycleMax;
typedef void (PIC_EOIHandler) (void);
typedef void (* PIC_EventHandler)(Bitu val);
#define PIC_MAXIRQ 15
#define PIC_NOIRQ 0xFF
extern Bitu PIC_IRQCheck;
extern Bitu PIC_IRQActive;
extern Bitu PIC_Ticks;
static INLINE float PIC_TickIndex(void) {
return (CPU_CycleMax-CPU_CycleLeft-CPU_Cycles)/(float)CPU_CycleMax;
}
static INLINE Bits PIC_TickIndexND(void) {
return CPU_CycleMax-CPU_CycleLeft-CPU_Cycles;
}
static INLINE Bits PIC_MakeCycles(double amount) {
return (Bits)(CPU_CycleMax*amount);
}
static INLINE double PIC_FullIndex(void) {
return PIC_Ticks+(double)PIC_TickIndex();
}
void PIC_ActivateIRQ(Bitu irq);
void PIC_DeActivateIRQ(Bitu irq);
void PIC_runIRQs(void);
bool PIC_RunQueue(void);
//Delay in milliseconds
void PIC_AddEvent(PIC_EventHandler handler,float delay,Bitu val=0);
void PIC_RemoveEvents(PIC_EventHandler handler);
void PIC_RemoveSpecificEvents(PIC_EventHandler handler, Bitu val);
void PIC_SetIRQMask(Bitu irq, bool masked);
#endif

331
Source/setup.h Normal file
View file

@ -0,0 +1,331 @@
/*
* Copyright (C) 2002-2010 The DOSBox Team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: setup.h,v 1.41 2009-05-27 09:15:41 qbix79 Exp $ */
#ifndef DOSBOX_SETUP_H
#define DOSBOX_SETUP_H
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#pragma warning ( disable : 4290 )
#endif
#ifndef CH_LIST
#define CH_LIST
#include <list>
#endif
#ifndef CH_VECTOR
#define CH_VECTOR
#include <vector>
#endif
#ifndef CH_STRING
#define CH_STRING
#include <string>
#endif
class Hex {
private:
int _hex;
public:
Hex(int in):_hex(in) { };
Hex():_hex(0) { };
bool operator==(Hex const& other) {return _hex == other._hex;}
operator int () const { return _hex; }
};
class Value {
/*
* Multitype storage container that is aware of the currently stored type in it.
* Value st = "hello";
* Value in = 1;
* st = 12 //Exception
* in = 12 //works
*/
private:
Hex _hex;
bool _bool;
int _int;
std::string* _string;
double _double;
public:
class WrongType { }; // Conversion error class
enum Etype { V_NONE, V_HEX, V_BOOL, V_INT, V_STRING, V_DOUBLE,V_CURRENT} type;
/* Constructors */
Value() :_string(0), type(V_NONE) { };
Value(Hex in) :_hex(in), type(V_HEX) { };
Value(int in) :_int(in), type(V_INT) { };
Value(bool in) :_bool(in), type(V_BOOL) { };
Value(double in) :_double(in), type(V_DOUBLE) { };
Value(std::string const& in) :_string(new std::string(in)),type(V_STRING) { };
Value(char const * const in) :_string(new std::string(in)),type(V_STRING) { };
Value(Value const& in):_string(0) {plaincopy(in);}
~Value() { destroy();};
Value(std::string const& in,Etype _t) :_string(0),type(V_NONE) {SetValue(in,_t);}
/* Assigment operators */
Value& operator= (Hex in) throw(WrongType) { return copy(Value(in));}
Value& operator= (int in) throw(WrongType) { return copy(Value(in));}
Value& operator= (bool in) throw(WrongType) { return copy(Value(in));}
Value& operator= (double in) throw(WrongType) { return copy(Value(in));}
Value& operator= (std::string const& in) throw(WrongType) { return copy(Value(in));}
Value& operator= (char const * const in) throw(WrongType) { return copy(Value(in));}
Value& operator= (Value const& in) throw(WrongType) { return copy(Value(in));}
bool operator== (Value const & other);
operator bool () const throw(WrongType);
operator Hex () const throw(WrongType);
operator int () const throw(WrongType);
operator double () const throw(WrongType);
operator char const* () const throw(WrongType);
void SetValue(std::string const& in,Etype _type = V_CURRENT) throw(WrongType);
std::string ToString() const;
private:
void destroy() throw();
Value& copy(Value const& in) throw(WrongType);
void plaincopy(Value const& in) throw();
void set_hex(std::string const& in);
void set_int(std::string const&in);
void set_bool(std::string const& in);
void set_string(std::string const& in);
void set_double(std::string const& in);
};
class Property {
public:
struct Changeable { enum Value {Always, WhenIdle,OnlyAtStart};};
const std::string propname;
Property(std::string const& _propname, Changeable::Value when):propname(_propname),change(when) { }
void Set_values(const char * const * in);
void Set_help(std::string const& str);
char const* Get_help();
virtual void SetValue(std::string const& str)=0;
Value const& GetValue() const { return value;}
Value const& Get_Default_Value() const { return default_value; }
//CheckValue returns true if value is in suggested_values;
//Type specific properties are encouraged to override this and check for type
//specific features.
virtual bool CheckValue(Value const& in, bool warn);
//Set interval value to in or default if in is invalid. force always sets the value.
void SetVal(Value const& in, bool forced,bool warn=true) {if(forced || CheckValue(in,warn)) value = in; else value = default_value;}
virtual ~Property(){ }
virtual const std::vector<Value>& GetValues() const;
Value::Etype Get_type(){return default_value.type;}
protected:
Value value;
std::vector<Value> suggested_values;
typedef std::vector<Value>::iterator iter;
Value default_value;
const Changeable::Value change;
};
class Prop_int:public Property {
public:
Prop_int(std::string const& _propname,Changeable::Value when, int _value)
:Property(_propname,when) {
default_value = value = _value;
min = max = -1;
}
Prop_int(std::string const& _propname,Changeable::Value when, int _min,int _max,int _value)
:Property(_propname,when) {
default_value = value = _value;
min = _min;
max = _max;
}
void SetMinMax(Value const& min,Value const& max) {this->min = min; this->max=max;}
void SetValue(std::string const& in);
~Prop_int(){ }
virtual bool CheckValue(Value const& in, bool warn);
private:
Value min,max;
};
class Prop_double:public Property {
public:
Prop_double(std::string const & _propname, Changeable::Value when, double _value)
:Property(_propname,when){
default_value = value = _value;
}
void SetValue(std::string const& input);
~Prop_double(){ }
};
class Prop_bool:public Property {
public:
Prop_bool(std::string const& _propname, Changeable::Value when, bool _value)
:Property(_propname,when) {
default_value = value = _value;
}
void SetValue(std::string const& in);
~Prop_bool(){ }
};
class Prop_string:public Property{
public:
Prop_string(std::string const& _propname, Changeable::Value when, char const * const _value)
:Property(_propname,when) {
default_value = value = _value;
}
void SetValue(std::string const& in);
virtual bool CheckValue(Value const& in, bool warn);
~Prop_string(){ }
};
class Prop_path:public Prop_string{
public:
std::string realpath;
Prop_path(std::string const& _propname, Changeable::Value when, char const * const _value)
:Prop_string(_propname,when,_value) {
default_value = value = _value;
realpath = _value;
}
void SetValue(std::string const& in);
~Prop_path(){ }
};
class Prop_hex:public Property {
public:
Prop_hex(std::string const& _propname, Changeable::Value when, Hex _value)
:Property(_propname,when) {
default_value = value = _value;
}
void SetValue(std::string const& in);
~Prop_hex(){ }
};
#define NO_SUCH_PROPERTY "PROP_NOT_EXIST"
class Section {
private:
typedef void (*SectionFunction)(Section*);
/* Wrapper class around startup and shutdown functions. the variable
* canchange indicates it can be called on configuration changes */
struct Function_wrapper {
SectionFunction function;
bool canchange;
Function_wrapper(SectionFunction const _fun,bool _ch){
function=_fun;
canchange=_ch;
}
};
std::list<Function_wrapper> initfunctions;
std::list<Function_wrapper> destroyfunctions;
std::string sectionname;
public:
Section(std::string const& _sectionname):sectionname(_sectionname) { }
void AddInitFunction(SectionFunction func,bool canchange=false);
void AddDestroyFunction(SectionFunction func,bool canchange=false);
void ExecuteInit(bool initall=true);
void ExecuteDestroy(bool destroyall=true);
const char* GetName() const {return sectionname.c_str();}
virtual std::string GetPropValue(std::string const& _property) const =0;
virtual void HandleInputline(std::string const& _line)=0;
virtual void PrintData(FILE* outfile) const =0;
virtual ~Section() { /*Children must call executedestroy ! */}
};
class Prop_multival;
class Prop_multival_remain;
class Section_prop:public Section {
private:
std::list<Property*> properties;
typedef std::list<Property*>::iterator it;
typedef std::list<Property*>::const_iterator const_it;
public:
Section_prop(std::string const& _sectionname):Section(_sectionname){}
Prop_int* Add_int(std::string const& _propname, Property::Changeable::Value when, int _value=0);
Prop_string* Add_string(std::string const& _propname, Property::Changeable::Value when, char const * const _value=NULL);
Prop_path* Add_path(std::string const& _propname, Property::Changeable::Value when, char const * const _value=NULL);
Prop_bool* Add_bool(std::string const& _propname, Property::Changeable::Value when, bool _value=false);
Prop_hex* Add_hex(std::string const& _propname, Property::Changeable::Value when, Hex _value=0);
// void Add_double(char const * const _propname, double _value=0.0);
Prop_multival *Add_multi(std::string const& _propname, Property::Changeable::Value when,std::string const& sep);
Prop_multival_remain *Add_multiremain(std::string const& _propname, Property::Changeable::Value when,std::string const& sep);
Property* Get_prop(int index);
int Get_int(std::string const& _propname) const;
const char* Get_string(std::string const& _propname) const;
bool Get_bool(std::string const& _propname) const;
Hex Get_hex(std::string const& _propname) const;
double Get_double(std::string const& _propname) const;
Prop_path* Get_path(std::string const& _propname) const;
Prop_multival* Get_multival(std::string const& _propname) const;
Prop_multival_remain* Get_multivalremain(std::string const& _propname) const;
void HandleInputline(std::string const& gegevens);
void PrintData(FILE* outfile) const;
virtual std::string GetPropValue(std::string const& _property) const;
//ExecuteDestroy should be here else the destroy functions use destroyed properties
virtual ~Section_prop();
};
class Prop_multival:public Property{
protected:
Section_prop* section;
std::string seperator;
void make_default_value();
public:
Prop_multival(std::string const& _propname, Changeable::Value when,std::string const& sep):Property(_propname,when), section(new Section_prop("")),seperator(sep) {
default_value = value = "";
}
Section_prop *GetSection() { return section; }
const Section_prop *GetSection() const { return section; }
virtual void SetValue(std::string const& input);
virtual const std::vector<Value>& GetValues() const;
~Prop_multival() { delete section; }
}; //value bevat totale string. setvalue zet elk van de sub properties en checked die.
class Prop_multival_remain:public Prop_multival{
public:
Prop_multival_remain(std::string const& _propname, Changeable::Value when,std::string const& sep):Prop_multival(_propname,when,sep){ }
virtual void SetValue(std::string const& input);
};
class Section_line: public Section{
public:
Section_line(std::string const& _sectionname):Section(_sectionname){}
~Section_line(){ExecuteDestroy(true);}
void HandleInputline(std::string const& gegevens);
void PrintData(FILE* outfile) const;
virtual std::string GetPropValue(std::string const& _property) const;
std::string data;
};
class Module_base {
/* Base for all hardware and software "devices" */
protected:
Section* m_configuration;
public:
Module_base(Section* configuration){m_configuration=configuration;};
// Module_base(Section* configuration, SaveState* state) {};
virtual ~Module_base(){/*LOG_MSG("executed")*/;};//Destructors are required
/* Returns true if succesful.*/
virtual bool Change_Config(Section* /*newconfig*/) {return false;} ;
};
#endif