Commit e7ba1c44 authored by Chris Wraight's avatar Chris Wraight Committed by ROOL

Bug fixes

A number of fixes following testing of recent changes:
- PROCinsert_gate: Ensure pointers to music data are preserved when the Gate heap block is resized, to prevent possible corruption
- PROCmove_note: Call to PROCSetupBarStarts is superfluous here, since it's called later on
- PROCplay_notes: Fix calculation of tie lengths
- PROCdraw_notes: Ensure dots are positioned correctly after staggered notes
- A number of Maestro files tested have key signatures of 1/x. It's not clear how these were created (the interface has never allowed it) but since such signatures are technically legal, add sprites to display them correctly when encountered. Also extend the interface to allow them to be entered into scores. These bar lengths seem to cause the scrolling to become a little jerky but otherwise appear to work fine.

Version 2.17. Tagged as 'Maestro-2_17'
parent 09cae55f
No preview for this file type
No preview for this file type
No preview for this file type
/* (2.16) /* (2.17)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 2.16 #define Module_MajorVersion_CMHG 2.17
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 13 Mar 2021 #define Module_Date_CMHG 27 Mar 2021
#define Module_MajorVersion "2.16" #define Module_MajorVersion "2.17"
#define Module_Version 216 #define Module_Version 217
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "13 Mar 2021" #define Module_Date "27 Mar 2021"
#define Module_ApplicationDate "13-Mar-21" #define Module_ApplicationDate "27-Mar-21"
#define Module_ComponentName "Maestro" #define Module_ComponentName "Maestro"
#define Module_FullVersion "2.16" #define Module_FullVersion "2.17"
#define Module_HelpVersion "2.16 (13 Mar 2021)" #define Module_HelpVersion "2.17 (27 Mar 2021)"
#define Module_LibraryVersionInfo "2:16" #define Module_LibraryVersionInfo "2:17"
...@@ -798,28 +798,24 @@ ENDPROC ...@@ -798,28 +798,24 @@ ENDPROC
DEF PROCtimesig_click (icon%,button%) DEF PROCtimesig_click (icon%,button%)
REM Time signature held in TIME_SIG%() as (n+1) / 2^(d-1) REM Time signature held in TIME_SIG%() as (n+1) / 2^(d-1)
REM To edit, we have to convert to the following range: REM To edit, we have to convert to the following range:
REM n = 2-16; b = 2,4,8,16 REM n = 1-16; b = 2,4,8,16
LOCAL n%,b%,v% LOCAL n%,b%,v%
n%=VAL(FNwimp_geticontext(TimeSig_h%,0))-1 n%=VAL(FNwimp_geticontext(TimeSig_h%,0))-1
b%=SQR(VAL(FNwimp_geticontext(TimeSig_h%,1))+1)+1 b%=SQR(VAL(FNwimp_geticontext(TimeSig_h%,1))+1)+1
CASE icon% OF CASE icon% OF
WHEN 2:REM Decrement n WHEN 2:REM Decrement n
IF button%=4 AND n%>1 THEN IF button%=4 AND n%>0 THEN
v%=1+(n%+13) MOD 15 PROCwimp_seticontext(TimeSig_h%,0,STR$(n%))
PROCwimp_seticontext(TimeSig_h%,0,STR$(v%+1))
ENDIF ENDIF
IF button%=1 AND n%<15 THEN IF button%=1 AND n%<15 THEN
v%=1+(n%+15) MOD 15 PROCwimp_seticontext(TimeSig_h%,0,STR$(n%+2))
PROCwimp_seticontext(TimeSig_h%,0,STR$(v%+1))
ENDIF ENDIF
WHEN 3:REM Increment n WHEN 3:REM Increment n
IF button%=4 AND n%<15 THEN IF button%=4 AND n%<15 THEN
v%=1+(n%+15) MOD 15 PROCwimp_seticontext(TimeSig_h%,0,STR$(n%+2))
PROCwimp_seticontext(TimeSig_h%,0,STR$(v%+1))
ENDIF ENDIF
IF button%=1 AND n%>1 THEN IF button%=1 AND n%>0 THEN
v%=1+(n%+13) MOD 15 PROCwimp_seticontext(TimeSig_h%,0,STR$(n%))
PROCwimp_seticontext(TimeSig_h%,0,STR$(v%+1))
ENDIF ENDIF
WHEN 4:REM Decrement b WHEN 4:REM Decrement b
IF button%=4 AND b%>2 THEN IF button%=4 AND b%>2 THEN
...@@ -1620,8 +1616,8 @@ CASE s% OF ...@@ -1620,8 +1616,8 @@ CASE s% OF
ENDIF ENDIF
height%=72 height%=72
WHEN time%:REM Time signature WHEN time%:REM Time signature
n%=TIME_SIG%(0)+1 n%=TIME_SIG%(0)+2
b%=2^(TIME_SIG%(1)-1) b%=2^(TIME_SIG%(1)-1)+1
width%=X%(time%+n%) width%=X%(time%+n%)
IF width%<X%(time%+b%) THEN width%=X%(time%+b%) IF width%<X%(time%+b%) THEN width%=X%(time%+b%)
height%=Stave_Height% height%=Stave_Height%
...@@ -1669,11 +1665,11 @@ ENDPROC ...@@ -1669,11 +1665,11 @@ ENDPROC
DEF PROCfloat_time_sig (tx%,ty%,width%) DEF PROCfloat_time_sig (tx%,ty%,width%)
LOCAL sx%,w%,n%,b% LOCAL sx%,w%,n%,b%
n%=TIME_SIG%(0)+1 n%=TIME_SIG%(0)+2
w%=X%(time%+n%) w%=X%(time%+n%)
IF w%<width% THEN sx%=tx%+12 ELSE sx%=tx% IF w%<width% THEN sx%=tx%+12 ELSE sx%=tx%
SYS "OS_SpriteOp",SprPlot%,SprBlk%,S%(time%+n%),sx%,ty%+36,11,factors%,fpixtrans% SYS "OS_SpriteOp",SprPlot%,SprBlk%,S%(time%+n%),sx%,ty%+36,11,factors%,fpixtrans%
b%=2^(TIME_SIG%(1)-1) b%=2^(TIME_SIG%(1)-1)+1
w%=X%(time%+b%) w%=X%(time%+b%)
IF w%<width% THEN sx%=tx%+12 ELSE sx%=tx% IF w%<width% THEN sx%=tx%+12 ELSE sx%=tx%
SYS "OS_SpriteOp",SprPlot%,SprBlk%,S%(time%+b%),sx%,ty%+4,11,factors%,fpixtrans% SYS "OS_SpriteOp",SprPlot%,SprBlk%,S%(time%+b%),sx%,ty%+4,11,factors%,fpixtrans%
...@@ -1877,7 +1873,10 @@ IF GateSize%>bsize%-4 THEN ...@@ -1877,7 +1873,10 @@ IF GateSize%>bsize%-4 THEN
ENDIF ENDIF
GP%=GateBlock%+goff% GP%=GateBlock%+goff%
EP%=GateBlock%+GateSize% EP%=GateBlock%+GateSize%
PROCSetupBarStarts(0) PROCsavp
PROCSetupBarStarts(0)
PROCrstp
SCRIBE%(sgp%)=GP%
ENDIF ENDIF
IF GP%<EP% THEN IF GP%<EP% THEN
REM Shift data up by gsize% from insertion point REM Shift data up by gsize% from insertion point
...@@ -2055,7 +2054,6 @@ s%=C%(N%):d%=c%(N%) ...@@ -2055,7 +2054,6 @@ s%=C%(N%):d%=c%(N%)
IF NOT FNinsert_note(d%) THEN ENDPROC IF NOT FNinsert_note(d%) THEN ENDPROC
!N%(d%)=!N%(s%) !N%(d%)=!N%(s%)
PROCdelete_note(s%) PROCdelete_note(s%)
PROCSetupBarStarts(0)
ENDPROC ENDPROC
DEF FNbest DEF FNbest
...@@ -2591,7 +2589,9 @@ REPEAT ...@@ -2591,7 +2589,9 @@ REPEAT
PROCsprite(s%,x%,y%) PROCsprite(s%,x%,y%)
ENDIF ENDIF
REM Draw dots REM Draw dots
IF (n1% AND &18) THEN PROCsprite(dot%+(n1%>>3 AND &3),x%+x%(s%),y%+(line%*Li%)) IF (n1% AND &18) THEN
PROCsprite(dot%+(n1%>>3 AND &3),x%+offset%+x%(s%),y%+(line%*Li%))
ENDIF
REM Draw tie REM Draw tie
IF (n0% AND &4) THEN PROCdraw_tie(tie%+((n0% AND &2)>>1),x%,y%+(line%*Li%),c%) IF (n0% AND &4) THEN PROCdraw_tie(tie%+((n0% AND &2)>>1),x%,y%+(line%*Li%),c%)
UNTIL (2<<c%)>g% UNTIL (2<<c%)>g%
...@@ -2756,8 +2756,8 @@ ENDPROC ...@@ -2756,8 +2756,8 @@ ENDPROC
DEF PROCdraw_time_sig (a%,x%) DEF PROCdraw_time_sig (a%,x%)
LOCAL i%,n%,b%,nx%,bx% LOCAL i%,n%,b%,nx%,bx%
SIG%(0)=a% SIG%(0)=a%
n%=(a%>>1 AND 15)+1 n%=(a%>>1 AND 15)+2
b%=%1<<(a%>>5)-1 b%=(1<<(a%>>5)-1)+1
IF X%(time%+n%)+x%(time%+n%)<PW%(PX%) THEN nx%=x%+12 ELSE nx%=x% IF X%(time%+n%)+x%(time%+n%)<PW%(PX%) THEN nx%=x%+12 ELSE nx%=x%
nx%+=x%(time%+n%) nx%+=x%(time%+n%)
IF X%(time%+b%)+x%(time%+b%)<PW%(PX%) THEN bx%=x%+12 ELSE bx%=x% IF X%(time%+b%)+x%(time%+b%)<PW%(PX%) THEN bx%=x%+12 ELSE bx%=x%
...@@ -3588,9 +3588,9 @@ REPEAT ...@@ -3588,9 +3588,9 @@ REPEAT
IF T% AND 4 THEN IF T% AND 4 THEN
TIE%=TIE% AND NOT (%1<<C%) TIE%=TIE% AND NOT (%1<<C%)
T%=P%(C%)+1 T%=P%(C%)+1
REPEAT T%+=2 REPEAT T%+=NSIZE%
D%+=Duration%(Tempo%)?(?T%>>3) D%+=Duration%(Tempo%)?(?T%>>3)
UNTIL T%>(NoteBlock%(C%)+NoteSize%(C%)) OR 4 AND NOT T%?TRUE UNTIL T%>(NoteBlock%(C%)+NoteSize%(C%)) OR (4 AND NOT T%?-1)
IF D%>254 THEN D%=254 IF D%>254 THEN D%=254
ENDIF ENDIF
IFL% THEN IFL% THEN
...@@ -3805,9 +3805,9 @@ tie%=44 ...@@ -3805,9 +3805,9 @@ tie%=44
bar%=51 bar%=51
time%=55 time%=55
key%=56 key%=56
SPR_CHEAD%=72 SPR_CHEAD%=73
SPR_MHEAD%=73 SPR_MHEAD%=74
SPR_REVERSE%=74 SPR_REVERSE%=75
SCORING%=FALSE:REM Flag indicating a sprite is to be drawn under the pointer SCORING%=FALSE:REM Flag indicating a sprite is to be drawn under the pointer
wasSCORING%=FALSE wasSCORING%=FALSE
stopSCORING%=TRUE stopSCORING%=TRUE
...@@ -3845,7 +3845,7 @@ DATA Dot1,-14,1,4,2,Dot2,-14,1,9,2,Dot3,-14,1,14,2,Tie,-8,-3,20,4,Tie2,-8,7,20,4 ...@@ -3845,7 +3845,7 @@ DATA Dot1,-14,1,4,2,Dot2,-14,1,9,2,Dot3,-14,1,14,2,Tie,-8,-3,20,4,Tie2,-8,7,20,4
DATA ldg1,2,-12,16,1,ldg2,2,-12,16,5,ldg3,2,-12,16,9,ldg4,2,-12,16,13,ldg5,2,-12,16,17 DATA ldg1,2,-12,16,1,ldg2,2,-12,16,5,ldg3,2,-12,16,9,ldg4,2,-12,16,13,ldg5,2,-12,16,17
DATA Bar,-1,8,4,16,DBar,-1,8,6,16,Bar,-2,8,1,16,Bar,-2,8,1,16 DATA Bar,-1,8,4,16,DBar,-1,8,6,16,Bar,-2,8,1,16,Bar,-2,8,1,16
DATA Time,1,9,14,16,Key,0,8,9,17 DATA Time,1,9,14,16,Key,0,8,9,17
DATA 2,3,0,14,8,3,3,0,14,8,4,3,0,14,8,5,3,0,14,8,6,3,0,14,8 DATA 1,3,0,14,8,2,3,0,14,8,3,3,0,14,8,4,3,0,14,8,5,3,0,14,8,6,3,0,14,8
DATA 7,3,0,14,8,8,3,0,14,8,9,3,0,14,8,10,3,0,26,8,11,3,0,26,8 DATA 7,3,0,14,8,8,3,0,14,8,9,3,0,14,8,10,3,0,26,8,11,3,0,26,8
DATA 12,3,0,26,8,13,3,0,26,8,14,3,0,26,8,15,3,0,26,8,16,3,0,26,8 DATA 12,3,0,26,8,13,3,0,26,8,14,3,0,26,8,15,3,0,26,8,16,3,0,26,8
DATA C,0,2,12,4,M,0,2,12,4 DATA C,0,2,12,4,M,0,2,12,4
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment