Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix F-mul for pseudo-4op #95

Merged
merged 2 commits into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 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 @@ -559,12 +559,12 @@ void Generator::PlayNoteCh(int ch)
Touch_Real(adlchannel[1], chipvolume);

bend = m_bend + m_patch.OPS[i[0]].finetune;
NoteOn(adlchannel[0], adlchannel[1], BEND_COEFFICIENT * std::exp(0.057762265 * (tone + bend + phase)));
NoteOn(adlchannel[0], adlchannel[1], BEND_COEFFICIENT * std::exp(0.057762265 * (tone + bend + phase)), false);

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 Expand Up @@ -639,7 +639,7 @@ void Generator::PlayDrum(uint8_t drum, int noteID)
double bend = 0.0;
double phase = 0.0;
bend = 0.0 + m_patch.OPS[0].finetune;
NoteOn(adlchannel, 0, BEND_COEFFICIENT * std::exp(0.057762265 * (tone + bend + phase)));
NoteOn(adlchannel, 0, BEND_COEFFICIENT * std::exp(0.057762265 * (tone + bend + phase)), false);
}

void Generator::switch4op(bool enabled, bool patchCleanUp)
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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make it be default =false


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