aboutsummaryrefslogtreecommitdiff
path: root/src/chips/opal/opal.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/chips/opal/opal.hpp')
-rw-r--r--src/chips/opal/opal.hpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/chips/opal/opal.hpp b/src/chips/opal/opal.hpp
index c383bd5..1aa0c7d 100644
--- a/src/chips/opal/opal.hpp
+++ b/src/chips/opal/opal.hpp
@@ -142,6 +142,7 @@ class Opal {
uint16_t GetOctave() const { return Octave; }
uint16_t GetKeyScaleNumber() const { return KeyScaleNumber; }
uint16_t GetModulationType() const { return ModulationType; }
+ Channel * GetChannelPair() const { return ChannelPair; } /* libADLMIDI */
void ComputeKeyScaleNumber();
@@ -475,20 +476,28 @@ void Opal::Port(uint16_t reg_num, uint8_t val) {
Channel &chan = Chan[chan_num];
+ /* libADLMIDI: registers Ax and Cx affect both channels */
+ Channel *chans[2] = {&chan, chan.GetChannelPair()};
+ unsigned numchans = chans[1] ? 2 : 1;
+
// Do specific registers
switch (reg_num & 0xF0) {
// Frequency low
case 0xA0: {
- chan.SetFrequencyLow(val);
+ for (unsigned i = 0; i < numchans; ++i) { /* libADLMIDI */
+ chans[i]->SetFrequencyLow(val);
+ }
break;
}
// Key-on / Octave / Frequency High
case 0xB0: {
- chan.SetKeyOn((val & 0x20) != 0);
- chan.SetOctave(val >> 2 & 7);
- chan.SetFrequencyHigh(val & 3);
+ for (unsigned i = 0; i < numchans; ++i) { /* libADLMIDI */
+ chans[i]->SetKeyOn((val & 0x20) != 0);
+ chans[i]->SetOctave(val >> 2 & 7);
+ chans[i]->SetFrequencyHigh(val & 3);
+ }
break;
}