mckuhei / Nuked-SC55

Forked from nukeykt, dedicated to SC-55mkII
Other
3 stars 0 forks source link

REQUEST: Branch that uses jcmoyer's Nuked Code #1

Open linoshkmalayil opened 1 week ago

linoshkmalayil commented 1 week ago

I usually use jcmoyer's repo (https://github.com/jcmoyer/Nuked-SC55) I was wondering whether you would be okay to have a branch that has the changes jcmoyer integrated with your GUI code? I have done the work to merge your code with his. Is my code 100% functional? Not sure, it runs and seems to play as expected, although the final volume is much lower. But thought it would be interesting to have this branch.

mckuhei commented 6 days ago

The reason why the volume is lower is because I implemented a knob to control the volume, which by default reduces the original 20bit output by -18dB

linoshkmalayil commented 6 days ago

What I meant was that the max volume is still much lower than your version.

mckuhei commented 5 days ago

I already know what causes the sound to be smaller. Just need to replace these lines in https://github.com/linoshkmalayil/Nuked-SC55-GUI-Float/blob/cd6f87d517365426ffd920b2c512d78406b2823d/src/audio.h#L23

inline void Normalize(const AudioFrame<int32_t>& in, AudioFrame<int16_t>& out)
{
    out.left  = (int16_t)Clamp<int32_t>(in.left >> 12, INT16_MIN, INT16_MAX);
    out.right = (int16_t)Clamp<int32_t>(in.right >> 12, INT16_MIN, INT16_MAX);
}

inline void Normalize(const AudioFrame<int32_t>& in, AudioFrame<int32_t>& out)
{
    out.left  = (int32_t)Clamp<int64_t>((int64_t)in.left << 4, INT32_MIN, INT32_MAX);
    out.right = (int32_t)Clamp<int64_t>((int64_t)in.right << 4, INT32_MIN, INT32_MAX);
}

inline void Normalize(const AudioFrame<int32_t>& in, AudioFrame<float>& out)
{
    constexpr float DIV_REC = 1.0f / 67108864.0f;

    out.left  = (float)in.left * DIV_REC;
    out.right = (float)in.right * DIV_REC;
}
mckuhei commented 5 days ago

Do you plan to port the serial interface to your fork? If so, could you help me implement serial port reading and writing on Unix?

linoshkmalayil commented 5 days ago

To be honest, while I have experience on C++, I have rarely directly communicated with devices directly in Linux. So I am a newbie in this front. However, I do have a decent understanding of Linux and C++, so I should be able to help you out whenever I can.