// for finding memory leaks in debug mode with Visual Studio #if defined _DEBUG && defined _MSC_VER#include <crtdbg.h>#endif #include <stdio.h>#include <stdint.h>#include <stdbool.h>#include <string.h>#include <math.h> // modf()#ifdef _WIN32#define WIN32_MEAN_AND_LEAN#include <windows.h>#include <SDL2/SDL_syswm.h>#endif#include <stdint.h>#include <stdbool.h>#ifndef _WIN32#include <unistd.h> // usleep()#endif#include <ctype.h> // tolower()#include "pt2_helpers.h"#include "pt2_textout.h"#include "pt2_tables.h"#include "pt2_pattern_viewer.h"#include "pt2_sampler.h"#include "pt2_diskop.h"#include "pt2_visuals.h"#include "pt2_scopes.h"#include "pt2_edit.h"#include "pt2_config.h"#include "pt2_bmp.h"#include "pt2_sampling.h"#include "pt2_chordmaker.h"#include "pt2_mod2wav.h"#include "pt2_audio.h"#include "pt2_posed.h"#include "pt2_textedit.h" typedef struct sprite_t{ bool visible; int8_t pixelType; int16_t newX, newY, x, y, w, h; uint32_t colorKey, *refreshBuffer; const void *data;} sprite_t; static int32_t oldCurrMode = -1;static uint32_t vuMetersBg[4 * (10 * 48)]; sprite_t sprites[SPRITE_NUM]; // globalized static const uint16_t cursorPosTable[24] ={ 30, 54, 62, 70, 78, 86, 102, 126, 134, 142, 150, 158, 174, 198, 206, 214, 222, 230, 246, 270, 278, 286, 294, 302}; void updateSongInfo1(void);void updateSongInfo2(void);void updateSampler(void);void updatePatternData(void); void blit32(int32_t x, int32_t y, int32_t w, int32_t h, const uint32_t *src){ const uint32_t *srcPtr = src; uint32_t *dstPtr = &video.frameBuffer[(y * SCREEN_W) + x]; for (int32_t yy = 0; yy < h; yy++) { memcpy(dstPtr, srcPtr, w * sizeof (int32_t)); srcPtr += w; dstPtr += SCREEN_W; }} void putPixel(int32_t x, int32_t y, const uint32_t pixelColor){ video.frameBuffer[(y * SCREEN_W) + x] = pixelColor;} void hLine(int32_t x, int32_t y, int32_t w, const uint32_t pixelColor){ uint32_t *dstPtr = &video.frameBuffer[(y * SCREEN_W) + x]; for (int32_t xx = 0; xx < w; xx++) dstPtr[xx] = pixelColor;} void vLine(int32_t x, int32_t y, int32_t h, const uint32_t pixelColor){ uint32_t *dstPtr = &video.frameBuffer[(y * SCREEN_W) + x]; for (int32_t yy = 0; yy < h; yy++) { *dstPtr = pixelColor; dstPtr += SCREEN_W; }} void drawFramework1(int32_t x, int32_t y, int32_t w, int32_t h){ hLine(x, y, w-1, video.palette[PAL_BORDER]); vLine(x, y+1, h-2, video.palette[PAL_BORDER]); hLine(x+1, y+h-1, w-1, video.palette[PAL_GENBKG2]); vLine(x+w-1, y+1, h-2, video.palette[PAL_GENBKG2]); putPixel(x, y+h-1, video.palette[PAL_GENBKG]); putPixel(x+w-1, y, video.palette[PAL_GENBKG]); fillRect(x+1, y+1, w-2, h-2, video.palette[PAL_GENBKG]);} void drawFramework2(int32_t x, int32_t y, int32_t w, int32_t h){ hLine(x, y, w-1, video.palette[PAL_GENBKG2]); vLine(x, y+1, h-2, video.palette[PAL_GENBKG2]); hLine(x+1, y+h-1, w-1, video.palette[PAL_BORDER]); vLine(x+w-1, y+1, h-2, video.palette[PAL_BORDER]); putPixel(x, y+h-1, video.palette[PAL_GENBKG]); putPixel(x+w-1, y, video.palette[PAL_GENBKG]); fillRect(x+1, y+1, w-2, h-2, video.palette[PAL_GENBKG]);} void drawFramework3(int32_t x, int32_t y, int32_t w, int32_t h){ fillRect(x, y, w, h, video.palette[PAL_GENBKG]); vLine(x, y, h-1, video.palette[PAL_BORDER]); vLine(x+1, y, h-2, video.palette[PAL_BORDER]); hLine(x+2, y, w-3, video.palette[PAL_BORDER]); hLine(x+2, y+1, w-4, video.palette[PAL_BORDER]); hLine(x+1, y+h-1, w-1, video.palette[PAL_GENBKG2]); hLine(x+2, y+h-2, w-2, video.palette[PAL_GENBKG2]); vLine(x+w-2, y+2, h-4, video.palette[PAL_GENBKG2]); vLine(x+w-1, y+1, h-3, video.palette[PAL_GENBKG2]);} void fillRect(int32_t x, int32_t y, int32_t w, int32_t h, const uint32_t pixelColor){ uint32_t *dstPtr = &video.frameBuffer[(y * SCREEN_W) + x]; for (int32_t yy = 0; yy < h; yy++) { for (int32_t xx = 0; xx < w; xx++) dstPtr[xx] = pixelColor; dstPtr += SCREEN_W; }} void drawButton1(int32_t x, int32_t y, int32_t w, int32_t h, const char *text){ const int32_t textW = (int32_t)strlen(text) * (FONT_CHAR_W - 1); drawFramework1(x, y, w, h); int32_t textX = x + ((w - textW) / 2); int32_t textY = y + ((h - FONT_CHAR_H) / 2); // kludge if (!strcmp(text, ARROW_UP_STR) || !strcmp(text, ARROW_DOWN_STR)) { textX--; textY--; } textOut2(textX, textY, text);} void drawButton2(int32_t x, int32_t y, int32_t w, int32_t h, const char *text){ const int32_t textW = (int32_t)strlen(text) * (FONT_CHAR_W - 1); drawFramework2(x, y, w, h); int32_t textX = x + ((w - textW) / 2); int32_t textY = y + ((h - FONT_CHAR_H) / 2); // kludge if (!strcmp(text, ARROW_UP_STR) || !strcmp(text, ARROW_DOWN_STR)) { textX--; textY--; } textOut2(textX, textY, text);} void drawUpButton(int32_t x, int32_t y){ drawFramework1(x, y, 11, 11); textOut2(x+1, y+2, ARROW_UP_STR);} void drawDownButton(int32_t x, int32_t y){ drawFramework1(x, y, 11, 11); textOut2(x+1, y+2, ARROW_DOWN_STR);} void statusAllRight(void){ setStatusMessage("ALL RIGHT", DO_CARRY);} void statusOutOfMemory(void){ displayErrorMsg("OUT OF MEMORY !!!");} void statusSampleIsEmpty(void){ displayErrorMsg("SAMPLE IS EMPTY");} void changeStatusText(const char *text){ fillRect(88, 127, 17*FONT_CHAR_W, FONT_CHAR_H, video.palette[PAL_GENBKG]); textOut(88, 127, text, video.palette[PAL_GENTXT]);} void statusNotSampleZero(void){ /* This rather confusing error message actually means that ** you can't load a sample to sample slot #0 (which isn't a ** real sample slot). */ displayErrorMsg("NOT SAMPLE 0 !");} void renderFrame2(void) // use this in askBox(){ updateMod2WavDialog(); // must be first to avoid flickering issues updateSongInfo1(); // top left side of screen, when "disk op"/"pos ed" is hidden updateSongInfo2(); // two middle rows of screen, always visible updatePatternData(); updateSampler(); handleLastGUIObjectDown(); // XXX drawSamplerLine(); writeSampleMonitorWaveform(); // XXX} void renderFrame(void){ renderFrame2(); updateEditOp(); updateDiskOp(); updatePosEd(); updateVisualizer(); // show [EDITING] in window title if in edit mode if (oldCurrMode != editor.currMode) { oldCurrMode = editor.currMode; if (song != NULL) updateWindowTitle(song->modified); }} void resetAllScreens(void) // prepare GUI for "really quit?" dialog{ editor.mixFlag = false; editor.swapChannelFlag = false; ui.changingChordNote = false; ui.changingSmpResample = false; ui.changingSamplingNote = false; ui.changingDrumPadNote = false; ui.disableVisualizer = false; if (ui.samplerScreenShown) { if (ui.samplingBoxShown) { ui.samplingBoxShown = false; removeSamplingBox(); } ui.samplerVolBoxShown = false; ui.samplerFiltersBoxShown = false; displaySample(); // removes volume/filter box } if (ui.editTextFlag) leaveTextEditMode(EDIT_TEXT_NO_UPDATE);} static void fillFromVuMetersBgBuffer(void){ if (ui.samplerScreenShown || editor.mod2WavOngoing || editor.pat2SmpOngoing) return; const uint32_t *srcPtr = vuMetersBg; uint32_t *dstPtr = &video.frameBuffer[(187 * SCREEN_W) + 55]; for (uint32_t i = 0; i < PAULA_VOICES; i++) { for (uint32_t y = 0; y < 48; y++) { for (uint32_t x = 0; x < 10; x++) dstPtr[x] = srcPtr[x]; srcPtr += 10; dstPtr -= SCREEN_W; } dstPtr += (SCREEN_W * 48) + 72; }} void fillToVuMetersBgBuffer(void){ if (ui.samplerScreenShown || editor.mod2WavOngoing || editor.pat2SmpOngoing) return; const uint32_t *srcPtr = &video.frameBuffer[(187 * SCREEN_W) + 55]; uint32_t *dstPtr = vuMetersBg; for (uint32_t i = 0; i < PAULA_VOICES; i++) { for (uint32_t y = 0; y < 48; y++) { for (uint32_t x = 0; x < 10; x++) dstPtr[x] = srcPtr[x]; srcPtr -= SCREEN_W; dstPtr += 10; } srcPtr += (SCREEN_W * 48) + 72; }} void renderVuMeters(void){ if (ui.samplerScreenShown || editor.mod2WavOngoing || editor.pat2SmpOngoing) return; fillToVuMetersBgBuffer(); uint32_t *dstPtr = &video.frameBuffer[(187 * SCREEN_W) + 55]; for (uint32_t i = 0; i < PAULA_VOICES; i++) { uint32_t h; if (config.realVuMeters) h = editor.realVuMeterVolumes[i]; else h = editor.vuMeterVolumes[i]; if (h > 48) h = 48; const uint32_t *srcPtr = vuMeterBMP; for (uint32_t y = 0; y < h; y++) { for (uint32_t x = 0; x < 10; x++) dstPtr[x] = srcPtr[x]; srcPtr += 10; dstPtr -= SCREEN_W; } dstPtr += (SCREEN_W * h) + 72; }} void updateSongInfo1(void) // left side of screen, when Disk Op. is hidden{ if (ui.diskOpScreenShown) return; moduleSample_t *currSample = &song->samples[editor.currSample]; if (ui.updateSongPos) { ui.updateSongPos = false; printThreeDecimalsBg(72, 3, *editor.currPosDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateSongPattern) { ui.updateSongPattern = false; printTwoDecimalsBg(80, 14, *editor.currPatternDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateSongLength) { ui.updateSongLength = false; if (!editor.mod2WavOngoing) printThreeDecimalsBg(72, 25, *editor.currLengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrSampleFineTune) { ui.updateCurrSampleFineTune = false; if (!editor.mod2WavOngoing) textOutBg(80, 36, ftuneStrTab[currSample->fineTune & 0xF], video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrSampleNum) { ui.updateCurrSampleNum = false; if (!editor.mod2WavOngoing) { printTwoHexBg(80, 47, editor.sampleZero ? 0 : ((*editor.currSampleDisp) + 1), video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } } if (ui.updateCurrSampleVolume) { ui.updateCurrSampleVolume = false; if (!editor.mod2WavOngoing) printTwoHexBg(80, 58, *currSample->volumeDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrSampleLength) { ui.updateCurrSampleLength = false; if (!editor.mod2WavOngoing) { if (config.maxSampleLength == 0xFFFE) printFourHexBg(64, 69, *currSample->lengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); else printFiveHexBg(56, 69, *currSample->lengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } } if (ui.updateCurrSampleRepeat) { ui.updateCurrSampleRepeat = false; if (config.maxSampleLength == 0xFFFE) printFourHexBg(64, 80, *currSample->loopStartDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); else printFiveHexBg(56, 80, *currSample->loopStartDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrSampleReplen) { ui.updateCurrSampleReplen = false; if (config.maxSampleLength == 0xFFFE) printFourHexBg(64, 91, *currSample->loopLengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); else printFiveHexBg(56, 91, *currSample->loopLengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); }} void updateSongInfo2(void) // two middle rows of screen, always present{ if (ui.updateStatusText) { ui.updateStatusText = false; // clear background fillRect(88, 127, 17*FONT_CHAR_W, FONT_CHAR_H, video.palette[PAL_GENBKG]); // render status text if (!editor.errorMsgActive && editor.blockMarkFlag && !ui.askBoxShown && !editor.swapChannelFlag) { textOut(88, 127, "MARK BLOCK", video.palette[PAL_GENTXT]); charOut(192, 127, '-', video.palette[PAL_GENTXT]); editor.blockToPos = song->currRow; if (editor.blockFromPos >= editor.blockToPos) { printTwoDecimals(176, 127, editor.blockToPos, video.palette[PAL_GENTXT]); printTwoDecimals(200, 127, editor.blockFromPos, video.palette[PAL_GENTXT]); } else { printTwoDecimals(176, 127, editor.blockFromPos, video.palette[PAL_GENTXT]); printTwoDecimals(200, 127, editor.blockToPos, video.palette[PAL_GENTXT]); } } else { textOut(88, 127, ui.statusMessage, video.palette[PAL_GENTXT]); } } if (ui.updateSongBPM) { ui.updateSongBPM = false; if (!ui.samplerScreenShown) printThreeDecimalsBg(32, 123, song->currBPM, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrPattText) { ui.updateCurrPattText = false; if (!ui.samplerScreenShown)Lines 1–500 of 1998. Load more
// for finding memory leaks in debug mode with Visual Studio #if defined _DEBUG && defined _MSC_VER #include <crtdbg.h> #endif #include <stdio.h> #include <stdint.h> #include <stdbool.h> #include <string.h> #include <math.h> // modf() #ifdef _WIN32 #define WIN32_MEAN_AND_LEAN #include <windows.h> #include <SDL2/SDL_syswm.h> #endif #include <stdint.h> #include <stdbool.h> #ifndef _WIN32 #include <unistd.h> // usleep() #endif #include <ctype.h> // tolower() #include "pt2_helpers.h" #include "pt2_textout.h" #include "pt2_tables.h" #include "pt2_pattern_viewer.h" #include "pt2_sampler.h" #include "pt2_diskop.h" #include "pt2_visuals.h" #include "pt2_scopes.h" #include "pt2_edit.h" #include "pt2_config.h" #include "pt2_bmp.h" #include "pt2_sampling.h" #include "pt2_chordmaker.h" #include "pt2_mod2wav.h" #include "pt2_audio.h" #include "pt2_posed.h" #include "pt2_textedit.h" typedef struct sprite_t { bool visible; int8_t pixelType; int16_t newX, newY, x, y, w, h; uint32_t colorKey, *refreshBuffer; const void *data; } sprite_t; static int32_t oldCurrMode = -1; static uint32_t vuMetersBg[4 * (10 * 48)]; sprite_t sprites[SPRITE_NUM]; // globalized static const uint16_t cursorPosTable[24] = { 30, 54, 62, 70, 78, 86, 102, 126, 134, 142, 150, 158, 174, 198, 206, 214, 222, 230, 246, 270, 278, 286, 294, 302 }; void updateSongInfo1(void); void updateSongInfo2(void); void updateSampler(void); void updatePatternData(void); void blit32(int32_t x, int32_t y, int32_t w, int32_t h, const uint32_t *src) { const uint32_t *srcPtr = src; uint32_t *dstPtr = &video.frameBuffer[(y * SCREEN_W) + x]; for (int32_t yy = 0; yy < h; yy++) { memcpy(dstPtr, srcPtr, w * sizeof (int32_t)); srcPtr += w; dstPtr += SCREEN_W; } } void putPixel(int32_t x, int32_t y, const uint32_t pixelColor) { video.frameBuffer[(y * SCREEN_W) + x] = pixelColor; } void hLine(int32_t x, int32_t y, int32_t w, const uint32_t pixelColor) { uint32_t *dstPtr = &video.frameBuffer[(y * SCREEN_W) + x]; for (int32_t xx = 0; xx < w; xx++) dstPtr[xx] = pixelColor; } void vLine(int32_t x, int32_t y, int32_t h, const uint32_t pixelColor) { uint32_t *dstPtr = &video.frameBuffer[(y * SCREEN_W) + x]; for (int32_t yy = 0; yy < h; yy++) { *dstPtr = pixelColor; dstPtr += SCREEN_W; } } void drawFramework1(int32_t x, int32_t y, int32_t w, int32_t h) { hLine(x, y, w-1, video.palette[PAL_BORDER]); vLine(x, y+1, h-2, video.palette[PAL_BORDER]); hLine(x+1, y+h-1, w-1, video.palette[PAL_GENBKG2]); vLine(x+w-1, y+1, h-2, video.palette[PAL_GENBKG2]); putPixel(x, y+h-1, video.palette[PAL_GENBKG]); putPixel(x+w-1, y, video.palette[PAL_GENBKG]); fillRect(x+1, y+1, w-2, h-2, video.palette[PAL_GENBKG]); } void drawFramework2(int32_t x, int32_t y, int32_t w, int32_t h) { hLine(x, y, w-1, video.palette[PAL_GENBKG2]); vLine(x, y+1, h-2, video.palette[PAL_GENBKG2]); hLine(x+1, y+h-1, w-1, video.palette[PAL_BORDER]); vLine(x+w-1, y+1, h-2, video.palette[PAL_BORDER]); putPixel(x, y+h-1, video.palette[PAL_GENBKG]); putPixel(x+w-1, y, video.palette[PAL_GENBKG]); fillRect(x+1, y+1, w-2, h-2, video.palette[PAL_GENBKG]); } void drawFramework3(int32_t x, int32_t y, int32_t w, int32_t h) { fillRect(x, y, w, h, video.palette[PAL_GENBKG]); vLine(x, y, h-1, video.palette[PAL_BORDER]); vLine(x+1, y, h-2, video.palette[PAL_BORDER]); hLine(x+2, y, w-3, video.palette[PAL_BORDER]); hLine(x+2, y+1, w-4, video.palette[PAL_BORDER]); hLine(x+1, y+h-1, w-1, video.palette[PAL_GENBKG2]); hLine(x+2, y+h-2, w-2, video.palette[PAL_GENBKG2]); vLine(x+w-2, y+2, h-4, video.palette[PAL_GENBKG2]); vLine(x+w-1, y+1, h-3, video.palette[PAL_GENBKG2]); } void fillRect(int32_t x, int32_t y, int32_t w, int32_t h, const uint32_t pixelColor) { uint32_t *dstPtr = &video.frameBuffer[(y * SCREEN_W) + x]; for (int32_t yy = 0; yy < h; yy++) { for (int32_t xx = 0; xx < w; xx++) dstPtr[xx] = pixelColor; dstPtr += SCREEN_W; } } void drawButton1(int32_t x, int32_t y, int32_t w, int32_t h, const char *text) { const int32_t textW = (int32_t)strlen(text) * (FONT_CHAR_W - 1); drawFramework1(x, y, w, h); int32_t textX = x + ((w - textW) / 2); int32_t textY = y + ((h - FONT_CHAR_H) / 2); // kludge if (!strcmp(text, ARROW_UP_STR) || !strcmp(text, ARROW_DOWN_STR)) { textX--; textY--; } textOut2(textX, textY, text); } void drawButton2(int32_t x, int32_t y, int32_t w, int32_t h, const char *text) { const int32_t textW = (int32_t)strlen(text) * (FONT_CHAR_W - 1); drawFramework2(x, y, w, h); int32_t textX = x + ((w - textW) / 2); int32_t textY = y + ((h - FONT_CHAR_H) / 2); // kludge if (!strcmp(text, ARROW_UP_STR) || !strcmp(text, ARROW_DOWN_STR)) { textX--; textY--; } textOut2(textX, textY, text); } void drawUpButton(int32_t x, int32_t y) { drawFramework1(x, y, 11, 11); textOut2(x+1, y+2, ARROW_UP_STR); } void drawDownButton(int32_t x, int32_t y) { drawFramework1(x, y, 11, 11); textOut2(x+1, y+2, ARROW_DOWN_STR); } void statusAllRight(void) { setStatusMessage("ALL RIGHT", DO_CARRY); } void statusOutOfMemory(void) { displayErrorMsg("OUT OF MEMORY !!!"); } void statusSampleIsEmpty(void) { displayErrorMsg("SAMPLE IS EMPTY"); } void changeStatusText(const char *text) { fillRect(88, 127, 17*FONT_CHAR_W, FONT_CHAR_H, video.palette[PAL_GENBKG]); textOut(88, 127, text, video.palette[PAL_GENTXT]); } void statusNotSampleZero(void) { /* This rather confusing error message actually means that ** you can't load a sample to sample slot #0 (which isn't a ** real sample slot). */ displayErrorMsg("NOT SAMPLE 0 !"); } void renderFrame2(void) // use this in askBox() { updateMod2WavDialog(); // must be first to avoid flickering issues updateSongInfo1(); // top left side of screen, when "disk op"/"pos ed" is hidden updateSongInfo2(); // two middle rows of screen, always visible updatePatternData(); updateSampler(); handleLastGUIObjectDown(); // XXX drawSamplerLine(); writeSampleMonitorWaveform(); // XXX } void renderFrame(void) { renderFrame2(); updateEditOp(); updateDiskOp(); updatePosEd(); updateVisualizer(); // show [EDITING] in window title if in edit mode if (oldCurrMode != editor.currMode) { oldCurrMode = editor.currMode; if (song != NULL) updateWindowTitle(song->modified); } } void resetAllScreens(void) // prepare GUI for "really quit?" dialog { editor.mixFlag = false; editor.swapChannelFlag = false; ui.changingChordNote = false; ui.changingSmpResample = false; ui.changingSamplingNote = false; ui.changingDrumPadNote = false; ui.disableVisualizer = false; if (ui.samplerScreenShown) { if (ui.samplingBoxShown) { ui.samplingBoxShown = false; removeSamplingBox(); } ui.samplerVolBoxShown = false; ui.samplerFiltersBoxShown = false; displaySample(); // removes volume/filter box } if (ui.editTextFlag) leaveTextEditMode(EDIT_TEXT_NO_UPDATE); } static void fillFromVuMetersBgBuffer(void) { if (ui.samplerScreenShown || editor.mod2WavOngoing || editor.pat2SmpOngoing) return; const uint32_t *srcPtr = vuMetersBg; uint32_t *dstPtr = &video.frameBuffer[(187 * SCREEN_W) + 55]; for (uint32_t i = 0; i < PAULA_VOICES; i++) { for (uint32_t y = 0; y < 48; y++) { for (uint32_t x = 0; x < 10; x++) dstPtr[x] = srcPtr[x]; srcPtr += 10; dstPtr -= SCREEN_W; } dstPtr += (SCREEN_W * 48) + 72; } } void fillToVuMetersBgBuffer(void) { if (ui.samplerScreenShown || editor.mod2WavOngoing || editor.pat2SmpOngoing) return; const uint32_t *srcPtr = &video.frameBuffer[(187 * SCREEN_W) + 55]; uint32_t *dstPtr = vuMetersBg; for (uint32_t i = 0; i < PAULA_VOICES; i++) { for (uint32_t y = 0; y < 48; y++) { for (uint32_t x = 0; x < 10; x++) dstPtr[x] = srcPtr[x]; srcPtr -= SCREEN_W; dstPtr += 10; } srcPtr += (SCREEN_W * 48) + 72; } } void renderVuMeters(void) { if (ui.samplerScreenShown || editor.mod2WavOngoing || editor.pat2SmpOngoing) return; fillToVuMetersBgBuffer(); uint32_t *dstPtr = &video.frameBuffer[(187 * SCREEN_W) + 55]; for (uint32_t i = 0; i < PAULA_VOICES; i++) { uint32_t h; if (config.realVuMeters) h = editor.realVuMeterVolumes[i]; else h = editor.vuMeterVolumes[i]; if (h > 48) h = 48; const uint32_t *srcPtr = vuMeterBMP; for (uint32_t y = 0; y < h; y++) { for (uint32_t x = 0; x < 10; x++) dstPtr[x] = srcPtr[x]; srcPtr += 10; dstPtr -= SCREEN_W; } dstPtr += (SCREEN_W * h) + 72; } } void updateSongInfo1(void) // left side of screen, when Disk Op. is hidden { if (ui.diskOpScreenShown) return; moduleSample_t *currSample = &song->samples[editor.currSample]; if (ui.updateSongPos) { ui.updateSongPos = false; printThreeDecimalsBg(72, 3, *editor.currPosDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateSongPattern) { ui.updateSongPattern = false; printTwoDecimalsBg(80, 14, *editor.currPatternDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateSongLength) { ui.updateSongLength = false; if (!editor.mod2WavOngoing) printThreeDecimalsBg(72, 25, *editor.currLengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrSampleFineTune) { ui.updateCurrSampleFineTune = false; if (!editor.mod2WavOngoing) textOutBg(80, 36, ftuneStrTab[currSample->fineTune & 0xF], video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrSampleNum) { ui.updateCurrSampleNum = false; if (!editor.mod2WavOngoing) { printTwoHexBg(80, 47, editor.sampleZero ? 0 : ((*editor.currSampleDisp) + 1), video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } } if (ui.updateCurrSampleVolume) { ui.updateCurrSampleVolume = false; if (!editor.mod2WavOngoing) printTwoHexBg(80, 58, *currSample->volumeDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrSampleLength) { ui.updateCurrSampleLength = false; if (!editor.mod2WavOngoing) { if (config.maxSampleLength == 0xFFFE) printFourHexBg(64, 69, *currSample->lengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); else printFiveHexBg(56, 69, *currSample->lengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } } if (ui.updateCurrSampleRepeat) { ui.updateCurrSampleRepeat = false; if (config.maxSampleLength == 0xFFFE) printFourHexBg(64, 80, *currSample->loopStartDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); else printFiveHexBg(56, 80, *currSample->loopStartDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrSampleReplen) { ui.updateCurrSampleReplen = false; if (config.maxSampleLength == 0xFFFE) printFourHexBg(64, 91, *currSample->loopLengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); else printFiveHexBg(56, 91, *currSample->loopLengthDisp, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } } void updateSongInfo2(void) // two middle rows of screen, always present { if (ui.updateStatusText) { ui.updateStatusText = false; // clear background fillRect(88, 127, 17*FONT_CHAR_W, FONT_CHAR_H, video.palette[PAL_GENBKG]); // render status text if (!editor.errorMsgActive && editor.blockMarkFlag && !ui.askBoxShown && !editor.swapChannelFlag) { textOut(88, 127, "MARK BLOCK", video.palette[PAL_GENTXT]); charOut(192, 127, '-', video.palette[PAL_GENTXT]); editor.blockToPos = song->currRow; if (editor.blockFromPos >= editor.blockToPos) { printTwoDecimals(176, 127, editor.blockToPos, video.palette[PAL_GENTXT]); printTwoDecimals(200, 127, editor.blockFromPos, video.palette[PAL_GENTXT]); } else { printTwoDecimals(176, 127, editor.blockFromPos, video.palette[PAL_GENTXT]); printTwoDecimals(200, 127, editor.blockToPos, video.palette[PAL_GENTXT]); } } else { textOut(88, 127, ui.statusMessage, video.palette[PAL_GENTXT]); } } if (ui.updateSongBPM) { ui.updateSongBPM = false; if (!ui.samplerScreenShown) printThreeDecimalsBg(32, 123, song->currBPM, video.palette[PAL_GENTXT], video.palette[PAL_GENBKG]); } if (ui.updateCurrPattText) { ui.updateCurrPattText = false; if (!ui.samplerScreenShown)