aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/adlmidi.cpp33
-rw-r--r--src/adlmidi_load.cpp2
-rw-r--r--src/adlmidi_midiplay.cpp2
-rw-r--r--src/adlmidi_private.hpp2
4 files changed, 19 insertions, 20 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp
index f620b5e..18e5243 100644
--- a/src/adlmidi.cpp
+++ b/src/adlmidi.cpp
@@ -326,7 +326,7 @@ ADLMIDI_EXPORT const char *adl_errorString()
return ADLMIDI_ErrorString.c_str();
}
-ADLMIDI_EXPORT const char *adl_errorInfo(ADL_MIDIPlayer *device)
+ADLMIDI_EXPORT const char *adl_errorInfo(struct ADL_MIDIPlayer *device)
{
if(!device)
return adl_errorString();
@@ -336,7 +336,7 @@ ADLMIDI_EXPORT const char *adl_errorInfo(ADL_MIDIPlayer *device)
return play->getErrorString().c_str();
}
-ADLMIDI_EXPORT const char *adl_getMusicTitle(ADL_MIDIPlayer *device)
+ADLMIDI_EXPORT const char *adl_getMusicTitle(struct ADL_MIDIPlayer *device)
{
if(!device)
return "";
@@ -346,7 +346,7 @@ ADLMIDI_EXPORT const char *adl_getMusicTitle(ADL_MIDIPlayer *device)
return play->musTitle.c_str();
}
-ADLMIDI_EXPORT void adl_close(ADL_MIDIPlayer *device)
+ADLMIDI_EXPORT void adl_close(struct ADL_MIDIPlayer *device)
{
if(device->adl_midiPlayer)
delete reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
@@ -355,7 +355,7 @@ ADLMIDI_EXPORT void adl_close(ADL_MIDIPlayer *device)
device = NULL;
}
-ADLMIDI_EXPORT void adl_reset(ADL_MIDIPlayer *device)
+ADLMIDI_EXPORT void adl_reset(struct ADL_MIDIPlayer *device)
{
if(!device)
return;
@@ -365,7 +365,7 @@ ADLMIDI_EXPORT void adl_reset(ADL_MIDIPlayer *device)
play->opl.Reset(play->m_setup.PCM_RATE);
}
-ADLMIDI_EXPORT double adl_totalTimeLength(ADL_MIDIPlayer *device)
+ADLMIDI_EXPORT double adl_totalTimeLength(struct ADL_MIDIPlayer *device)
{
if(!device)
return -1.0;
@@ -516,7 +516,6 @@ inline static void SendStereoAudio(MIDIplay::Setup &device,
{
if(!in_size)
return;
-
device.stored_samples = 0;
size_t offset = static_cast<size_t>(out_pos);
size_t inSamples = static_cast<size_t>(in_size * 2);
@@ -538,7 +537,9 @@ inline static void SendStereoAudio(MIDIplay::Setup &device,
ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out)
{
#ifdef ADLMIDI_HW_OPL
- (void)device; (void)sampleCount; (void)out;
+ (void)device;
+ (void)sampleCount;
+ (void)out;
return 0;
#else
sampleCount -= sampleCount % 2; //Avoid even sample requests
@@ -602,8 +603,8 @@ ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out)
//fill buffer with zeros
int16_t *out_buf = player->outBuf;
std::memset(out_buf, 0, static_cast<size_t>(in_generatedPhys) * sizeof(int16_t));
-
- if(player->m_setup.NumCards == 1)
+ unsigned int chips = player->opl.NumCards;
+ if(chips == 1)
{
#ifdef ADLMIDI_USE_DOSBOX_OPL
player->opl.cards[0].GenerateArr(out_buf, &in_generatedStereo);
@@ -615,7 +616,7 @@ ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out)
else if(n_periodCountStereo > 0)
{
/* Generate data from every chip and mix result */
- for(unsigned card = 0; card < player->m_setup.NumCards; ++card)
+ for(unsigned card = 0; card < chips; ++card)
{
#ifdef ADLMIDI_USE_DOSBOX_OPL
player->opl.cards[card].GenerateArrMix(out_buf, &in_generatedStereo);
@@ -641,10 +642,12 @@ ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out)
}
-ADLMIDI_EXPORT int adl_generate(ADL_MIDIPlayer *device, int sampleCount, short *out)
+ADLMIDI_EXPORT int adl_generate(struct ADL_MIDIPlayer *device, int sampleCount, short *out)
{
#ifdef ADLMIDI_HW_OPL
- (void)device; (void)sampleCount; (void)out;
+ (void)device;
+ (void)sampleCount;
+ (void)out;
return 0;
#else
sampleCount -= sampleCount % 2; //Avoid even sample requests
@@ -689,7 +692,7 @@ ADLMIDI_EXPORT int adl_generate(ADL_MIDIPlayer *device, int sampleCount, short *
#endif
}
-ADLMIDI_EXPORT double adl_tickEvents(ADL_MIDIPlayer *device, double seconds, double granuality)
+ADLMIDI_EXPORT double adl_tickEvents(struct ADL_MIDIPlayer *device, double seconds, double granuality)
{
if(!device)
return -1.0;
@@ -699,7 +702,7 @@ ADLMIDI_EXPORT double adl_tickEvents(ADL_MIDIPlayer *device, double seconds, dou
return player->Tick(seconds, granuality);
}
-ADLMIDI_EXPORT int adl_atEnd(ADL_MIDIPlayer *device)
+ADLMIDI_EXPORT int adl_atEnd(struct ADL_MIDIPlayer *device)
{
if(!device)
return 1;
@@ -709,7 +712,7 @@ ADLMIDI_EXPORT int adl_atEnd(ADL_MIDIPlayer *device)
return (int)player->atEnd;
}
-ADLMIDI_EXPORT void adl_panic(ADL_MIDIPlayer *device)
+ADLMIDI_EXPORT void adl_panic(struct ADL_MIDIPlayer *device)
{
if(!device)
return;
diff --git a/src/adlmidi_load.cpp b/src/adlmidi_load.cpp
index 67faead..ad184e4 100644
--- a/src/adlmidi_load.cpp
+++ b/src/adlmidi_load.cpp
@@ -329,10 +329,8 @@ bool MIDIplay::LoadMIDI(const std::string &filename)
{
fileReader file;
file.openFile(filename.c_str());
-
if(!LoadMIDI(file))
return false;
-
return true;
}
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 51da17e..6024373 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -1237,7 +1237,7 @@ void MIDIplay::realTime_Controller(uint8_t channel, uint8_t type, uint8_t value)
case 121: // Reset all controllers
Ch[channel].bend = 0;
Ch[channel].volume = 100;
- Ch[channel].expression = 100;
+ Ch[channel].expression = 127;
Ch[channel].sustain = 0;
Ch[channel].vibrato = 0;
Ch[channel].vibspeed = 2 * 3.141592653 * 5.0;
diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp
index bdf9577..5162c11 100644
--- a/src/adlmidi_private.hpp
+++ b/src/adlmidi_private.hpp
@@ -893,9 +893,7 @@ private:
MIDIchannel::activenoteiterator i,
unsigned props_mask,
int32_t select_adlchn = -1);
- bool ProcessEvents();
bool ProcessEventsNew(bool isSeek = false);
- void HandleEvent(size_t tk);
void HandleEvent(size_t tk, const MidiEvent &evt, int &status);
// Determine how good a candidate this adlchannel