diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/adlmidi.cpp | 20 | ||||
-rw-r--r-- | src/adlmidi_load.cpp | 8 | ||||
-rw-r--r-- | src/adlmidi_private.hpp | 1 | ||||
-rw-r--r-- | src/nukedopl3.h | 1 |
4 files changed, 21 insertions, 9 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index e2d2730..50163ac 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -24,11 +24,14 @@ #include "adlmidi_private.hpp" #ifdef ADLMIDI_HW_OPL -static const unsigned MaxCards = 1; +#define MaxCards 1 +#define MaxCards_STR "1" //Why not just "#MaxCards" ? Watcom fails to pass this with "syntax error" :-P #else -static const unsigned MaxCards = 100; +#define MaxCards 100 +#define MaxCards_STR "100" #endif + /*---------------------------EXPORTS---------------------------*/ ADLMIDI_EXPORT struct ADL_MIDIPlayer *adl_init(long sample_rate) @@ -67,9 +70,7 @@ ADLMIDI_EXPORT int adl_setNumChips(ADL_MIDIPlayer *device, int numCards) play->m_setup.NumCards = static_cast<unsigned int>(numCards); if(play->m_setup.NumCards < 1 || play->m_setup.NumCards > MaxCards) { - std::stringstream s; - s << "number of cards may only be 1.." << MaxCards << ".\n"; - play->setErrorString(s.str()); + play->setErrorString("number of chips may only be 1.." MaxCards_STR ".\n"); return -1; } @@ -105,9 +106,13 @@ ADLMIDI_EXPORT int adl_setBank(ADL_MIDIPlayer *device, int bank) MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer); if(static_cast<uint32_t>(bankno) >= NumBanks) { + #ifndef __WATCOMC__ std::stringstream s; s << "bank number may only be 0.." << (NumBanks - 1) << ".\n"; play->setErrorString(s.str()); + #else + play->setErrorString("Selected embedded bank is not exists!\n"); + #endif return -1; } @@ -135,9 +140,14 @@ ADLMIDI_EXPORT int adl_setNumFourOpsChn(ADL_MIDIPlayer *device, int ops4) MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer); if((unsigned int)ops4 > 6 * play->m_setup.NumCards) { + #ifndef __WATCOMC__ std::stringstream s; s << "number of four-op channels may only be 0.." << (6 * (play->m_setup.NumCards)) << " when " << play->m_setup.NumCards << " OPL3 cards are used.\n"; play->setErrorString(s.str()); + #else + play->setErrorString("number of four-op channels may not be more than 6 channels per each OPL3 chip!\n"); + #endif + return -1; } diff --git a/src/adlmidi_load.cpp b/src/adlmidi_load.cpp index 359536a..afe0610 100644 --- a/src/adlmidi_load.cpp +++ b/src/adlmidi_load.cpp @@ -181,7 +181,7 @@ bool MIDIplay::LoadBank(MIDIplay::fileReader &fr) } char magic[32]; - memset(magic, 0, 32); + std::memset(magic, 0, 32); uint16_t version = 0; @@ -194,7 +194,7 @@ bool MIDIplay::LoadBank(MIDIplay::fileReader &fr) return false; } - if(strncmp(magic, wopl3_magic, 11) != 0) + if(std::strncmp(magic, wopl3_magic, 11) != 0) { errorStringOut = "Custom bank: Invalid magic number!"; return false; @@ -215,7 +215,7 @@ bool MIDIplay::LoadBank(MIDIplay::fileReader &fr) } uint8_t head[6]; - memset(head, 0, 6); + std::memset(head, 0, 6); if(fr.read(head, 1, 6) != 6) { errorStringOut = "Custom bank: Can't read header!"; @@ -288,7 +288,7 @@ tryAgain: for(uint16_t i = 0; i < total; i++) { WOPL_Inst ins; - memset(&ins, 0, sizeof(WOPL_Inst)); + std::memset(&ins, 0, sizeof(WOPL_Inst)); if(!readInstrument(fr, ins, readPercussion)) { opl.setEmbeddedBank(m_setup.AdlBank); diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index 27cfdb0..c860a88 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -77,6 +77,7 @@ typedef __int32 ssize_t; #include <deque> // deque #include <cmath> // exp, log, ceil #include <stdio.h> +#include <stdlib.h> #include <limits> // numeric_limit #ifndef _WIN32 diff --git a/src/nukedopl3.h b/src/nukedopl3.h index 0a686e2..5a92d05 100644 --- a/src/nukedopl3.h +++ b/src/nukedopl3.h @@ -28,6 +28,7 @@ #define OPL_OPL3_H #include <inttypes.h> +#include <stdint.h> #ifdef __cplusplus extern "C" { |