@@ -1904,29 +1904,55 @@ static void updatePtnLen(void)
1904
1904
uint16_t len = pattLens [editor .editPattern ];
1905
1905
1906
1906
song .pattLen = len ;
1907
- editor .pattPos = song .pattPos = CLAMP (song .pattPos , 0 , len - 1 );
1907
+ if (song .pattPos >= len )
1908
+ {
1909
+ song .pattPos = len - 1 ;
1910
+ editor .pattPos = song .pattPos ;
1911
+ }
1908
1912
1909
1913
checkMarkLimits ();
1910
1914
}
1911
1915
1912
1916
void pbEditPattUp (void )
1913
1917
{
1914
- if (editor .editPattern == 255 )
1915
- return ;
1918
+ if (songPlaying )
1919
+ {
1920
+ if (song .pattNr == 255 )
1921
+ return ;
1922
+ }
1923
+ else
1924
+ {
1925
+ if (editor .editPattern == 255 )
1926
+ return ;
1927
+ }
1916
1928
1917
1929
bool audioWasntLocked = !audio .locked ;
1918
1930
if (audioWasntLocked )
1919
1931
lockAudio ();
1920
1932
1921
- if (editor .editPattern < 255 )
1933
+ if (songPlaying )
1934
+ {
1935
+ if (song .pattNr < 255 )
1936
+ {
1937
+ song .pattNr ++ ;
1938
+ updatePtnLen ();
1939
+
1940
+ editor .ui .updatePatternEditor = true;
1941
+ editor .ui .updatePosSections = true;
1942
+ }
1943
+ }
1944
+ else
1922
1945
{
1923
- editor .editPattern ++ ;
1946
+ if (editor .editPattern < 255 )
1947
+ {
1948
+ editor .editPattern ++ ;
1924
1949
1925
- song .pattNr = editor .editPattern ;
1926
- updatePtnLen ();
1950
+ song .pattNr = editor .editPattern ;
1951
+ updatePtnLen ();
1927
1952
1928
- editor .ui .updatePatternEditor = true;
1929
- editor .ui .updatePosSections = true;
1953
+ editor .ui .updatePatternEditor = true;
1954
+ editor .ui .updatePosSections = true;
1955
+ }
1930
1956
}
1931
1957
1932
1958
if (audioWasntLocked )
@@ -1935,22 +1961,44 @@ void pbEditPattUp(void)
1935
1961
1936
1962
void pbEditPattDown (void )
1937
1963
{
1938
- if (editor .editPattern == 0 )
1939
- return ;
1964
+ if (songPlaying )
1965
+ {
1966
+ if (song .pattNr == 0 )
1967
+ return ;
1968
+ }
1969
+ else
1970
+ {
1971
+ if (editor .editPattern == 0 )
1972
+ return ;
1973
+ }
1940
1974
1941
1975
bool audioWasntLocked = !audio .locked ;
1942
1976
if (audioWasntLocked )
1943
1977
lockAudio ();
1944
1978
1945
- if (editor . editPattern > 0 )
1979
+ if (songPlaying )
1946
1980
{
1947
- editor .editPattern -- ;
1981
+ if (song .pattNr > 0 )
1982
+ {
1983
+ song .pattNr -- ;
1984
+ updatePtnLen ();
1948
1985
1949
- song .pattNr = editor .editPattern ;
1950
- updatePtnLen ();
1986
+ editor .ui .updatePatternEditor = true;
1987
+ editor .ui .updatePosSections = true;
1988
+ }
1989
+ }
1990
+ else
1991
+ {
1992
+ if (editor .editPattern > 0 )
1993
+ {
1994
+ editor .editPattern -- ;
1951
1995
1952
- editor .ui .updatePatternEditor = true;
1953
- editor .ui .updatePosSections = true;
1996
+ song .pattNr = editor .editPattern ;
1997
+ updatePtnLen ();
1998
+
1999
+ editor .ui .updatePatternEditor = true;
2000
+ editor .ui .updatePosSections = true;
2001
+ }
1954
2002
}
1955
2003
1956
2004
if (audioWasntLocked )
0 commit comments