BASIC compiler/interpreter for PIC32MX/MZ-80K (suspended)
| Revision | 145 (tree) |
|---|---|
| Time | 2016-07-31 13:57:49 |
| Author | kmorimatsu |
Same tone of MUSIC/SOUND in graphic mode as in text mode
| @@ -357,6 +357,12 @@ | ||
| 357 | 357 | sound=data[0]&0x0000FFFF; |
| 358 | 358 | data++; |
| 359 | 359 | if (len) { |
| 360 | + // Shift tone if graphic is used | |
| 361 | + if (g_use_graphic) { | |
| 362 | + // MUL_15 instead of MUL_16 for CPU clock. | |
| 363 | + // sound=sound*15/16 | |
| 364 | + sound-=(sound+7)>>4; | |
| 365 | + } | |
| 360 | 366 | g_sound[pos]=sound-1; |
| 361 | 367 | g_soundlen[pos]=len; |
| 362 | 368 | pos++; |
| @@ -452,6 +458,12 @@ | ||
| 452 | 458 | g_mspos++; |
| 453 | 459 | len=len/musicGetNum(); |
| 454 | 460 | } |
| 461 | + // Shift tone if graphic is used | |
| 462 | + if (g_use_graphic) { | |
| 463 | + // MUL_15 instead of MUL_16 for CPU clock. | |
| 464 | + // tone=tone*15/16 | |
| 465 | + tone-=(tone+7)>>4; | |
| 466 | + } | |
| 455 | 467 | // Update music value array |
| 456 | 468 | IEC0bits.T4IE=0; // Stop interruption, first. |
| 457 | 469 | if (g_musicstart==g_musicend) { |