Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
31e5b3f1
Commit
31e5b3f1
authored
Jun 01, 2022
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add audiowmark test-resample helper for sample rate testing.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
c6a068db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
audiowmark.cc
src/audiowmark.cc
+27
-0
No files found.
src/audiowmark.cc
View file @
31e5b3f1
...
...
@@ -377,6 +377,26 @@ test_change_speed (const string& in_file, const string& out_file, double speed)
return
0
;
}
int
test_resample
(
const
string
&
in_file
,
const
string
&
out_file
,
int
new_rate
)
{
WavData
in_data
;
Error
err
=
in_data
.
load
(
in_file
);
if
(
err
)
{
error
(
"audiowmark: error loading %s: %s
\n
"
,
in_file
.
c_str
(),
err
.
message
());
return
1
;
}
WavData
out_data
=
resample
(
in_data
,
new_rate
);
err
=
out_data
.
save
(
out_file
);
if
(
err
)
{
error
(
"audiowmark: error saving %s: %s
\n
"
,
out_file
.
c_str
(),
err
.
message
());
return
1
;
}
return
0
;
}
int
gen_key
(
const
string
&
outfile
)
{
...
...
@@ -837,6 +857,13 @@ main (int argc, char **argv)
if
(
ap
.
parse_args
(
3
,
args
))
return
test_change_speed
(
args
[
0
],
args
[
1
],
atof
(
args
[
2
].
c_str
()));
}
else
if
(
ap
.
parse_cmd
(
"test-resample"
))
{
parse_shared_options
(
ap
);
args
=
parse_positional
(
ap
,
"input_wav"
,
"output_wav"
,
"new_rate"
);
return
test_resample
(
args
[
0
],
args
[
1
],
atoi
(
args
[
2
].
c_str
()));
}
else
if
(
ap
.
remaining_args
().
size
())
{
string
s
=
ap
.
remaining_args
().
front
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment