mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
Userland: Add --loop option for aplay
A tiny feature, useful when listening to your favorite song.
This commit is contained in:
parent
3039c36836
commit
7b481a2c73
1 changed files with 4 additions and 0 deletions
|
@ -34,9 +34,11 @@
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
const char* path = nullptr;
|
const char* path = nullptr;
|
||||||
|
bool should_loop = false;
|
||||||
|
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.add_positional_argument(path, "Path to WAV file", "path");
|
args_parser.add_positional_argument(path, "Path to WAV file", "path");
|
||||||
|
args_parser.add_option(should_loop, "Loop playback", "loop", 'l');
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(argc, argv);
|
||||||
|
|
||||||
Core::EventLoop loop;
|
Core::EventLoop loop;
|
||||||
|
@ -62,6 +64,8 @@ int main(int argc, char** argv)
|
||||||
printf("%d/%d", loader.loaded_samples(), loader.total_samples());
|
printf("%d/%d", loader.loaded_samples(), loader.total_samples());
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
audio_client->enqueue(*samples);
|
audio_client->enqueue(*samples);
|
||||||
|
} else if (should_loop) {
|
||||||
|
loader.reset();
|
||||||
} else if (audio_client->get_remaining_samples()) {
|
} else if (audio_client->get_remaining_samples()) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue