rhythm/lib/combine_rests.php

27 lines
704 B
PHP
Raw Permalink Normal View History

<?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);
}
?>