Skip to content

Commit 5cf6b70

Browse files
committed
Implemented hasMidiProgramsChanged support.
1 parent f3c6d9b commit 5cf6b70

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/OPL3GM.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ OPL3GM::OPL3GM (audioMasterCallback audioMaster)
5050
memset(&hi, 0, sizeof(hi));
5151
memset(vu, 0, sizeof(vu));
5252
CPULoad = 0;
53+
memset(channelPrograms, 0, sizeof(channelPrograms));
5354
initSynth ();
5455
initBuffer ();
5556
#ifdef DEMO

src/OPL3GM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class OPL3GM : public AudioEffectX
198198
LockableObject lock;
199199
double vu[2];
200200
double CPULoad;
201+
VstInt32 channelPrograms[16];
201202
#ifdef DEMO
202203
time_t startTime;
203204
#endif

src/midiprog.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ VstInt32 OPL3GM::getCurrentMidiProgram (VstInt32 channel, MidiProgramName* mpn)
4141
if (synth)
4242
{
4343
prg = synth->midi_getprogram(channel);
44+
channelPrograms[channel] = prg;
4445
}
4546
mpn->thisProgramIndex = prg;
4647
fillProgram (channel, prg, mpn);
@@ -100,7 +101,16 @@ VstInt32 OPL3GM::getMidiProgramCategory (VstInt32 channel, MidiProgramCategory*
100101

101102
bool OPL3GM::hasMidiProgramsChanged (VstInt32 channel)
102103
{
103-
return false; // updateDisplay ()
104+
if (channel < 0 || channel >= 16)
105+
return false;
106+
if (synth)
107+
{
108+
if (synth->midi_getprogram(channel) != channelPrograms[channel])
109+
{
110+
return true;
111+
}
112+
}
113+
return false;
104114
}
105115

106116
bool OPL3GM::getMidiKeyName (VstInt32 channel, MidiKeyName* key)

0 commit comments

Comments
 (0)