Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HighBlueParsers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Best
HighBlueParsers
Commits
2ac967ff
Commit
2ac967ff
authored
2 years ago
by
ferrari
Browse files
Options
Downloads
Patches
Plain Diff
Fix total length option
parent
c1bee851
No related branches found
No related tags found
2 merge requests
!2
HighBlueParser dev branch merged to empty main branch
,
!1
High blue rec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.cpp
+3
-2
3 additions, 2 deletions
src/main.cpp
with
3 additions
and
2 deletions
src/main.cpp
+
3
−
2
View file @
2ac967ff
...
...
@@ -66,6 +66,7 @@ int record(size_t channels, size_t rate, size_t depth, size_t filter, std::stri
size_t
total_samples_wanted
=
totallen
*
rate
;
size_t
total_samples_read
=
0
;
size_t
failed_attempts
=
0
;
size_t
sample_size
=
channels
*
depth
;
std
::
vector
<
std
::
uint8_t
>
samples
;
try
{
std
::
cout
<<
"Setting recording format to "
<<
channels
<<
" channels at "
<<
rate
<<
" Hz "
<<
(
1
<<
(
2
+
depth
))
<<
" bits"
<<
std
::
endl
;
...
...
@@ -78,10 +79,10 @@ int record(size_t channels, size_t rate, size_t depth, size_t filter, std::stri
}
recorder
.
get_samples
(
samples
,
false
,
500
);
if
(
samples
.
size
()
>
0
)
{
total_samples_read
+=
samples
.
size
()
/
channels
;
total_samples_read
+=
samples
.
size
()
/
sample_size
;
// if we have too much now, crop the last packet
if
((
total_samples_wanted
>
0
)
&&
(
total_samples_read
>
total_samples_wanted
))
{
samples
.
resize
(
samples
.
size
()
-
(
total_samples_read
-
total_samples_wanted
)
*
channels
);
samples
.
resize
(
samples
.
size
()
-
(
total_samples_read
-
total_samples_wanted
)
*
sample_size
);
}
// pass it on to the file writer
filewriter
->
write
(
samples
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment