@@ -691,7 +691,7 @@ void handleEditKeys(SDL_Scancode scancode, bool normalMode)
691691 if (handleSpecialKeys (scancode ))
692692 {
693693 if (editor .currMode != MODE_RECORD )
694- modSetPos (DONT_SET_ORDER , (modEntry -> currRow + editor .editMoveAdd ) & 63 );
694+ modSetPos (DONT_SET_ORDER , (modEntry -> currRow + editor .editMoveAdd ) & 0x3F );
695695
696696 return ;
697697 }
@@ -830,11 +830,11 @@ void handleEditKeys(SDL_Scancode scancode, bool normalMode)
830830 if (input .keyb .shiftPressed || input .keyb .leftAltPressed )
831831 {
832832 note -> command = 0 ;
833- note -> param = 0 ;
833+ note -> param = 0 ;
834834 }
835835
836836 if (editor .currMode != MODE_RECORD )
837- modSetPos (DONT_SET_ORDER , (modEntry -> currRow + editor .editMoveAdd ) & 63 );
837+ modSetPos (DONT_SET_ORDER , (modEntry -> currRow + editor .editMoveAdd ) & 0x3F );
838838
839839 updateWindowTitle (MOD_IS_MODIFIED );
840840 }
@@ -854,51 +854,51 @@ bool handleSpecialKeys(SDL_Scancode scancode)
854854{
855855 note_t * patt , * note , * prevNote ;
856856
857- if (input .keyb .leftAltPressed )
858- {
859- patt = modEntry -> patterns [modEntry -> currPattern ];
860- note = & patt [(modEntry -> currRow * AMIGA_VOICES ) + editor .cursor .channel ];
861- prevNote = & patt [(((modEntry -> currRow - 1 ) & 0x3F ) * AMIGA_VOICES ) + editor .cursor .channel ];
857+ if (!input .keyb .leftAltPressed )
858+ return false;
862859
863- if (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0 )
864- {
865- // insert stored effect (buffer[0..8])
866- note -> command = editor .effectMacros [scancode - SDL_SCANCODE_1 ] >> 8 ;
867- note -> param = editor .effectMacros [scancode - SDL_SCANCODE_1 ] & 0xFF ;
860+ patt = modEntry -> patterns [modEntry -> currPattern ];
861+ note = & patt [(modEntry -> currRow * AMIGA_VOICES ) + editor .cursor .channel ];
862+ prevNote = & patt [(((modEntry -> currRow - 1 ) & 0x3F ) * AMIGA_VOICES ) + editor .cursor .channel ];
868863
869- updateWindowTitle (MOD_IS_MODIFIED );
870- return true;
871- }
864+ if (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0 )
865+ {
866+ // insert stored effect (buffer[0..8])
867+ note -> command = editor .effectMacros [scancode - SDL_SCANCODE_1 ] >> 8 ;
868+ note -> param = editor .effectMacros [scancode - SDL_SCANCODE_1 ] & 0xFF ;
872869
873- // copy command+effect from above into current command+effect
874- if (scancode == SDL_SCANCODE_BACKSLASH )
875- {
876- note -> command = prevNote -> command ;
877- note -> param = prevNote -> param ;
870+ updateWindowTitle (MOD_IS_MODIFIED );
871+ return true;
872+ }
878873
879- updateWindowTitle (MOD_IS_MODIFIED );
880- return true;
881- }
874+ // copy command+effect from above into current command+effect
875+ if (scancode == SDL_SCANCODE_BACKSLASH )
876+ {
877+ note -> command = prevNote -> command ;
878+ note -> param = prevNote -> param ;
882879
883- // copy command+(effect + 1) from above into current command+effect
884- if (scancode == SDL_SCANCODE_EQUALS )
885- {
886- note -> command = prevNote -> command ;
887- note -> param = prevNote -> param + 1 ; // wraps 0x00..0xFF
880+ updateWindowTitle (MOD_IS_MODIFIED );
881+ return true;
882+ }
888883
889- updateWindowTitle (MOD_IS_MODIFIED );
890- return true;
891- }
884+ // copy command+(effect + 1) from above into current command+effect
885+ if (scancode == SDL_SCANCODE_EQUALS )
886+ {
887+ note -> command = prevNote -> command ;
888+ note -> param = prevNote -> param + 1 ; // wraps 0x00..0xFF
892889
893- // copy command+(effect - 1) from above into current command+effect
894- if (scancode == SDL_SCANCODE_MINUS )
895- {
896- note -> command = prevNote -> command ;
897- note -> param = prevNote -> param - 1 ; // wraps 0x00..0xFF
890+ updateWindowTitle (MOD_IS_MODIFIED );
891+ return true;
892+ }
898893
899- updateWindowTitle (MOD_IS_MODIFIED );
900- return true;
901- }
894+ // copy command+(effect - 1) from above into current command+effect
895+ if (scancode == SDL_SCANCODE_MINUS )
896+ {
897+ note -> command = prevNote -> command ;
898+ note -> param = prevNote -> param - 1 ; // wraps 0x00..0xFF
899+
900+ updateWindowTitle (MOD_IS_MODIFIED );
901+ return true;
902902 }
903903
904904 return false;
@@ -939,12 +939,12 @@ void jamAndPlaceSample(SDL_Scancode scancode, bool normalMode)
939939 chn -> n_volume = s -> volume ;
940940 chn -> n_period = tempPeriod ;
941941 chn -> n_start = & modEntry -> sampleData [s -> offset ];
942- chn -> n_length = (s -> loopStart > 0 ) ? (s -> loopStart + s -> loopLength ) : s -> length ;
942+ chn -> n_length = (s -> loopStart > 0 ) ? (uint32_t )( s -> loopStart + s -> loopLength ) / 2 : s -> length / 2 ;
943943 chn -> n_loopstart = & modEntry -> sampleData [s -> offset + s -> loopStart ];
944- chn -> n_replen = s -> loopLength ;
944+ chn -> n_replen = s -> loopLength / 2 ;
945945
946- if (chn -> n_length < 2 )
947- chn -> n_length = 2 ;
946+ if (chn -> n_length == 0 )
947+ chn -> n_length = 1 ;
948948
949949 paulaSetVolume (ch , chn -> n_volume );
950950 paulaSetPeriod (ch , chn -> n_period );
@@ -995,7 +995,7 @@ void jamAndPlaceSample(SDL_Scancode scancode, bool normalMode)
995995 {
996996 // delete note and sample if illegal note (= -2, -1 = ignore) key was entered
997997
998- if (normalMode || (! normalMode && editor .pNoteFlag == 2 ) )
998+ if (normalMode || editor .pNoteFlag == 2 )
999999 {
10001000 if (!editor .ui .samplerScreenShown && (editor .currMode == MODE_EDIT || editor .currMode == MODE_RECORD ))
10011001 {
0 commit comments