diff --git a/CMakeLists.txt b/CMakeLists.txt index 3197b77..0beb322 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,8 @@ add_executable(unit_tests sources/PPU/Background.hpp sources/CPU/DMA/DMA.cpp sources/CPU/DMA/DMA.hpp + sources/APU/DSP/Voice.cpp + sources/APU/DSP/Echo.cpp ) # include criterion & coverage @@ -223,6 +225,8 @@ add_executable(ComSquare sources/PPU/Background.hpp sources/CPU/DMA/DMA.cpp sources/CPU/DMA/DMA.hpp + sources/APU/DSP/Voice.cpp + sources/APU/DSP/Echo.cpp ) target_compile_definitions(ComSquare PUBLIC DEBUGGER_ENABLED) diff --git a/sources/APU/APU.cpp b/sources/APU/APU.cpp index 82068a7..fa616ab 100644 --- a/sources/APU/APU.cpp +++ b/sources/APU/APU.cpp @@ -718,6 +718,7 @@ namespace ComSquare::APU if (this->_state == Running) this->_paddingCycles = total - cycles; + this->_dsp->update(); samples = this->_dsp->getSamplesCount(); if (samples > 0) this->_renderer.playAudio(this->_soundBuffer, samples / 2); diff --git a/sources/APU/DSP/DSP.cpp b/sources/APU/DSP/DSP.cpp index 75e604e..80635ef 100644 --- a/sources/APU/DSP/DSP.cpp +++ b/sources/APU/DSP/DSP.cpp @@ -18,37 +18,37 @@ namespace ComSquare::APU::DSP { switch (addr) { case 0x00: - return this->_voices[0].volL; + return this->_voices[0].volume[0]; case 0x10: - return this->_voices[1].volL; + return this->_voices[1].volume[0]; case 0x20: - return this->_voices[2].volL; + return this->_voices[2].volume[0]; case 0x30: - return this->_voices[3].volL; + return this->_voices[3].volume[0]; case 0x40: - return this->_voices[4].volL; + return this->_voices[4].volume[0]; case 0x50: - return this->_voices[5].volL; + return this->_voices[5].volume[0]; case 0x60: - return this->_voices[6].volL; + return this->_voices[6].volume[0]; case 0x70: - return this->_voices[7].volL; + return this->_voices[7].volume[0]; case 0x01: - return this->_voices[0].volR; + return this->_voices[0].volume[1]; case 0x11: - return this->_voices[1].volR; + return this->_voices[1].volume[1]; case 0x21: - return this->_voices[2].volR; + return this->_voices[2].volume[1]; case 0x31: - return this->_voices[3].volR; + return this->_voices[3].volume[1]; case 0x41: - return this->_voices[4].volR; + return this->_voices[4].volume[1]; case 0x51: - return this->_voices[5].volR; + return this->_voices[5].volume[1]; case 0x61: - return this->_voices[6].volR; + return this->_voices[6].volume[1]; case 0x71: - return this->_voices[7].volR; + return this->_voices[7].volume[1]; case 0x02: return this->_voices[0].pitchL; case 0x12: @@ -146,45 +146,31 @@ namespace ComSquare::APU::DSP case 0x77: return this->_voices[7].gain; case 0x08: - return this->_voices[0].envx; case 0x18: - return this->_voices[1].envx; case 0x28: - return this->_voices[2].envx; case 0x38: - return this->_voices[3].envx; case 0x48: - return this->_voices[4].envx; case 0x58: - return this->_voices[5].envx; case 0x68: - return this->_voices[6].envx; case 0x78: - return this->_voices[7].envx; + return this->_latch.envx; case 0x09: - return this->_voices[0].outx; case 0x19: - return this->_voices[1].outx; case 0x29: - return this->_voices[2].outx; case 0x39: - return this->_voices[3].outx; case 0x49: - return this->_voices[4].outx; case 0x59: - return this->_voices[5].outx; case 0x69: - return this->_voices[6].outx; case 0x79: - return this->_voices[7].outx; + return this->_latch.outx; case 0x0C: - return this->_registers.mvolL; + return this->_master.volume[0]; case 0x1C: - return this->_registers.mvolR; + return this->_master.volume[1]; case 0x2C: - return this->_registers.evolL; + return this->_echo.volume[0]; case 0x3C: - return this->_registers.evolR; + return this->_echo.volume[1]; case 0x4C: { uint8_t kon = 0; @@ -199,8 +185,14 @@ namespace ComSquare::APU::DSP kof |= this->_voices[i].kof << i; return kof; } - case 0x6C: - return this->_registers.flg; + case 0x6C: { + uint8_t flg = 0; + flg += this->_master.reset << 7; + flg += this->_master.mute << 6; + flg += this->_echo.enabled << 5; + flg += this->_noise.clock; + return flg; + } case 0x7C: { uint8_t endx = 0; @@ -209,9 +201,9 @@ namespace ComSquare::APU::DSP return endx; } case 0x0D: - return this->_registers.efb; + return this->_echo.feedback; case 0x1D: - return this->_registers.unused; + return this->_master.unused; case 0x2D: { uint8_t pmon = 0; @@ -234,27 +226,27 @@ namespace ComSquare::APU::DSP return eon; } case 0x5D: - return this->_registers.dir; + return this->_brr.offset; case 0x6D: - return this->_registers.esa; + return this->_echo.data; case 0x7D: - return this->_registers.edl; + return this->_echo.delay; case 0x0F: - return this->_voices[0].coeff; + return this->_echo.FIR[0]; case 0x1F: - return this->_voices[1].coeff; + return this->_echo.FIR[1]; case 0x2F: - return this->_voices[2].coeff; + return this->_echo.FIR[2]; case 0x3F: - return this->_voices[3].coeff; + return this->_echo.FIR[3]; case 0x4F: - return this->_voices[4].coeff; + return this->_echo.FIR[4]; case 0x5F: - return this->_voices[5].coeff; + return this->_echo.FIR[5]; case 0x6F: - return this->_voices[6].coeff; + return this->_echo.FIR[6]; case 0x7F: - return this->_voices[7].coeff; + return this->_echo.FIR[7]; default: throw InvalidAddress("DSP Registers read", addr); } @@ -264,52 +256,52 @@ namespace ComSquare::APU::DSP { switch (addr) { case 0x00: - this->_voices[0].volL = data; + this->_voices[0].volume[0] = data; break; case 0x10: - this->_voices[1].volL = data; + this->_voices[1].volume[0] = data; break; case 0x20: - this->_voices[2].volL = data; + this->_voices[2].volume[0] = data; break; case 0x30: - this->_voices[3].volL = data; + this->_voices[3].volume[0] = data; break; case 0x40: - this->_voices[4].volL = data; + this->_voices[4].volume[0] = data; break; case 0x50: - this->_voices[5].volL = data; + this->_voices[5].volume[0] = data; break; case 0x60: - this->_voices[6].volL = data; + this->_voices[6].volume[0] = data; break; case 0x70: - this->_voices[7].volL = data; + this->_voices[7].volume[0] = data; break; case 0x01: - this->_voices[0].volR = data; + this->_voices[0].volume[1] = data; break; case 0x11: - this->_voices[1].volR = data; + this->_voices[1].volume[1] = data; break; case 0x21: - this->_voices[2].volR = data; + this->_voices[2].volume[1] = data; break; case 0x31: - this->_voices[3].volR = data; + this->_voices[3].volume[1] = data; break; case 0x41: - this->_voices[4].volR = data; + this->_voices[4].volume[1] = data; break; case 0x51: - this->_voices[5].volR = data; + this->_voices[5].volume[1] = data; break; case 0x61: - this->_voices[6].volR = data; + this->_voices[6].volume[1] = data; break; case 0x71: - this->_voices[7].volR = data; + this->_voices[7].volume[1] = data; break; case 0x02: this->_voices[0].pitchL = data; @@ -480,61 +472,51 @@ namespace ComSquare::APU::DSP this->_voices[7].envx = data; break; case 0x09: - this->_voices[0].outx = data; - break; case 0x19: - this->_voices[1].outx = data; - break; case 0x29: - this->_voices[2].outx = data; - break; case 0x39: - this->_voices[3].outx = data; - break; case 0x49: - this->_voices[4].outx = data; - break; case 0x59: - this->_voices[5].outx = data; - break; case 0x69: - this->_voices[6].outx = data; - break; case 0x79: - this->_voices[7].outx = data; + this->_latch.outx = data; break; case 0x0C: - this->_registers.mvolL = data; + this->_master.volume[0] = data; break; case 0x1C: - this->_registers.mvolR = data; + this->_master.volume[1] = data; break; case 0x2C: - this->_registers.evolL = data; + this->_echo.volume[0] = data; break; case 0x3C: - this->_registers.evolR = data; + this->_echo.volume[1] = data; break; case 0x4C: - for (int i = 0; i < 8; i++) - this->_voices[i].kon |= data << i; + for (int i = 0; i < 8; i++) { + this->_voices[i].kon |= data << i; + } break; case 0x5C: for (int i = 0; i < 8; i++) this->_voices[i].kof |= data << i; break; case 0x6C: - this->_registers.flg = data; + this->_master.reset = data >> 7; + this->_master.mute = (data >> 6) & 0b1; + this->_echo.enabled = (data >> 5) & 0b1; + this->_noise.clock = data & 0b1111; break; case 0x7C: for (int i = 0; i < 8; i++) this->_voices[i].endx |= data << i; break; case 0x0D: - this->_registers.efb = data; + this->_echo.feedback = data; break; case 0x1D: - this->_registers.unused = data; + this->_master.unused = data; break; case 0x2D: for (int i = 0; i < 8; i++) @@ -549,37 +531,37 @@ namespace ComSquare::APU::DSP this->_voices[i].eon |= data << i; break; case 0x5D: - this->_registers.dir = data; + this->_brr.offset = data; break; case 0x6D: - this->_registers.esa = data; + this->_echo.data = data; break; case 0x7D: - this->_registers.edl = data; + this->_echo.delay = data; break; case 0x0F: - this->_voices[0].coeff = data; + this->_echo.FIR[0] = data; break; case 0x1F: - this->_voices[1].coeff = data; + this->_echo.FIR[1] = data; break; case 0x2F: - this->_voices[2].coeff = data; + this->_echo.FIR[2] = data; break; case 0x3F: - this->_voices[3].coeff = data; + this->_echo.FIR[3] = data; break; case 0x4F: - this->_voices[4].coeff = data; + this->_echo.FIR[4] = data; break; case 0x5F: - this->_voices[5].coeff = data; + this->_echo.FIR[5] = data; break; case 0x6F: - this->_voices[6].coeff = data; + this->_echo.FIR[6] = data; break; case 0x7F: - this->_voices[7].coeff = data; + this->_echo.FIR[7] = data; break; default: throw InvalidAddress("DSP Registers write", addr); @@ -588,20 +570,193 @@ namespace ComSquare::APU::DSP void DSP::update() { + switch (this->_state.voice) { + case 0: + this->voice5(this->_voices[0]); + this->voice2(this->_voices[1]); + break; + case 1: + this->voice6(this->_voices[0]); + this->voice3(this->_voices[1]); + break; + case 2: + this->voice7(this->_voices[0]); + this->voice4(this->_voices[1]); + this->voice1(this->_voices[3]); + break; + case 3: + this->voice8(this->_voices[0]); + this->voice5(this->_voices[1]); + this->voice2(this->_voices[2]); + break; + case 4: + this->voice9(this->_voices[0]); + this->voice6(this->_voices[1]); + this->voice3(this->_voices[2]); + break; + case 5: + this->voice7(this->_voices[1]); + this->voice4(this->_voices[2]); + this->voice1(this->_voices[4]); + break; + case 6: + this->voice8(this->_voices[1]); + this->voice5(this->_voices[2]); + this->voice2(this->_voices[3]); + break; + case 7: + this->voice9(this->_voices[1]); + this->voice6(this->_voices[2]); + this->voice3(this->_voices[3]); + break; + case 8: + this->voice7(this->_voices[2]); + this->voice4(this->_voices[3]); + this->voice1(this->_voices[5]); + break; + case 9: + this->voice8(this->_voices[2]); + this->voice5(this->_voices[3]); + this->voice2(this->_voices[4]); + break; + case 10: + this->voice9(this->_voices[2]); + this->voice6(this->_voices[3]); + this->voice3(this->_voices[4]); + break; + case 11: + this->voice7(this->_voices[3]); + this->voice4(this->_voices[4]); + this->voice1(this->_voices[6]); + break; + case 12: + this->voice8(this->_voices[3]); + this->voice5(this->_voices[4]); + this->voice2(this->_voices[5]); + break; + case 13: + this->voice9(this->_voices[3]); + this->voice6(this->_voices[4]); + this->voice3(this->_voices[5]); + break; + case 14: + this->voice7(this->_voices[4]); + this->voice4(this->_voices[5]); + this->voice1(this->_voices[7]); + break; + case 15: + this->voice8(this->_voices[4]); + this->voice5(this->_voices[5]); + this->voice2(this->_voices[6]); + break; + case 16: + this->voice9(this->_voices[4]); + this->voice6(this->_voices[5]); + this->voice3(this->_voices[6]); + break; + case 17: + this->voice1(this->_voices[0]); + this->voice7(this->_voices[5]); + this->voice4(this->_voices[6]); + break; + case 18: + this->voice8(this->_voices[5]); + this->voice5(this->_voices[6]); + this->voice2(this->_voices[7]); + break; + case 19: + this->voice9(this->_voices[5]); + this->voice6(this->_voices[6]); + this->voice3(this->_voices[7]); + break; + case 20: + this->voice1(this->_voices[1]); + this->voice7(this->_voices[6]); + this->voice4(this->_voices[7]); + break; + case 21: + this->voice8(this->_voices[6]); + this->voice5(this->_voices[7]); + this->voice2(this->_voices[0]); + break; + case 22: + this->voice3a(this->_voices[0]); + this->voice9(this->_voices[6]); + this->voice6(this->_voices[7]); + echo22(); + break; + case 23: + this->voice7(this->_voices[7]); + echo23(); + break; + case 24: + this->voice8(this->_voices[7]); + echo24(); + break; + case 25: + this->voice3b(this->_voices[0]); + this->voice9(this->_voices[7]); + echo25(); + break; + case 26: + echo26(); + break; + case 27: + this->misc27(); + this->echo27(); + break; + case 28: + this->misc28(); + this->echo28(); + break; + case 29: + this->misc29(); + this->echo29(); + break; + case 30: + this->misc30(); + this->voice3c(this->_voices[0]); + this->echo30(); + break; + case 31: + this->voice4(this->_voices[0]); + this->voice1(this->_voices[2]); + break; + } this->_state.voice = (this->_state.voice + 1) % 32; } - Registers DSP::getRegisters() - { - return this->_registers; - } - - std::array DSP::getVoices() + const std::array &DSP::getVoices() { return this->_voices; } - int32_t DSP::getSamplesCount() + const Master &DSP::getMaster() + { + return this->_master; + } + + const Echo &DSP::getEcho() + { + return this->_echo; + } + + const Noise &DSP::getNoise() + { + return this->_noise; + } + + const BRR &DSP::getBrr() + { + return this->_brr; + } + + const Latch &DSP::getLatch() + { + return this->_latch; + } + + int32_t DSP::getSamplesCount() const { return this->_state.buffer - this->_state.bufferStart; } diff --git a/sources/APU/DSP/DSP.hpp b/sources/APU/DSP/DSP.hpp index cc09e0d..8e7a0a0 100644 --- a/sources/APU/DSP/DSP.hpp +++ b/sources/APU/DSP/DSP.hpp @@ -11,34 +11,159 @@ namespace ComSquare::APU::DSP { - //! @brief All the registers of the DSP - struct Registers { - //! @brief Left output of the Main Volume register - uint8_t mvolL; - //! @brief Right output of the Main Volume register - uint8_t mvolR; + struct Master { + //! @brief Main Volume register (MVOL) + std::array volume; + //! @brief Mutes all channel (6th bit FLG) + bool mute : 1; + //! @brief Soft reset DSP (7th bit FLG) + bool reset : 1; + //! @brief Current sound produced + std::array output; + //! @brief Not used register + uint8_t unused; + }; - //! @brief Left output of the Echo Volume register - uint8_t evolL; - //! @brief Right output of the Echo Volume register - uint8_t evolR; + struct Echo { + //! @brief Echo Volume register (EVOL) + std::array volume; + //! @brief Echo feedback register (EFB) + uint8_t feedback; + //! @brief Echo FIR filter coefficients (COEF) + std::array FIR; + //! @brief Echo data start register (ESA) + uint8_t data; + //! @brief Echo delay size register (EDL) + uint8_t delay; + //! @brief Echo enabled (5th bit FLG) + bool enabled = true; + //! @brief Last sound produced for each voice in each channel + std::array, 2> history; + //! @brief Current sound to echo + std::array input; + //! @brief Current sound echoed produced + std::array output; + }; + + struct Noise { + //! @brief Frequency of white noise (the first 4 bits FLG) + uint8_t clock : 5; + //! @brief Linear feedback shift register used to shift final output + uint16_t lfsr = 0x4000; + }; + + struct BRR { + //! @brief Offset pointing to sample directory in external RAM (DIR) + uint8_t offset; + }; + + struct Latch { + //! @brief Current voice's adsr1 in use + uint8_t adsr1; + //! @brief Envelope value register (ENVX) + uint8_t envx; + //! @brief Wave height register (OUTX) + uint8_t outx; + //! @brief Current voice's pitch in use + uint16_t pitch; + //! @brief Output currently being modified + uint16_t output; + }; + + struct Voice { + //! @brief Volume register (VOL) + std::array volume; + //! @brief Pitch register (P) + union { + struct { + //! @brief Lower 8 bits of pitch register + uint8_t pitchL; + //! @brief Higher 8 bits of pitch register + uint8_t pitchH; + }; + uint16_t pitch; + }; + //! @brief Source number register (SRCN) + uint8_t srcn; + union { + struct { + //! @brief Envelope register (ADSR) + uint8_t adsr1; + //! @brief Envelope controllers register (ADSR) + uint8_t adsr2; + }; + uint16_t envelope; + }; + //! @brief Gain register (GAIN) + uint8_t gain; + //! @brief envelope associated with this voice + uint8_t envx; + //! @brief Sample end register (ENDX) + bool endx : 1; + + //! @brief Key On register (KON) + bool kon : 1; + //! @brief Key Off register (KOF) + bool kof : 1; + //! @brief Pitch modulation register (PMON) + bool pmon : 1; + //! @brief Noise enable register (NON) + bool non : 1; + //! @brief Echo enable register (EON) + bool eon : 1; + + //! @brief Check if voice is in setup phase + uint8_t konDelay; + //! @brief Check if the output will be echoed + bool echo; + //! @brief Check if this voice will be looped + bool loop; + }; + + //! @brief Current state of the DSP + struct State + { + //! @brief Current voice modification to do + uint8_t voice = 0; + //! @brief Current buffer of samples + int16_t *buffer; + //! @brief Limit of the buffer + int16_t *bufferEnd; + //! @brief Beginning of the buffer + int16_t *bufferStart; + }; + /*//! @brief All the registers of the DSP + struct Registers { + //! @brief Main Volume register + std::array mVol; //master.volume + + //! @brief Echo Volume register + std::array eVol; //echo.volume //! @brief Flags register - uint8_t flg; + union { + struct { + uint8_t noiseClock : 5; //noise.frequency + bool ecen : 1; //echo.readonly + bool mute : 1; //master.mute + bool reset : 1; //master.reset + }; + uint8_t flg; + }; //! @brief Echo feedback register - uint8_t efb; + uint8_t efb; //echo.feedback //! @brief Not used register uint8_t unused; //! @brief Source Directory offset register - uint8_t dir; + uint8_t dir; //brr.bank //! @brief Echo data start register - uint8_t esa; + uint8_t esa; //echo.bank //! @brief Echo delay size register - uint8_t edl; + uint8_t edl; //echo.delay }; struct BRR { @@ -61,10 +186,8 @@ namespace ComSquare::APU::DSP }; struct Voice { - //! @brief Left channel volume register - uint8_t volL; - //! @brief Left channel volume register - uint8_t volR; + //! @brief Volume register + std::array volume; //voice.volume union { struct { @@ -73,78 +196,61 @@ namespace ComSquare::APU::DSP //! @brief Higher 8 bits of pitch register uint8_t pitchH; }; - uint16_t pitch; + uint16_t pitch; //voice.pitch }; //! @brief Source number register - uint8_t srcn; + uint8_t srcn; //voice.source union { struct { //! @brief Envelope register - uint8_t adsr1; + uint8_t adsr1; //voice.adsr0 //! @brief Envelope controllers register - uint8_t adsr2; + uint8_t adsr2; //voice.adsr1 }; uint16_t envelope; }; //! @brief Gain register - uint8_t gain; + uint8_t gain; //voice.gain //! @brief Envelope value register - uint8_t envx; + uint8_t envx; //latch.envx //! @brief Wave height register - uint8_t outx; + uint8_t outx; //latch.outx //! @brief Key On register - bool kon : 1; + bool kon : 1; //voice.keyon //! @brief Key Off register - bool kof : 1; + bool kof : 1; //voice.keyoff + bool keyLatch : 1; //voice._keylatch //! @brief Sample end register - bool endx : 1; + bool endx : 1; //voice._end //! @brief Noise enable register - bool non : 1; + bool non : 1; //voice.noise //! @brief Echo enable register - bool eon : 1; + bool eon : 1; //voice.echo //! @brief Pitch modulation register - bool pmon : 1; + bool pmon : 1; //voice.modulate //! @brief Echo FIR filter coefficients - uint8_t coeff; + uint8_t coeff; //echo.fir - //! @brief Bit Rate Reduction associated to - BRR brr; - //! @brief Relative position in sample - uint16_t gaussOffset; - //! @brief Position of the next sample - unsigned sampleOffset : 4; - std::array decodedSamples; + bool latchEon : 1; //voice._echo }; - //! @brief Current state of the DSP - struct State + struct Latch { - //! @brief Current voice modification to do - uint8_t voice = 0; - //! @brief Current buffer of samples - int16_t *buffer; - //! @brief Limit of the buffer - int16_t *bufferEnd; - //! @brief Beginning of the buffer - int16_t *bufferStart; - }; + uint8_t adsr0; + uint16_t pitch; + uint16_t output; + };*/ class DSP : public Memory::AMemory { private: - //! @brief All registers of the DSP - Registers _registers{}; - - //! @brief 8x voices of sample used to make sound - std::array _voices{}; - //! @brief Gaussian table used for making waves std::array _gauss = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -181,18 +287,54 @@ namespace ComSquare::APU::DSP 1299, 1300, 1300, 1301, 1302, 1302, 1303, 1303, 1303, 1304, 1304, 1304, 1304, 1304, 1305, 1305 }; - //! @brief State of DSP with buffer - State _state {}; - public: + //! @brief 8x voices of sample used to make sound + std::array _voices {}; + Master _master {}; + Echo _echo {}; + Noise _noise {}; + BRR _brr {}; + Latch _latch {}; + State _state {}; + + void voiceOutput(Voice &voice, bool channel); + void voice1(Voice &voice); + void voice2(Voice &voice); + void voice3(Voice &voice); + void voice3a(Voice &voice); + void voice3b(Voice &voice); + void voice3c(Voice &voice); + void voice4(Voice &voice); + void voice5(Voice &voice); + void voice6(Voice &voice); + void voice7(Voice &voice); + void voice8(Voice &voice); + void voice9(Voice &voice); + void echo22(); + void echo23(); + void echo24(); + void echo25(); + void echo26(); + void echo27(); + void echo28(); + void echo29(); + void echo30(); + void misc27(); + void misc28(); + void misc29(); + void misc30(); + public: DSP(int16_t *buffer, int32_t size); DSP(const DSP &) = default; DSP &operator=(const DSP &) = default; ~DSP() override = default; - Registers getRegisters(); - //! @brief Return all 8 voices from DSP - std::array getVoices(); + const std::array &getVoices(); + const Master &getMaster(); + const Echo &getEcho(); + const Noise &getNoise(); + const BRR &getBrr(); + const Latch &getLatch(); //! @brief Read from the internal DSP register. //! @param addr The address to read from. The address 0x0 should refer to the first byte of the register. @@ -209,7 +351,7 @@ namespace ComSquare::APU::DSP void update(); //! @brief Return the number of samples written - int32_t getSamplesCount(); + int32_t getSamplesCount() const; //! @brief Get the name of this accessor (used for debug purpose) std::string getName() override; diff --git a/sources/APU/DSP/Echo.cpp b/sources/APU/DSP/Echo.cpp new file mode 100644 index 0000000..ed2b365 --- /dev/null +++ b/sources/APU/DSP/Echo.cpp @@ -0,0 +1,73 @@ +// +// Created by melefo on 2/1/21. +// + +#include "DSP.hpp" + +namespace ComSquare::APU::DSP +{ + void DSP::echo22() + { + + } + + void DSP::echo23() + { + + } + + void DSP::echo24() + { + + } + + void DSP::echo25() + { + + } + + void DSP::echo26() + { + + } + + void DSP::echo27() + { + + } + + void DSP::echo28() + { + + } + + void DSP::echo29() + { + + } + + void DSP::echo30() + { + + } + + void DSP::misc27() + { + + } + + void DSP::misc28() + { + + } + + void DSP::misc29() + { + + } + + void DSP::misc30() + { + + } +} \ No newline at end of file diff --git a/sources/APU/DSP/Voice.cpp b/sources/APU/DSP/Voice.cpp new file mode 100644 index 0000000..3633a75 --- /dev/null +++ b/sources/APU/DSP/Voice.cpp @@ -0,0 +1,84 @@ +// +// Created by melefo on 2/1/21. +// + +#include "DSP.hpp" +#include + +namespace ComSquare::APU::DSP +{ + void DSP::voiceOutput(Voice &voice, bool channel) + { + int out = this->_latch.output * voice.volume[channel] >> 7; + + this->_master.output[channel] += out; + if (!voice.echo) + return; + this->_echo.volume[channel] += out; + } + + void DSP::voice1(Voice &voice) + { + + } + + void DSP::voice2(Voice &voice) + { + /*uint16_t addr = this->_brr. + this->_latch.adsr1 = voice.adsr1;*/ + } + + void DSP::voice3(Voice &voice) + { + + } + + void DSP::voice3a(Voice &voice) + { + + } + + void DSP::voice3b(Voice &voice) + { + + } + + void DSP::voice3c(Voice &voice) + { + + } + + void DSP::voice4(Voice &voice) + { + + } + + void DSP::voice5(Voice &voice) + { + this->voiceOutput(voice, 1); + + voice.endx |= voice.loop; + if (voice.konDelay == 5) + voice.endx &= ~voice.endx; + } + + void DSP::voice6(Voice &voice) + { + + } + + void DSP::voice7(Voice &voice) + { + + } + + void DSP::voice8(Voice &voice) + { + + } + + void DSP::voice9(Voice &voice) + { + + } +} \ No newline at end of file diff --git a/sources/Debugger/APUDebug.cpp b/sources/Debugger/APUDebug.cpp index 040ad7b..ee9183e 100644 --- a/sources/Debugger/APUDebug.cpp +++ b/sources/Debugger/APUDebug.cpp @@ -84,143 +84,156 @@ namespace ComSquare::Debugger this->_ui.programCounterLineEdit->setText(Utility::to_hex(this->_internalRegisters.pc + 0x0001u).c_str()); this->_ui.programStatusWordLineEdit->setText(this->_getPSWString().c_str()); - this->_ui.mvolLprogressBar->setValue(this->_dsp->getRegisters().mvolL); - this->_ui.mvolRprogressBar->setValue(this->_dsp->getRegisters().mvolR); - this->_ui.evolLprogressBar->setValue(this->_dsp->getRegisters().evolL); - this->_ui.evolRprogressBar->setValue(this->_dsp->getRegisters().evolR); - this->_ui.echoprogressBar->setValue(this->_dsp->getRegisters().efb); - this->_ui.flagslineEdit->setText(Utility::to_binary(this->_dsp->getRegisters().flg).c_str()); - this->_ui.sourceDirectoryLineEdit->setText(Utility::to_hex(this->_dsp->getRegisters().dir).c_str()); - this->_ui.echoBufferOffsetLineEdit->setText(Utility::to_hex(this->_dsp->getRegisters().esa).c_str()); - this->_ui.echoDelayLineEdit->setText(Utility::to_hex(this->_dsp->getRegisters().edl).c_str()); + auto voices = this->_dsp->getVoices(); + auto master = this->_dsp->getMaster(); + auto echo = this->_dsp->getEcho(); + auto noise = this->_dsp->getNoise(); + auto brr = this->_dsp->getBrr(); + auto latch = this->_dsp->getLatch(); - this->_ui.VolumeLprogressBar->setValue(this->_dsp->getVoices()[0].volL); - this->_ui.VolumeRprogressBar->setValue(this->_dsp->getVoices()[0].volR); - this->_ui.WaveHeightprogressBar->setValue(this->_dsp->getVoices()[0].outx); - this->_ui.EchoFIRCoeffprogressBar->setValue(this->_dsp->getVoices()[0].coeff); - this->_ui.PitchlineEdit->setText(Utility::to_hex(this->_dsp->getVoices()[0].pitch).c_str()); - this->_ui.sourceNumberLineEdit->setText(Utility::to_hex(this->_dsp->getVoices()[0].srcn).c_str()); - this->_ui.GainlineEdit->setText(Utility::to_hex(this->_dsp->getVoices()[0].gain).c_str()); - this->_ui.EnvelopelineEdit->setText(Utility::to_hex(this->_dsp->getVoices()[0].envelope).c_str()); - this->_ui.EnvelopeValueLineEdit->setText(Utility::to_hex(this->_dsp->getVoices()[0].envx).c_str()); - this->_ui.KeyOncheckBox->setChecked(this->_dsp->getVoices()[0].kon); - this->_ui.KeyOffcheckBox->setChecked(this->_dsp->getVoices()[0].kof); - this->_ui.NoisecheckBox->setChecked(this->_dsp->getVoices()[0].non); - this->_ui.EchocheckBox->setChecked(this->_dsp->getVoices()[0].eon); - this->_ui.SampleEndcheckBox->setChecked(this->_dsp->getVoices()[0].endx); - this->_ui.PitchModulationcheckBox->setChecked(this->_dsp->getVoices()[0].pmon); + this->_ui.mvolLprogressBar->setValue(master.volume[0]); + this->_ui.mvolRprogressBar->setValue(master.volume[1]); + this->_ui.evolLprogressBar->setValue(echo.volume[0]); + this->_ui.evolRprogressBar->setValue(echo.volume[1]); + this->_ui.echoprogressBar->setValue(echo.feedback); - this->_ui.VolumeLprogressBar_2->setValue(this->_dsp->getVoices()[1].volL); - this->_ui.VolumeRprogressBar_2->setValue(this->_dsp->getVoices()[1].volR); - this->_ui.WaveHeightprogressBar_2->setValue(this->_dsp->getVoices()[1].outx); - this->_ui.EchoFIRCoeffprogressBar_2->setValue(this->_dsp->getVoices()[1].coeff); - this->_ui.PitchlineEdit_2->setText(Utility::to_hex(this->_dsp->getVoices()[1].pitch).c_str()); - this->_ui.sourceNumberLineEdit_2->setText(Utility::to_hex(this->_dsp->getVoices()[1].srcn).c_str()); - this->_ui.GainlineEdit_2->setText(Utility::to_hex(this->_dsp->getVoices()[1].gain).c_str()); - this->_ui.EnvelopelineEdit_2->setText(Utility::to_hex(this->_dsp->getVoices()[1].envelope).c_str()); - this->_ui.EnvelopeValueLineEdit_2->setText(Utility::to_hex(this->_dsp->getVoices()[1].envx).c_str()); - this->_ui.KeyOncheckBox_2->setChecked(this->_dsp->getVoices()[1].kon); - this->_ui.KeyOffcheckBox_2->setChecked(this->_dsp->getVoices()[1].kof); - this->_ui.NoisecheckBox_2->setChecked(this->_dsp->getVoices()[1].non); - this->_ui.EchocheckBox_2->setChecked(this->_dsp->getVoices()[1].eon); - this->_ui.SampleEndcheckBox_2->setChecked(this->_dsp->getVoices()[1].endx); - this->_ui.PitchModulationcheckBox_2->setChecked(this->_dsp->getVoices()[1].pmon); + uint8_t flg = 0; + flg += master.reset << 7; + flg += master.mute << 6; + flg += echo.enabled << 5; + flg += noise.clock; + this->_ui.flagslineEdit->setText(Utility::to_binary(flg).c_str()); + this->_ui.sourceDirectoryLineEdit->setText(Utility::to_hex(brr.offset).c_str()); + this->_ui.echoBufferOffsetLineEdit->setText(Utility::to_hex(echo.data).c_str()); + this->_ui.echoDelayLineEdit->setText(Utility::to_hex(echo.delay).c_str()); - this->_ui.VolumeLprogressBar_3->setValue(this->_dsp->getVoices()[2].volL); - this->_ui.VolumeRprogressBar_3->setValue(this->_dsp->getVoices()[2].volR); - this->_ui.WaveHeightprogressBar_3->setValue(this->_dsp->getVoices()[2].outx); - this->_ui.EchoFIRCoeffprogressBar_3->setValue(this->_dsp->getVoices()[2].coeff); - this->_ui.PitchlineEdit_3->setText(Utility::to_hex(this->_dsp->getVoices()[2].pitch).c_str()); - this->_ui.sourceNumberLineEdit_3->setText(Utility::to_hex(this->_dsp->getVoices()[2].srcn).c_str()); - this->_ui.GainlineEdit_3->setText(Utility::to_hex(this->_dsp->getVoices()[2].gain).c_str()); - this->_ui.EnvelopelineEdit_3->setText(Utility::to_hex(this->_dsp->getVoices()[2].envelope).c_str()); - this->_ui.EnvelopeValueLineEdit_3->setText(Utility::to_hex(this->_dsp->getVoices()[2].envx).c_str()); - this->_ui.KeyOncheckBox_3->setChecked(this->_dsp->getVoices()[2].kon); - this->_ui.KeyOffcheckBox_3->setChecked(this->_dsp->getVoices()[2].kof); - this->_ui.NoisecheckBox_3->setChecked(this->_dsp->getVoices()[2].non); - this->_ui.EchocheckBox_3->setChecked(this->_dsp->getVoices()[2].eon); - this->_ui.SampleEndcheckBox_3->setChecked(this->_dsp->getVoices()[2].endx); - this->_ui.PitchModulationcheckBox_3->setChecked(this->_dsp->getVoices()[2].pmon); + this->_ui.VolumeLprogressBar->setValue(voices[0].volume[0]); + this->_ui.VolumeRprogressBar->setValue(voices[0].volume[1]); + this->_ui.WaveHeightprogressBar->setValue(latch.outx); + this->_ui.EchoFIRCoeffprogressBar->setValue(echo.FIR[0]); + this->_ui.PitchlineEdit->setText(Utility::to_hex(voices[0].pitch).c_str()); + this->_ui.sourceNumberLineEdit->setText(Utility::to_hex(voices[0].srcn).c_str()); + this->_ui.GainlineEdit->setText(Utility::to_hex(voices[0].gain).c_str()); + this->_ui.EnvelopelineEdit->setText(Utility::to_hex(voices[0].envelope).c_str()); + this->_ui.EnvelopeValueLineEdit->setText(Utility::to_hex(voices[0].envx).c_str()); + this->_ui.KeyOncheckBox->setChecked(voices[0].kon); + this->_ui.KeyOffcheckBox->setChecked(voices[0].kof); + this->_ui.NoisecheckBox->setChecked(voices[0].non); + this->_ui.EchocheckBox->setChecked(voices[0].eon); + this->_ui.SampleEndcheckBox->setChecked(voices[0].endx); + this->_ui.PitchModulationcheckBox->setChecked(voices[0].pmon); - this->_ui.VolumeLprogressBar_4->setValue(this->_dsp->getVoices()[3].volL); - this->_ui.VolumeRprogressBar_4->setValue(this->_dsp->getVoices()[3].volR); - this->_ui.WaveHeightprogressBar_4->setValue(this->_dsp->getVoices()[3].outx); - this->_ui.EchoFIRCoeffprogressBar_4->setValue(this->_dsp->getVoices()[3].coeff); - this->_ui.PitchlineEdit_4->setText(Utility::to_hex(this->_dsp->getVoices()[3].pitch).c_str()); - this->_ui.sourceNumberLineEdit_4->setText(Utility::to_hex(this->_dsp->getVoices()[3].srcn).c_str()); - this->_ui.GainlineEdit_4->setText(Utility::to_hex(this->_dsp->getVoices()[3].gain).c_str()); - this->_ui.EnvelopelineEdit_4->setText(Utility::to_hex(this->_dsp->getVoices()[3].envelope).c_str()); - this->_ui.EnvelopeValueLineEdit_4->setText(Utility::to_hex(this->_dsp->getVoices()[3].envx).c_str()); - this->_ui.KeyOncheckBox_4->setChecked(this->_dsp->getVoices()[3].kon); - this->_ui.KeyOffcheckBox_4->setChecked(this->_dsp->getVoices()[3].kof); - this->_ui.NoisecheckBox_4->setChecked(this->_dsp->getVoices()[3].non); - this->_ui.EchocheckBox_4->setChecked(this->_dsp->getVoices()[3].eon); - this->_ui.SampleEndcheckBox_4->setChecked(this->_dsp->getVoices()[3].endx); - this->_ui.PitchModulationcheckBox_4->setChecked(this->_dsp->getVoices()[3].pmon); + this->_ui.VolumeLprogressBar_2->setValue(voices[1].volume[0]); + this->_ui.VolumeRprogressBar_2->setValue(voices[1].volume[1]); + this->_ui.WaveHeightprogressBar_2->setValue(latch.outx); + this->_ui.EchoFIRCoeffprogressBar_2->setValue(echo.FIR[1]); + this->_ui.PitchlineEdit_2->setText(Utility::to_hex(voices[1].pitch).c_str()); + this->_ui.sourceNumberLineEdit_2->setText(Utility::to_hex(voices[1].srcn).c_str()); + this->_ui.GainlineEdit_2->setText(Utility::to_hex(voices[1].gain).c_str()); + this->_ui.EnvelopelineEdit_2->setText(Utility::to_hex(voices[1].envelope).c_str()); + this->_ui.EnvelopeValueLineEdit_2->setText(Utility::to_hex(voices[1].envx).c_str()); + this->_ui.KeyOncheckBox_2->setChecked(voices[1].kon); + this->_ui.KeyOffcheckBox_2->setChecked(voices[1].kof); + this->_ui.NoisecheckBox_2->setChecked(voices[1].non); + this->_ui.EchocheckBox_2->setChecked(voices[1].eon); + this->_ui.SampleEndcheckBox_2->setChecked(voices[1].endx); + this->_ui.PitchModulationcheckBox_2->setChecked(voices[1].pmon); - this->_ui.VolumeLprogressBar_5->setValue(this->_dsp->getVoices()[4].volL); - this->_ui.VolumeRprogressBar_5->setValue(this->_dsp->getVoices()[4].volR); - this->_ui.WaveHeightprogressBar_5->setValue(this->_dsp->getVoices()[4].outx); - this->_ui.EchoFIRCoeffprogressBar_5->setValue(this->_dsp->getVoices()[4].coeff); - this->_ui.PitchlineEdit_5->setText(Utility::to_hex(this->_dsp->getVoices()[4].pitch).c_str()); - this->_ui.sourceNumberLineEdit_5->setText(Utility::to_hex(this->_dsp->getVoices()[4].srcn).c_str()); - this->_ui.GainlineEdit_5->setText(Utility::to_hex(this->_dsp->getVoices()[4].gain).c_str()); - this->_ui.EnvelopelineEdit_5->setText(Utility::to_hex(this->_dsp->getVoices()[4].envelope).c_str()); - this->_ui.EnvelopeValueLineEdit_5->setText(Utility::to_hex(this->_dsp->getVoices()[4].envx).c_str()); - this->_ui.KeyOncheckBox_5->setChecked(this->_dsp->getVoices()[4].kon); - this->_ui.KeyOffcheckBox_5->setChecked(this->_dsp->getVoices()[4].kof); - this->_ui.NoisecheckBox_5->setChecked(this->_dsp->getVoices()[4].non); - this->_ui.EchocheckBox_5->setChecked(this->_dsp->getVoices()[4].eon); - this->_ui.SampleEndcheckBox_5->setChecked(this->_dsp->getVoices()[4].endx); - this->_ui.PitchModulationcheckBox_5->setChecked(this->_dsp->getVoices()[4].pmon); + this->_ui.VolumeLprogressBar_3->setValue(voices[2].volume[0]); + this->_ui.VolumeRprogressBar_3->setValue(voices[2].volume[1]); + this->_ui.WaveHeightprogressBar_3->setValue(latch.outx); + this->_ui.EchoFIRCoeffprogressBar_3->setValue(echo.FIR[2]); + this->_ui.PitchlineEdit_3->setText(Utility::to_hex(voices[2].pitch).c_str()); + this->_ui.sourceNumberLineEdit_3->setText(Utility::to_hex(voices[2].srcn).c_str()); + this->_ui.GainlineEdit_3->setText(Utility::to_hex(voices[2].gain).c_str()); + this->_ui.EnvelopelineEdit_3->setText(Utility::to_hex(voices[2].envelope).c_str()); + this->_ui.EnvelopeValueLineEdit_3->setText(Utility::to_hex(voices[2].envx).c_str()); + this->_ui.KeyOncheckBox_3->setChecked(voices[2].kon); + this->_ui.KeyOffcheckBox_3->setChecked(voices[2].kof); + this->_ui.NoisecheckBox_3->setChecked(voices[2].non); + this->_ui.EchocheckBox_3->setChecked(voices[2].eon); + this->_ui.SampleEndcheckBox_3->setChecked(voices[2].endx); + this->_ui.PitchModulationcheckBox_3->setChecked(voices[2].pmon); - this->_ui.VolumeLprogressBar_6->setValue(this->_dsp->getVoices()[5].volL); - this->_ui.VolumeRprogressBar_6->setValue(this->_dsp->getVoices()[5].volR); - this->_ui.WaveHeightprogressBar_6->setValue(this->_dsp->getVoices()[5].outx); - this->_ui.EchoFIRCoeffprogressBar_6->setValue(this->_dsp->getVoices()[5].coeff); - this->_ui.PitchlineEdit_6->setText(Utility::to_hex(this->_dsp->getVoices()[5].pitch).c_str()); - this->_ui.sourceNumberLineEdit_6->setText(Utility::to_hex(this->_dsp->getVoices()[5].srcn).c_str()); - this->_ui.GainlineEdit_6->setText(Utility::to_hex(this->_dsp->getVoices()[5].gain).c_str()); - this->_ui.EnvelopelineEdit_6->setText(Utility::to_hex(this->_dsp->getVoices()[5].envelope).c_str()); - this->_ui.EnvelopeValueLineEdit_6->setText(Utility::to_hex(this->_dsp->getVoices()[5].envx).c_str()); - this->_ui.KeyOncheckBox_6->setChecked(this->_dsp->getVoices()[5].kon); - this->_ui.KeyOffcheckBox_6->setChecked(this->_dsp->getVoices()[5].kof); - this->_ui.NoisecheckBox_6->setChecked(this->_dsp->getVoices()[5].non); - this->_ui.EchocheckBox_6->setChecked(this->_dsp->getVoices()[5].eon); - this->_ui.SampleEndcheckBox_6->setChecked(this->_dsp->getVoices()[5].endx); - this->_ui.PitchModulationcheckBox_6->setChecked(this->_dsp->getVoices()[5].pmon); + this->_ui.VolumeLprogressBar_4->setValue(voices[3].volume[0]); + this->_ui.VolumeRprogressBar_4->setValue(voices[3].volume[1]); + this->_ui.WaveHeightprogressBar_4->setValue(latch.outx); + this->_ui.EchoFIRCoeffprogressBar_4->setValue(echo.FIR[3]); + this->_ui.PitchlineEdit_4->setText(Utility::to_hex(voices[3].pitch).c_str()); + this->_ui.sourceNumberLineEdit_4->setText(Utility::to_hex(voices[3].srcn).c_str()); + this->_ui.GainlineEdit_4->setText(Utility::to_hex(voices[3].gain).c_str()); + this->_ui.EnvelopelineEdit_4->setText(Utility::to_hex(voices[3].envelope).c_str()); + this->_ui.EnvelopeValueLineEdit_4->setText(Utility::to_hex(voices[3].envx).c_str()); + this->_ui.KeyOncheckBox_4->setChecked(voices[3].kon); + this->_ui.KeyOffcheckBox_4->setChecked(voices[3].kof); + this->_ui.NoisecheckBox_4->setChecked(voices[3].non); + this->_ui.EchocheckBox_4->setChecked(voices[3].eon); + this->_ui.SampleEndcheckBox_4->setChecked(voices[3].endx); + this->_ui.PitchModulationcheckBox_4->setChecked(voices[3].pmon); - this->_ui.VolumeLprogressBar_7->setValue(this->_dsp->getVoices()[6].volL); - this->_ui.VolumeRprogressBar_7->setValue(this->_dsp->getVoices()[6].volR); - this->_ui.WaveHeightprogressBar_7->setValue(this->_dsp->getVoices()[6].outx); - this->_ui.EchoFIRCoeffprogressBar_7->setValue(this->_dsp->getVoices()[6].coeff); - this->_ui.PitchlineEdit_7->setText(Utility::to_hex(this->_dsp->getVoices()[6].pitch).c_str()); - this->_ui.sourceNumberLineEdit_7->setText(Utility::to_hex(this->_dsp->getVoices()[6].srcn).c_str()); - this->_ui.GainlineEdit_7->setText(Utility::to_hex(this->_dsp->getVoices()[6].gain).c_str()); - this->_ui.EnvelopelineEdit_7->setText(Utility::to_hex(this->_dsp->getVoices()[6].envelope).c_str()); - this->_ui.EnvelopeValueLineEdit_7->setText(Utility::to_hex(this->_dsp->getVoices()[6].envx).c_str()); - this->_ui.KeyOncheckBox_7->setChecked(this->_dsp->getVoices()[6].kon); - this->_ui.KeyOffcheckBox_7->setChecked(this->_dsp->getVoices()[6].kof); - this->_ui.NoisecheckBox_7->setChecked(this->_dsp->getVoices()[6].non); - this->_ui.EchocheckBox_7->setChecked(this->_dsp->getVoices()[6].eon); - this->_ui.SampleEndcheckBox_7->setChecked(this->_dsp->getVoices()[6].endx); - this->_ui.PitchModulationcheckBox_7->setChecked(this->_dsp->getVoices()[6].pmon); + this->_ui.VolumeLprogressBar_5->setValue(voices[4].volume[0]); + this->_ui.VolumeRprogressBar_5->setValue(voices[4].volume[1]); + this->_ui.WaveHeightprogressBar_5->setValue(latch.outx); + this->_ui.EchoFIRCoeffprogressBar_5->setValue(echo.FIR[4]); + this->_ui.PitchlineEdit_5->setText(Utility::to_hex(voices[4].pitch).c_str()); + this->_ui.sourceNumberLineEdit_5->setText(Utility::to_hex(voices[4].srcn).c_str()); + this->_ui.GainlineEdit_5->setText(Utility::to_hex(voices[4].gain).c_str()); + this->_ui.EnvelopelineEdit_5->setText(Utility::to_hex(voices[4].envelope).c_str()); + this->_ui.EnvelopeValueLineEdit_5->setText(Utility::to_hex(voices[4].envx).c_str()); + this->_ui.KeyOncheckBox_5->setChecked(voices[4].kon); + this->_ui.KeyOffcheckBox_5->setChecked(voices[4].kof); + this->_ui.NoisecheckBox_5->setChecked(voices[4].non); + this->_ui.EchocheckBox_5->setChecked(voices[4].eon); + this->_ui.SampleEndcheckBox_5->setChecked(voices[4].endx); + this->_ui.PitchModulationcheckBox_5->setChecked(voices[4].pmon); - this->_ui.VolumeLprogressBar_8->setValue(this->_dsp->getVoices()[7].volL); - this->_ui.VolumeRprogressBar_8->setValue(this->_dsp->getVoices()[7].volR); - this->_ui.WaveHeightprogressBar_8->setValue(this->_dsp->getVoices()[7].outx); - this->_ui.EchoFIRCoeffprogressBar_8->setValue(this->_dsp->getVoices()[7].coeff); - this->_ui.PitchlineEdit_8->setText(Utility::to_hex(this->_dsp->getVoices()[7].pitch).c_str()); - this->_ui.sourceNumberLineEdit_8->setText(Utility::to_hex(this->_dsp->getVoices()[7].srcn).c_str()); - this->_ui.GainlineEdit_8->setText(Utility::to_hex(this->_dsp->getVoices()[7].gain).c_str()); - this->_ui.EnvelopelineEdit_8->setText(Utility::to_hex(this->_dsp->getVoices()[7].envelope).c_str()); - this->_ui.EnvelopeValueLineEdit_8->setText(Utility::to_hex(this->_dsp->getVoices()[7].envx).c_str()); - this->_ui.KeyOncheckBox_8->setChecked(this->_dsp->getVoices()[7].kon); - this->_ui.KeyOffcheckBox_8->setChecked(this->_dsp->getVoices()[7].kof); - this->_ui.NoisecheckBox_8->setChecked(this->_dsp->getVoices()[7].non); - this->_ui.EchocheckBox_8->setChecked(this->_dsp->getVoices()[7].eon); - this->_ui.SampleEndcheckBox_8->setChecked(this->_dsp->getVoices()[7].endx); - this->_ui.PitchModulationcheckBox_8->setChecked(this->_dsp->getVoices()[7].pmon); + this->_ui.VolumeLprogressBar_6->setValue(voices[5].volume[0]); + this->_ui.VolumeRprogressBar_6->setValue(voices[5].volume[1]); + this->_ui.WaveHeightprogressBar_6->setValue(latch.outx); + this->_ui.EchoFIRCoeffprogressBar_6->setValue(echo.FIR[5]); + this->_ui.PitchlineEdit_6->setText(Utility::to_hex(voices[5].pitch).c_str()); + this->_ui.sourceNumberLineEdit_6->setText(Utility::to_hex(voices[5].srcn).c_str()); + this->_ui.GainlineEdit_6->setText(Utility::to_hex(voices[5].gain).c_str()); + this->_ui.EnvelopelineEdit_6->setText(Utility::to_hex(voices[5].envelope).c_str()); + this->_ui.EnvelopeValueLineEdit_6->setText(Utility::to_hex(voices[5].envx).c_str()); + this->_ui.KeyOncheckBox_6->setChecked(voices[5].kon); + this->_ui.KeyOffcheckBox_6->setChecked(voices[5].kof); + this->_ui.NoisecheckBox_6->setChecked(voices[5].non); + this->_ui.EchocheckBox_6->setChecked(voices[5].eon); + this->_ui.SampleEndcheckBox_6->setChecked(voices[5].endx); + this->_ui.PitchModulationcheckBox_6->setChecked(voices[5].pmon); + + this->_ui.VolumeLprogressBar_7->setValue(voices[6].volume[0]); + this->_ui.VolumeRprogressBar_7->setValue(voices[6].volume[1]); + this->_ui.WaveHeightprogressBar_7->setValue(latch.outx); + this->_ui.EchoFIRCoeffprogressBar_7->setValue(echo.FIR[6]); + this->_ui.PitchlineEdit_7->setText(Utility::to_hex(voices[6].pitch).c_str()); + this->_ui.sourceNumberLineEdit_7->setText(Utility::to_hex(voices[6].srcn).c_str()); + this->_ui.GainlineEdit_7->setText(Utility::to_hex(voices[6].gain).c_str()); + this->_ui.EnvelopelineEdit_7->setText(Utility::to_hex(voices[6].envelope).c_str()); + this->_ui.EnvelopeValueLineEdit_7->setText(Utility::to_hex(voices[6].envx).c_str()); + this->_ui.KeyOncheckBox_7->setChecked(voices[6].kon); + this->_ui.KeyOffcheckBox_7->setChecked(voices[6].kof); + this->_ui.NoisecheckBox_7->setChecked(voices[6].non); + this->_ui.EchocheckBox_7->setChecked(voices[6].eon); + this->_ui.SampleEndcheckBox_7->setChecked(voices[6].endx); + this->_ui.PitchModulationcheckBox_7->setChecked(voices[6].pmon); + + this->_ui.VolumeLprogressBar_8->setValue(voices[7].volume[0]); + this->_ui.VolumeRprogressBar_8->setValue(voices[7].volume[1]); + this->_ui.WaveHeightprogressBar_8->setValue(latch.outx); + this->_ui.EchoFIRCoeffprogressBar_8->setValue(echo.FIR[7]); + this->_ui.PitchlineEdit_8->setText(Utility::to_hex(voices[7].pitch).c_str()); + this->_ui.sourceNumberLineEdit_8->setText(Utility::to_hex(voices[7].srcn).c_str()); + this->_ui.GainlineEdit_8->setText(Utility::to_hex(voices[7].gain).c_str()); + this->_ui.EnvelopelineEdit_8->setText(Utility::to_hex(voices[7].envelope).c_str()); + this->_ui.EnvelopeValueLineEdit_8->setText(Utility::to_hex(voices[7].envx).c_str()); + this->_ui.KeyOncheckBox_8->setChecked(voices[7].kon); + this->_ui.KeyOffcheckBox_8->setChecked(voices[7].kof); + this->_ui.NoisecheckBox_8->setChecked(voices[7].non); + this->_ui.EchocheckBox_8->setChecked(voices[7].eon); + this->_ui.SampleEndcheckBox_8->setChecked(voices[7].endx); + this->_ui.PitchModulationcheckBox_8->setChecked(voices[7].pmon); } std::string APUDebug::_getPSWString()