bytebeat_compiler.py: support fractional seconds
This commit is contained in:
parent
a4de44f08c
commit
d448357608
@ -4,6 +4,8 @@ if __name__ == "__main__":
|
||||
print(":: C bytebeat generator: compiler unit")
|
||||
|
||||
from argparse import ArgumentParser
|
||||
from decimal import Decimal
|
||||
from math import ceil
|
||||
from os import getcwd, environ, makedirs, name as os_name, rename
|
||||
from os.path import exists, join as path_join
|
||||
from shlex import join as command_line_join, split as command_line_split
|
||||
@ -187,7 +189,7 @@ if __name__ == "__main__":
|
||||
action="store_true", help="use floating point as the return type")
|
||||
parser.add_argument("-c", "--channels", default=None, type=int,
|
||||
help="amount of channels")
|
||||
parser.add_argument("-t", "--seconds", default=None, type=int,
|
||||
parser.add_argument("-t", "--seconds", default=None, type=Decimal,
|
||||
help="length in seconds (samples = sample rate * seconds) : "
|
||||
"default = 30 seconds")
|
||||
parser.add_argument("-l", "--samples", default=None, type=int,
|
||||
@ -308,6 +310,9 @@ if __name__ == "__main__":
|
||||
if samples <= 0:
|
||||
raise SystemExit("CLI: Count of samples should be greater than zero.")
|
||||
|
||||
# round the number of samples
|
||||
samples = ceil(samples)
|
||||
|
||||
if args.mode != "sequential" and args.mode != "instant":
|
||||
raise SystemExit(f"Invalid mode '{args.mode}'")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user