add: formatting, cleaning of notes

Signed-off-by: Tobias Reisinger <tobias@msrg.cc>
This commit is contained in:
Tobias Reisinger 2020-03-07 16:22:08 +01:00
parent ed101c6b4f
commit edbb9d45c6
6 changed files with 102 additions and 19 deletions

26
lib/combine_rests.php Normal file
View file

@ -0,0 +1,26 @@
<?php
function combine_rests($unfixed, $unfixed_mod)
{
$fixed = [];
for($i = 0; $i < count($unfixed); $i++)
{
if($unfixed[$i] == "" || $unfixed[$i] == LY_BAR_SEPARATOR)
{
continue;
}
if(modifier_is_rest($unfixed_mod[$i]) && $unfixed[$i] == $unfixed[$i + 1])
{
$note_val = intval(substr($unfixed[$i], strlen(PERCUSSION_REST)));
$fixed[] = PERCUSSION_REST . strval($note_val / 2);
$fixed_mod[] = $unfixed_mod[$i];
$unfixed[$i + 1] = "";
continue;
}
$fixed[] = $unfixed[$i];
$fixed_mod[] = $unfixed_mod[$i];
}
return array($fixed, $fixed_mod);
}
?>