Skip to content

Commit

Permalink
Merge pull request #95 from jpcima/fix-ps4op
Browse files Browse the repository at this point in the history
fix F-mul for pseudo-4op
  • Loading branch information
Wohlstand authored Aug 31, 2018
2 parents 92d4b93 + d888217 commit 98b1634
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/opl/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void Generator::NoteOff(uint32_t c)
WriteReg(0xB0 + g_Channels[cc], m_keyBlockFNumCache[c] & 0xDF);
}

void Generator::NoteOn(uint32_t c1, uint32_t c2, double hertz) // Hertz range: 0..131071
void Generator::NoteOn(uint32_t c1, uint32_t c2, double hertz, bool voice2ps4op) // Hertz range: 0..131071
{
uint32_t cc1 = c1 % 23;
uint32_t cc2 = c2 % 23;
Expand Down Expand Up @@ -318,8 +318,8 @@ void Generator::NoteOn(uint32_t c1, uint32_t c2, double hertz) // Hertz range: 0
};
const uint8_t ops[4] =
{
m_patch.OPS[0].modulator_20,
m_patch.OPS[0].carrier_20,
m_patch.OPS[voice2ps4op ? 1 : 0].modulator_20,
m_patch.OPS[voice2ps4op ? 1 : 0].carrier_20,
m_patch.OPS[1].modulator_20,
m_patch.OPS[1].carrier_20
};
Expand Down Expand Up @@ -564,7 +564,7 @@ void Generator::PlayNoteCh(int ch)
if(pseudo_4op)
{
bend = m_bend + m_patch.OPS[i[1]].finetune + m_patch.voice2_fine_tune;
NoteOn(adlchannel[1], 0, BEND_COEFFICIENT * std::exp(0.057762265 * (tone + bend + phase)));
NoteOn(adlchannel[1], 0, BEND_COEFFICIENT * std::exp(0.057762265 * (tone + bend + phase)), true);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/opl/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ class Generator
* @brief Set the tone frequency on the chip channel and turn note on
* @param c1 2-op channel or 4-op master channel index
* @param c2 4-op slave channel, unused with 2-op
* @param voice2ps4op where it is the second voice of a pseudo-4op instrument
* @param hertz Tone frequency
*/
void NoteOn(uint32_t c1, uint32_t c2, double hertz);
void NoteOn(uint32_t c1, uint32_t c2, double hertz, bool voice2ps4op = false);

/**
* @brief Turn the note off
Expand Down

0 comments on commit 98b1634

Please sign in to comment.