Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
c57e07e1
Commit
c57e07e1
authored
4 years ago
by
Raphael Grimm
Browse files
Options
Downloads
Patches
Plain Diff
Add frequency to spectogram
parent
48f8e98d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SimoxQtUtility/qwt/SimoxQwtSpectrogramData.cpp
+15
-5
15 additions, 5 deletions
SimoxQtUtility/qwt/SimoxQwtSpectrogramData.cpp
SimoxQtUtility/qwt/SimoxQwtSpectrogramData.h
+4
-1
4 additions, 1 deletion
SimoxQtUtility/qwt/SimoxQwtSpectrogramData.h
with
19 additions
and
6 deletions
SimoxQtUtility/qwt/SimoxQwtSpectrogramData.cpp
+
15
−
5
View file @
c57e07e1
...
...
@@ -2,18 +2,20 @@
namespace
simox
::
qt
{
SimoxQwtSpectrogramData
::
SimoxQwtSpectrogramData
(
std
::
size_t
iterations
,
std
::
size_t
max_fft_width
)
:
_iterations
{
iterations
}
SimoxQwtSpectrogramData
::
SimoxQwtSpectrogramData
(
std
::
size_t
iterations
,
std
::
size_t
bucket_count
,
float
frequency
)
{
set
Interval
(
Qt
::
XAxis
,
QwtInterval
(
0
,
iterations
)
);
setI
n
ter
val
(
Qt
::
YAxis
,
QwtInterval
(
0
,
max_fft_width
)
);
set
Frequency
(
frequency
,
bucket_count
);
setIter
ations
(
iterations
);
setInterval
(
Qt
::
ZAxis
,
QwtInterval
(
0.0
,
10.0
));
}
double
SimoxQwtSpectrogramData
::
value
(
double
fx
,
double
fy
)
const
{
const
std
::
size_t
x
=
fx
;
const
std
::
size_t
y
=
fy
;
const
std
::
size_t
y
=
fy
/
_bucket_height
;
if
(
x
>=
_vals
.
size
())
{
return
0
;
...
...
@@ -65,5 +67,13 @@ namespace simox::qt
void
SimoxQwtSpectrogramData
::
setIterations
(
std
::
size_t
iterations
)
{
_iterations
=
iterations
;
setInterval
(
Qt
::
XAxis
,
QwtInterval
(
0
,
iterations
));
}
void
SimoxQwtSpectrogramData
::
setFrequency
(
float
freq
,
std
::
size_t
bucket_count
)
{
_bucket_height
=
freq
/
2
/
bucket_count
;
_bucket_count
=
bucket_count
;
setInterval
(
Qt
::
YAxis
,
QwtInterval
(
0
,
freq
/
2
));
}
}
This diff is collapsed.
Click to expand it.
SimoxQtUtility/qwt/SimoxQwtSpectrogramData.h
+
4
−
1
View file @
c57e07e1
...
...
@@ -11,7 +11,7 @@ namespace simox::qt
class
SimoxQwtSpectrogramData
:
public
QwtRasterData
{
public:
SimoxQwtSpectrogramData
(
std
::
size_t
iterations
,
std
::
size_t
max_fft_width
);
SimoxQwtSpectrogramData
(
std
::
size_t
iterations
,
std
::
size_t
max_fft_width
,
float
frequency
);
virtual
double
value
(
double
fx
,
double
fy
)
const
;
...
...
@@ -20,8 +20,11 @@ namespace simox::qt
const
std
::
vector
<
float
>&
update
(
std
::
vector
<
float
>
v
);
std
::
size_t
iterations
()
const
;
void
setIterations
(
std
::
size_t
iterations
);
void
setFrequency
(
float
freq
,
std
::
size_t
bucket_count
);
private:
std
::
deque
<
std
::
vector
<
float
>>
_vals
;
std
::
size_t
_iterations
;
float
_bucket_height
;
std
::
size_t
_bucket_count
;
};
}
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