per-channel oscilloscope, part 6
YM2612 and OPM (ymfm)!
This commit is contained in:
parent
c0e9b48b5b
commit
415e490025
6 changed files with 39 additions and 5 deletions
|
|
@ -301,6 +301,7 @@ public:
|
|||
|
||||
// simple getters for debugging
|
||||
fm_operator<RegisterType> *debug_operator(uint32_t index) const { return m_op[index]; }
|
||||
int32_t debug_output(uint32_t index) const { return m_output[index]; }
|
||||
|
||||
private:
|
||||
// helper to add values to the outputs based on channel enables
|
||||
|
|
@ -313,14 +314,22 @@ private:
|
|||
constexpr int out2_index = 2 % RegisterType::OUTPUTS;
|
||||
constexpr int out3_index = 3 % RegisterType::OUTPUTS;
|
||||
|
||||
if (RegisterType::OUTPUTS == 1 || m_regs.ch_output_0(choffs))
|
||||
if (RegisterType::OUTPUTS == 1 || m_regs.ch_output_0(choffs)) {
|
||||
m_output[out0_index]=value;
|
||||
output.data[out0_index] += value;
|
||||
if (RegisterType::OUTPUTS >= 2 && m_regs.ch_output_1(choffs))
|
||||
}
|
||||
if (RegisterType::OUTPUTS >= 2 && m_regs.ch_output_1(choffs)) {
|
||||
m_output[out1_index]=value;
|
||||
output.data[out1_index] += value;
|
||||
if (RegisterType::OUTPUTS >= 3 && m_regs.ch_output_2(choffs))
|
||||
}
|
||||
if (RegisterType::OUTPUTS >= 3 && m_regs.ch_output_2(choffs)) {
|
||||
m_output[out2_index]=value;
|
||||
output.data[out2_index] += value;
|
||||
if (RegisterType::OUTPUTS >= 4 && m_regs.ch_output_3(choffs))
|
||||
}
|
||||
if (RegisterType::OUTPUTS >= 4 && m_regs.ch_output_3(choffs)) {
|
||||
m_output[out3_index]=value;
|
||||
output.data[out3_index] += value;
|
||||
}
|
||||
}
|
||||
|
||||
// internal state
|
||||
|
|
@ -330,6 +339,7 @@ private:
|
|||
fm_operator<RegisterType> *m_op[4]; // up to 4 operators
|
||||
RegisterType &m_regs; // direct reference to registers
|
||||
fm_engine_base<RegisterType> &m_owner; // reference to the owning engine
|
||||
mutable int32_t m_output[4];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -808,7 +808,8 @@ fm_channel<RegisterType>::fm_channel(fm_engine_base<RegisterType> &owner, uint32
|
|||
m_feedback_in(0),
|
||||
m_op{ nullptr, nullptr, nullptr, nullptr },
|
||||
m_regs(owner.regs()),
|
||||
m_owner(owner)
|
||||
m_owner(owner),
|
||||
m_output{ 0, 0, 0, 0 }
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -823,6 +824,11 @@ void fm_channel<RegisterType>::reset()
|
|||
// reset our data
|
||||
m_feedback[0] = m_feedback[1] = 0;
|
||||
m_feedback_in = 0;
|
||||
|
||||
m_output[0] = 0;
|
||||
m_output[1] = 0;
|
||||
m_output[2] = 0;
|
||||
m_output[3] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -281,6 +281,9 @@ public:
|
|||
// generate one sample of sound
|
||||
void generate(output_data *output, uint32_t numsamples = 1);
|
||||
|
||||
// get the engine
|
||||
fm_engine* debug_engine() { return &m_fm; }
|
||||
|
||||
protected:
|
||||
// variants
|
||||
enum opm_variant
|
||||
|
|
|
|||
|
|
@ -761,6 +761,9 @@ public:
|
|||
// generate one sample of sound
|
||||
void generate(output_data *output, uint32_t numsamples = 1);
|
||||
|
||||
// get the engine
|
||||
fm_engine* debug_engine() { return &m_fm; }
|
||||
|
||||
protected:
|
||||
// simulate the DAC discontinuity
|
||||
constexpr int32_t dac_discontinuity(int32_t value) const { return (value < 0) ? (value - 2) : (value + 3); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue