More refactoring
This commit is contained in:
parent
2423ec9bc6
commit
e5e3a83302
|
@ -37,6 +37,9 @@ static constexpr int64_t CNT_MAX = std::numeric_limits<int64_t>::max() & ~7;
|
||||||
static constexpr int MuteFrequency = 1;
|
static constexpr int MuteFrequency = 1;
|
||||||
static constexpr int MuteInit = 2;
|
static constexpr int MuteInit = 2;
|
||||||
static constexpr int MuteSerialInput = 8;
|
static constexpr int MuteSerialInput = 8;
|
||||||
|
//just some magick value to match the audio level of mzpokeysnd
|
||||||
|
static constexpr int16_t MAGICK_VOLUME_BOOSTER = 160;
|
||||||
|
static constexpr int16_t MAGICK_OSC_VOLUME_BOOSTER = 4;
|
||||||
|
|
||||||
struct PokeyBase
|
struct PokeyBase
|
||||||
{
|
{
|
||||||
|
@ -219,15 +222,15 @@ public:
|
||||||
int32_t volume = value & 0x0f;
|
int32_t volume = value & 0x0f;
|
||||||
if ( ( value & 0x10 ) != 0 )
|
if ( ( value & 0x10 ) != 0 )
|
||||||
{
|
{
|
||||||
mDelta = volume;
|
mDelta = volume * MAGICK_VOLUME_BOOSTER;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
muteUltrasound( cycle );
|
muteUltrasound( cycle );
|
||||||
if ( mDelta > 0 )
|
if ( mDelta > 0 )
|
||||||
mDelta = volume;
|
mDelta = volume * MAGICK_VOLUME_BOOSTER;
|
||||||
else
|
else
|
||||||
mDelta = -volume;
|
mDelta = -volume * MAGICK_VOLUME_BOOSTER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +286,8 @@ public:
|
||||||
|
|
||||||
PokeyPimpl( uint32_t pokeyClock, uint32_t sampleRate ) : PokeyBase{}, mQueue{ std::make_unique<ActionQueue>() },
|
PokeyPimpl( uint32_t pokeyClock, uint32_t sampleRate ) : PokeyBase{}, mQueue{ std::make_unique<ActionQueue>() },
|
||||||
mAudioChannels{ AudioChannel{ *mQueue, 0u }, AudioChannel{ *mQueue, 1u }, AudioChannel{ *mQueue, 2u }, AudioChannel{ *mQueue, 3u } },
|
mAudioChannels{ AudioChannel{ *mQueue, 0u }, AudioChannel{ *mQueue, 1u }, AudioChannel{ *mQueue, 2u }, AudioChannel{ *mQueue, 3u } },
|
||||||
mRegisterPool{}, mTick{}, mNextTick{}, mReloadCycles1{ 28 }, mReloadCycles3{ 28 }, mDivCycles{ 28 }, mSampleRate{ sampleRate }, mSamplesRemainder{},
|
mRegisterPool{}, mTick{}, mNextTick{},
|
||||||
|
mReloadCycles1{ 28 }, mReloadCycles3{ 28 }, mDivCycles{ 28 }, mSampleRate{ sampleRate }, mSamplesRemainder{},
|
||||||
mTicksPerSample{ ( pokeyClock * 8 ) / mSampleRate, ( pokeyClock * 8 ) % mSampleRate }
|
mTicksPerSample{ ( pokeyClock * 8 ) / mSampleRate, ( pokeyClock * 8 ) % mSampleRate }
|
||||||
{
|
{
|
||||||
std::fill_n( mRegisterPool.data(), mRegisterPool.size(), (uint8_t)0xff );
|
std::fill_n( mRegisterPool.data(), mRegisterPool.size(), (uint8_t)0xff );
|
||||||
|
@ -493,19 +497,17 @@ public:
|
||||||
int64_t value = mQueue->pop();
|
int64_t value = mQueue->pop();
|
||||||
if ( ( value & 7 ) == 6 ) // 6 == 4 ^ 2
|
if ( ( value & 7 ) == 6 ) // 6 == 4 ^ 2
|
||||||
{
|
{
|
||||||
//just some magick value to match the audio level of mzpokeysnd
|
int16_t ch0 = mAudioChannels[0].getOutput();
|
||||||
static constexpr int16_t MAGICK_VOLUME_BOOSTER = 160;
|
int16_t ch1 = mAudioChannels[1].getOutput();
|
||||||
int16_t ch0 = mAudioChannels[0].getOutput() * MAGICK_VOLUME_BOOSTER;
|
int16_t ch2 = mAudioChannels[2].getOutput();
|
||||||
int16_t ch1 = mAudioChannels[1].getOutput() * MAGICK_VOLUME_BOOSTER;
|
int16_t ch3 = mAudioChannels[3].getOutput();
|
||||||
int16_t ch2 = mAudioChannels[2].getOutput() * MAGICK_VOLUME_BOOSTER;
|
|
||||||
int16_t ch3 = mAudioChannels[3].getOutput() * MAGICK_VOLUME_BOOSTER;
|
|
||||||
|
|
||||||
if ( oscb != nullptr )
|
if ( oscb != nullptr )
|
||||||
{
|
{
|
||||||
oscb[0]->data[oscb[0]->needle++]=ch0;
|
oscb[0]->data[oscb[0]->needle++]=ch0 * MAGICK_OSC_VOLUME_BOOSTER;
|
||||||
oscb[1]->data[oscb[1]->needle++]=ch1;
|
oscb[1]->data[oscb[1]->needle++]=ch1 * MAGICK_OSC_VOLUME_BOOSTER;
|
||||||
oscb[2]->data[oscb[2]->needle++]=ch2;
|
oscb[2]->data[oscb[2]->needle++]=ch2 * MAGICK_OSC_VOLUME_BOOSTER;
|
||||||
oscb[3]->data[oscb[3]->needle++]=ch3;
|
oscb[3]->data[oscb[3]->needle++]=ch3 * MAGICK_OSC_VOLUME_BOOSTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
enqueueSampling();
|
enqueueSampling();
|
||||||
|
|
Loading…
Reference in New Issue