diff options
-rw-r--r-- | src/chips/java/JavaOPL3.hpp | 24 | ||||
-rw-r--r-- | src/chips/java_opl3.cpp | 8 | ||||
-rw-r--r-- | src/chips/opal/opal.hpp | 2 |
3 files changed, 24 insertions, 10 deletions
diff --git a/src/chips/java/JavaOPL3.hpp b/src/chips/java/JavaOPL3.hpp index 9a4469b..a18266a 100644 --- a/src/chips/java/JavaOPL3.hpp +++ b/src/chips/java/JavaOPL3.hpp @@ -48,6 +48,13 @@ #include <string.h> #include <limits> +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffffU +#endif +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + #define OPL_SAMPLE_RATE 49716.0 #define CENTER_PANNING_POWER 0.70710678118 /* [RH] volume at center for EQP */ #define VOLUME_MUL 0.3333 @@ -141,10 +148,10 @@ class DisabledChannel : public Channel { public: DisabledChannel() : Channel(0, 0) { } - double getChannelOutput(class OPL3 *OPL3) { return 0; } + double getChannelOutput(class OPL3 *) { return 0; } void keyOn() { } void keyOff() { } - void updateOperators(class OPL3 *OPL3) { } + void updateOperators(class OPL3 *) { } }; @@ -341,7 +348,8 @@ public: // The OPL3 tremolo repetition rate is 3.7 Hz. #define tremoloFrequency (3.7) - static const int tremoloTableLength = (int)(OPL_SAMPLE_RATE/tremoloFrequency); + //static const int tremoloTableLength = (int)(OPL_SAMPLE_RATE/tremoloFrequency); + static const int tremoloTableLength = 13436; /* libADLMIDI */ static const int vibratoTableLength = 8192; OPL3DataStruct() @@ -526,7 +534,7 @@ namespace EnvelopeGeneratorData {4.80,1.01}, {3.84,0.81}, {3.20,0.69}, {2.74,0.58}, {2.40,0.51}, {2.40,0.51}, {2.40,0.51}, {2.40,0.51} }; -}; +} class OPL3 { @@ -1474,6 +1482,8 @@ double EnvelopeGenerator::getEnvelope(OPL3 *OPL3, int egt, int am) { envelope = 0; stage = DECAY; } + // libADLMIDI: + // fall through case DECAY: // The decay and release are linear. if(envelope>envelopeSustainLevel) { @@ -1482,6 +1492,8 @@ double EnvelopeGenerator::getEnvelope(OPL3 *OPL3, int egt, int am) { } else stage = SUSTAIN; + // libADLMIDI: + // fall through case SUSTAIN: // The Sustain stage is mantained all the time of the Key ON, // even if we are in non-sustaining mode. @@ -1596,7 +1608,7 @@ double RhythmChannel::getChannelOutput(OPL3 *OPL3) { channelOutput = (op1Output + op2Output) / 2; return channelOutput; -}; +} TopCymbalOperator::TopCymbalOperator(int baseAddress) : Operator(baseAddress) @@ -1638,6 +1650,8 @@ double TopCymbalOperator::getOperatorOutput(OPL3 *OPL3, double modulator, double if( chopped > 0.1) carrierOutput = 0; return carrierOutput*2; + + (void)modulator; } HighHatOperator::HighHatOperator() diff --git a/src/chips/java_opl3.cpp b/src/chips/java_opl3.cpp index d35c023..39477e2 100644 --- a/src/chips/java_opl3.cpp +++ b/src/chips/java_opl3.cpp @@ -25,7 +25,7 @@ #define M_PI 3.14159265358979323846 #endif #ifndef M_SQRT1_2 -# define M_SQRT1_2 0.70710678118654752440 +#define M_SQRT1_2 0.70710678118654752440 #endif JavaOPL3::JavaOPL3() : @@ -47,7 +47,7 @@ void JavaOPL3::setRate(uint32_t rate) JavaOPL::OPL3 *chip_r = reinterpret_cast<JavaOPL::OPL3 *>(m_chip); chip_r->Reset(); - float pan = sinf(M_SQRT1_2); + float pan = sinf((float)M_SQRT1_2); for (unsigned channel = 0; channel < 18; ++channel) chip_r->SetPanning(channel, pan, pan); } @@ -89,8 +89,8 @@ void JavaOPL3::nativeGenerateN(int16_t *output, size_t frames) { memset(buf, 0, sizeof(buf)); - size_t curframes = (frames < maxframes) ? frames : maxframes; - chip_r->Update(buf, curframes); + size_t curframes = (frames < (size_t)maxframes) ? frames : (size_t)maxframes; + chip_r->Update(buf, (int)curframes); size_t cursamples = 2 * curframes; for(size_t i = 0; i < cursamples; ++i) diff --git a/src/chips/opal/opal.hpp b/src/chips/opal/opal.hpp index 3ab4604..93270b4 100644 --- a/src/chips/opal/opal.hpp +++ b/src/chips/opal/opal.hpp @@ -38,7 +38,7 @@ class Opal { EnvAtt, EnvDec, EnvSus, - EnvRel, + EnvRel }; // A single FM operator |