-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cmdline options to example, wav writing
- Loading branch information
Showing
5 changed files
with
143 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/target | ||
*.iml | ||
.idea | ||
*.wav | ||
|
||
# Added by cargo | ||
# | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
[package] | ||
name = "play_tune" | ||
version = "0.1.2" | ||
version = "0.2.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
"opl3-rs" = { path = "../.." } | ||
"rodio" = "0.18" | ||
"rodio" = "0.19" | ||
"chrono" = "0.4" | ||
"timer" = "0.2" | ||
"crossbeam-channel" = "0.5" | ||
"hound" = "3.1" | ||
"hound" = "3.5" | ||
"bpaf" = { version = "0.9", features = ["autocomplete"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This
.switch()
makes a parser that returnstrue
if-t
or--test_note
is present orfalse
otherwise..fallback(false)
makes it so if parser fails with "missing value" type of error - it returns specified value, here -false
. Problem is.switch()
never fails in this way. You can safely drop this method without changing the behavior for thetest_note
field..optional()
does something similar to.fallback(foo)
, but instead of replacing the result with what you specified - it makes parser that returnsNone
if value is absent andSome(val)
- if it is present. Asfallback
it relies on parser failing with "value not present" type of error - this never happens forswitch()
but even if you had some other parser -fallback
by itself handles this error. I'd drop.optional()
part and change the field totest_note: bool
- should make consuming it a bit easier.So overall I'd have something like this:
Same goes for
output_wav
.