| @@ -114,7 +114,6 @@ static const uint8_t mx2PianoKey[77] = · 113 unmodified lines |
| 114 | 114 | 9,9,9,9,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11 |
| 115 | 115 | }; |
| 116 | 116 | |
| 117 | | − |
| 118 | 117 | // thread data |
| 119 | 118 | static uint16_t saveInstrNr; |
| 120 | 119 | static SDL_Thread *thread; |
| @@ -438,6 +437,23 @@ static void drawPanning(void) · 317 unmodified lines |
| 438 | 437 | hexOutBg(505, 191, PAL_FORGRND, PAL_DESKTOP, s->pan, 2); |
| 439 | 438 | } |
| 440 | 439 | |
| 440 | +void drawC4Rate(void) |
| 441 | +{ |
| 442 | + fillRect(465, 299, 71, 8, PAL_DESKTOP); |
| 443 | + |
| 444 | + int32_t C4Hz = 0; |
| 445 | + if (editor.curInstr != 0) |
| 446 | + { |
| 447 | + instrTyp *ins = instr[editor.curInstr]; |
| 448 | + if (ins != NULL) |
| 449 | + C4Hz = (int32_t)(getSampleC4Rate(&ins->samp[editor.curSmp]) + 0.5); // rounded |
| 450 | + } |
| 451 | + |
| 452 | + char str[64]; |
| 453 | + sprintf(str, "%dHz", C4Hz); |
| 454 | + textOut(465, 299, PAL_FORGRND, str); |
| 455 | +} |
| 456 | + |
| 441 | 457 | static void drawFineTune(void) |
| 442 | 458 | { |
| 443 | 459 | sampleTyp *s; |
| @@ -505,7 +521,7 @@ static void drawRelTone(void) · 61 unmodified lines |
| 505 | 521 | |
| 506 | 522 | if (instr[editor.curInstr] == NULL) |
| 507 | 523 | { |
| 508 | | − fillRect(598, 299, 8*3, 8, PAL_BCKGRND); |
| 524 | + fillRect(600, 299, 8*3, 8, PAL_BCKGRND); |
| 509 | 525 | return; |
| 510 | 526 | } |
| 511 | 527 | |
| @@ -528,9 +544,9 @@ static void drawRelTone(void) · 16 unmodified lines |
| 528 | 544 | |
| 529 | 545 | const char octaChar = '0' + (note2 / 12); |
| 530 | 546 | |
| 531 | | − charOutBg(598, 299, PAL_FORGRND, PAL_BCKGRND, noteChar1); |
| 532 | | − charOutBg(606, 299, PAL_FORGRND, PAL_BCKGRND, noteChar2); |
| 533 | | − charOutBg(614, 299, PAL_FORGRND, PAL_BCKGRND, octaChar); |
| 547 | + charOutBg(600, 299, PAL_FORGRND, PAL_BCKGRND, noteChar1); |
| 548 | + charOutBg(608, 299, PAL_FORGRND, PAL_BCKGRND, noteChar2); |
| 549 | + charOutBg(616, 299, PAL_FORGRND, PAL_BCKGRND, octaChar); |
| 534 | 550 | } |
| 535 | 551 | |
| 536 | 552 | static void setStdVolEnvelope(instrTyp *ins, uint8_t num) |
| @@ -723,6 +739,7 @@ void relToneOctUp(void) · 186 unmodified lines |
| 723 | 739 | s->relTon = 71; |
| 724 | 740 | |
| 725 | 741 | drawRelTone(); |
| 742 | + drawC4Rate(); |
| 726 | 743 | setSongModifiedFlag(); |
| 727 | 744 | } |
| 728 | 745 | |
| @@ -739,6 +756,7 @@ void relToneOctDown(void) · 10 unmodified lines |
| 739 | 756 | s->relTon = -48; |
| 740 | 757 | |
| 741 | 758 | drawRelTone(); |
| 759 | + drawC4Rate(); |
| 742 | 760 | setSongModifiedFlag(); |
| 743 | 761 | } |
| 744 | 762 | |
| @@ -753,6 +771,7 @@ void relToneUp(void) · 8 unmodified lines |
| 753 | 771 | { |
| 754 | 772 | s->relTon++; |
| 755 | 773 | drawRelTone(); |
| 774 | + drawC4Rate(); |
| 756 | 775 | setSongModifiedFlag(); |
| 757 | 776 | } |
| 758 | 777 | } |
| @@ -768,6 +787,7 @@ void relToneDown(void) · 9 unmodified lines |
| 768 | 787 | { |
| 769 | 788 | s->relTon--; |
| 770 | 789 | drawRelTone(); |
| 790 | + drawC4Rate(); |
| 771 | 791 | setSongModifiedFlag(); |
| 772 | 792 | } |
| 773 | 793 | } |
| @@ -1283,6 +1303,7 @@ void setFinetuneScroll(uint32_t pos) · 509 unmodified lines |
| 1283 | 1303 | { |
| 1284 | 1304 | s->fine = (int8_t)(pos - 128); |
| 1285 | 1305 | drawFineTune(); |
| 1306 | + drawC4Rate(); |
| 1286 | 1307 | setSongModifiedFlag(); |
| 1287 | 1308 | } |
| 1288 | 1309 | } |
| @@ -1945,55 +1966,6 @@ static void writeEnvelope(int32_t nr) · 656 unmodified lines |
| 1945 | 1966 | } |
| 1946 | 1967 | } |
| 1947 | 1968 | |
| 1948 | | −static void textOutTiny(int32_t xPos, int32_t yPos, char *str, uint32_t color) |
| 1949 | | −{ |
| 1950 | | − uint32_t *dstPtr = &video.frameBuffer[(yPos * SCREEN_W) + xPos]; |
| 1951 | | − while (*str != '\0') |
| 1952 | | − { |
| 1953 | | − const char chr = *str++; |
| 1954 | | − if (chr < '0' || chr > '9') |
| 1955 | | − { |
| 1956 | | − dstPtr += FONT3_CHAR_W; |
| 1957 | | − continue; |
| 1958 | | − } |
| 1959 | | − |
| 1960 | | − const uint8_t *srcPtr = &bmp.font3[(chr - '0') * FONT3_CHAR_W]; |
| 1961 | | − for (int32_t y = 0; y < FONT3_CHAR_H; y++) |
| 1962 | | − { |
| 1963 | | − for (int32_t x = 0; x < FONT3_CHAR_W; x++) |
| 1964 | | − { |
| 1965 | | −#ifdef __arm__ |
| 1966 | | − if (srcPtr[x] != 0) |
| 1967 | | − dstPtr[x] = color; |
| 1968 | | −#else |
| 1969 | | − // carefully written like this to generate conditional move instructions (font data is hard to predict) |
| 1970 | | − uint32_t tmp = dstPtr[x]; |
| 1971 | | − if (srcPtr[x] != 0) tmp = color; |
| 1972 | | − dstPtr[x] = tmp; |
| 1973 | | −#endif |
| 1974 | | − } |
| 1975 | | − |
| 1976 | | − srcPtr += FONT3_WIDTH; |
| 1977 | | − dstPtr += SCREEN_W; |
| 1978 | | − } |
| 1979 | | − |
| 1980 | | − dstPtr -= (SCREEN_W * FONT3_CHAR_H) - FONT3_CHAR_W; |
| 1981 | | − } |
| 1982 | | −} |
| 1983 | | − |
| 1984 | | −static void textOutTinyOutline(int32_t xPos, int32_t yPos, char *str) |
| 1985 | | −{ |
| 1986 | | − const uint32_t bgColor = video.palette[PAL_BCKGRND]; |
| 1987 | | − const uint32_t fgColor = video.palette[PAL_FORGRND]; |
| 1988 | | − |
| 1989 | | − textOutTiny(xPos-1, yPos, str, bgColor); |
| 1990 | | − textOutTiny(xPos, yPos-1, str, bgColor); |
| 1991 | | − textOutTiny(xPos+1, yPos, str, bgColor); |
| 1992 | | − textOutTiny(xPos, yPos+1, str, bgColor); |
| 1993 | | − |
| 1994 | | − textOutTiny(xPos, yPos, str, fgColor); |
| 1995 | | −} |
| 1996 | | − |
| 1997 | 1969 | static void drawVolEnvCoords(int16_t tick, int16_t val) |
| 1998 | 1970 | { |
| 1999 | 1971 | char str[4]; |
| @@ -2053,7 +2025,7 @@ void handleInstEditorRedrawing(void) · 53 unmodified lines |
| 2053 | 2025 | tick = 0; |
| 2054 | 2026 | val = 0; |
| 2055 | 2027 | |
| 2056 | | − if (ins != NULL) |
| 2028 | + if (ins != NULL && ins->envVPAnt > 0) |
| 2057 | 2029 | { |
| 2058 | 2030 | tick = ins->envVP[editor.currVolEnvPoint][0]; |
| 2059 | 2031 | val = ins->envVP[editor.currVolEnvPoint][1]; |
| @@ -2070,7 +2042,7 @@ void handleInstEditorRedrawing(void) · 10 unmodified lines |
| 2070 | 2042 | tick = 0; |
| 2071 | 2043 | val = 32; |
| 2072 | 2044 | |
| 2073 | | − if (ins != NULL) |
| 2045 | + if (ins != NULL && ins->envPPAnt > 0) |
| 2074 | 2046 | { |
| 2075 | 2047 | tick = ins->envPP[editor.currPanEnvPoint][0]; |
| 2076 | 2048 | val = ins->envPP[editor.currPanEnvPoint][1]; |
| @@ -2201,6 +2173,7 @@ void updateInstEditor(void) · 124 unmodified lines |
| 2201 | 2173 | drawVibSpeed(); |
| 2202 | 2174 | drawVibDepth(); |
| 2203 | 2175 | drawVibSweep(); |
| 2176 | + drawC4Rate(); |
| 2204 | 2177 | drawRelTone(); |
| 2205 | 2178 | |
| 2206 | 2179 | // set scroll bars |
| @@ -2271,7 +2244,7 @@ void showInstEditor(void) · 64 unmodified lines |
| 2271 | 2244 | drawFramework(2, 188, 337, 70, FRAMEWORK_TYPE2); |
| 2272 | 2245 | drawFramework(2, 275, 337, 70, FRAMEWORK_TYPE2); |
| 2273 | 2246 | drawFramework(2, 349, 628, 49, FRAMEWORK_TYPE2); |
| 2274 | | − drawFramework(590, 296, 40, 15, FRAMEWORK_TYPE2); |
| 2247 | + drawFramework(593, 296, 36, 15, FRAMEWORK_TYPE2); |
| 2275 | 2248 | |
| 2276 | 2249 | textOutShadow(20, 176, PAL_FORGRND, PAL_DSKTOP2, "Volume envelope:"); |
| 2277 | 2250 | textOutShadow(153, 176, PAL_FORGRND, PAL_DSKTOP2, "Predef."); |
| @@ -2294,7 +2267,8 @@ void showInstEditor(void) · 16 unmodified lines |
| 2294 | 2267 | textOutShadow(442, 236, PAL_FORGRND, PAL_DSKTOP2, "Vib.speed"); |
| 2295 | 2268 | textOutShadow(442, 250, PAL_FORGRND, PAL_DSKTOP2, "Vib.depth"); |
| 2296 | 2269 | textOutShadow(442, 264, PAL_FORGRND, PAL_DSKTOP2, "Vib.sweep"); |
| 2297 | | − textOutShadow(453, 299, PAL_FORGRND, PAL_DSKTOP2, "Tone relative to C-4:"); |
| 2270 | + textOutShadow(442, 299, PAL_FORGRND, PAL_DSKTOP2, "C4="); |
| 2271 | + textOutShadow(537, 299, PAL_FORGRND, PAL_DSKTOP2, "Rel. note"); |
| 2298 | 2272 | |
| 2299 | 2273 | showScrollBar(SB_INST_VOL); |
| 2300 | 2274 | showScrollBar(SB_INST_PAN); |