add: shortest note modifier

Signed-off-by: Tobias Reisinger <tobias@msrg.cc>
This commit is contained in:
Tobias Reisinger 2020-03-06 00:28:43 +01:00
parent 9d53b7f498
commit 421bcef330
6 changed files with 59 additions and 14 deletions

View file

@ -1,9 +1,13 @@
<?php
// https://stackoverflow.com/a/600306/9123061
function is_valid_note($x)
function is_valid_note($check_note)
{
return ($x & ($x - 1)) == 0;
if(!intval($check_note))
{
return false;
}
return ($check_note & ($check_note - 1)) == 0;
}
function is_valid_time($check_time)
@ -101,6 +105,11 @@ function validate_get_parameter()
$_GET["bars"] = "2";
}
if(!(isset($_GET["shortest_note"]) && is_valid_note($_GET["shortest_note"])))
{
$_GET["shortest_note"] = "8";
}
if(!(isset($_GET["dynamic_beat"]) && is_valid_dynamic($_GET["dynamic_beat"])))
{
$_GET["dynamic_beat"] = "pp";