diff options
author | Vitaly Novichkov <Wohlstand@users.noreply.github.com> | 2019-02-25 02:16:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 02:16:59 +0300 |
commit | 77986b95e038ee12cf5b226c2a6aa15b85ecba61 (patch) | |
tree | f4f3c1bf613d3bd796fb604bef5cd77de68684c2 /src | |
parent | bdc982ef4263fcc4283921a2a375eab4c9073271 (diff) | |
parent | 848f2f27da8be9fb0f2ca9efd11a87ede42d1488 (diff) | |
download | libADLMIDI-77986b95e038ee12cf5b226c2a6aa15b85ecba61.tar.gz libADLMIDI-77986b95e038ee12cf5b226c2a6aa15b85ecba61.tar.bz2 libADLMIDI-77986b95e038ee12cf5b226c2a6aa15b85ecba61.zip |
Merge pull request #211 from jpcima/opal
opal: registers $Ax $Bx affect both channels in 4op
Diffstat (limited to 'src')
-rw-r--r-- | src/chips/opal/opal.hpp | 17 |
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; } |