Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
portapack-mayhem
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
mcules
portapack-mayhem
Commits
1fc9a1c6
Unverified
Commit
1fc9a1c6
authored
4 years ago
by
Erwin Ried
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #120 from eried/WAV-viewer-bug-when-wav-file-format-is-wrong
Update ui_view_wav.cpp
parents
4b02a1c4
b49ad91d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
firmware/application/apps/ui_view_wav.cpp
+9
-11
9 additions, 11 deletions
firmware/application/apps/ui_view_wav.cpp
with
9 additions
and
11 deletions
firmware/application/apps/ui_view_wav.cpp
+
9
−
11
View file @
1fc9a1c6
...
@@ -81,15 +81,6 @@ void ViewWavView::load_wav(std::filesystem::path file_path) {
...
@@ -81,15 +81,6 @@ void ViewWavView::load_wav(std::filesystem::path file_path) {
int16_t
sample
;
int16_t
sample
;
uint32_t
average
;
uint32_t
average
;
if
(
!
wav_reader
->
open
(
file_path
))
{
nav_
.
display_modal
(
"Error"
,
"Couldn't open file."
,
INFO
,
nullptr
);
return
;
}
if
((
wav_reader
->
channels
()
!=
1
)
||
(
wav_reader
->
bits_per_sample
()
!=
16
))
{
nav_
.
display_modal
(
"Error"
,
"Wrong format.
\n
Wav viewer only accepts
\n
16-bit mono files."
,
INFO
,
nullptr
);
return
;
}
text_filename
.
set
(
file_path
.
filename
().
string
());
text_filename
.
set
(
file_path
.
filename
().
string
());
auto
ms_duration
=
wav_reader
->
ms_duration
();
auto
ms_duration
=
wav_reader
->
ms_duration
();
...
@@ -148,10 +139,18 @@ ViewWavView::ViewWavView(
...
@@ -148,10 +139,18 @@ ViewWavView::ViewWavView(
&
field_cursor_b
,
&
field_cursor_b
,
&
text_delta
&
text_delta
});
});
reset_controls
();
button_open
.
on_select
=
[
this
,
&
nav
](
Button
&
)
{
button_open
.
on_select
=
[
this
,
&
nav
](
Button
&
)
{
auto
open_view
=
nav
.
push
<
FileLoadView
>
(
".WAV"
);
auto
open_view
=
nav
.
push
<
FileLoadView
>
(
".WAV"
);
open_view
->
on_changed
=
[
this
](
std
::
filesystem
::
path
file_path
)
{
open_view
->
on_changed
=
[
this
](
std
::
filesystem
::
path
file_path
)
{
if
(
!
wav_reader
->
open
(
file_path
))
{
nav_
.
display_modal
(
"Error"
,
"Couldn't open file."
,
INFO
,
nullptr
);
return
;
}
if
((
wav_reader
->
channels
()
!=
1
)
||
(
wav_reader
->
bits_per_sample
()
!=
16
))
{
nav_
.
display_modal
(
"Error"
,
"Wrong format.
\n
Wav viewer only accepts
\n
16-bit mono files."
,
INFO
,
nullptr
);
return
;
}
load_wav
(
file_path
);
load_wav
(
file_path
);
field_pos_seconds
.
focus
();
field_pos_seconds
.
focus
();
};
};
...
@@ -176,7 +175,6 @@ ViewWavView::ViewWavView(
...
@@ -176,7 +175,6 @@ ViewWavView::ViewWavView(
refresh_measurements
();
refresh_measurements
();
};
};
reset_controls
();
}
}
void
ViewWavView
::
focus
()
{
void
ViewWavView
::
focus
()
{
...
...
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