51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
function fix_notation($unfixed, $unfixed_mod)
|
|
{
|
|
$fixed = [];
|
|
$fixed_mod = [];
|
|
for($i = 0; $i < count($unfixed); $i++)
|
|
{
|
|
if(is_string($unfixed[$i]) && $unfixed[$i] == LY_BAR_SEPARATOR)
|
|
{
|
|
$fixed[] = LY_BAR_SEPARATOR;
|
|
$fixed_mod[] = $unfixed_mod[$i];
|
|
continue;
|
|
}
|
|
if($unfixed[$i] == 0)
|
|
{
|
|
continue;
|
|
}
|
|
if(modifier_is_rest($unfixed_mod[$i]))
|
|
{
|
|
$fixed[] = PERCUSSION_REST . strval($unfixed[$i]);
|
|
$fixed_mod[] = $unfixed_mod[$i];
|
|
continue;
|
|
}
|
|
if(
|
|
($unfixed[$i + 1] != BAR_SEPARATOR) &&
|
|
modifier_is_rest($unfixed_mod[$i + 1])
|
|
)
|
|
{
|
|
if($unfixed[$i] * 2 == $unfixed[$i + 1])
|
|
{
|
|
$fixed[] = PERCUSSION_CLAP . strval($unfixed[$i]) . LY_DOT;
|
|
$fixed_mod[] = $unfixed_mod[$i];
|
|
$unfixed[$i + 1] = 0;
|
|
continue;
|
|
}
|
|
if($unfixed[$i] == $unfixed[$i + 1])
|
|
{
|
|
$fixed[] = PERCUSSION_CLAP . strval($unfixed[$i] / 2);
|
|
$fixed_mod[] = $unfixed_mod[$i];
|
|
$unfixed[$i + 1] = 0;;
|
|
continue;
|
|
}
|
|
}
|
|
$fixed[] = PERCUSSION_CLAP . strval($unfixed[$i]);
|
|
$fixed_mod[] = $unfixed_mod[$i];
|
|
}
|
|
return array($fixed, $fixed_mod);
|
|
}
|
|
|
|
?>
|