Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITADataSources
Commits
5550e942
Commit
5550e942
authored
Nov 22, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Fixing problems with Dirac function generator, but still not really nice.
parent
f7d2a5ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ITAStreamFunctionGenerator.cpp
View file @
5550e942
#include "ITAStreamFunctionGenerator.h"
#include "ITAStreamFunctionGenerator.h"
#include <ITAConstants.h>
#include <ITADataSourceRealization.h>
...
...
@@ -53,8 +53,13 @@ double ITAStreamFunctionGenerator::GetFrequency() const
void
ITAStreamFunctionGenerator
::
SetFrequency
(
double
dFrequency
)
{
assert
(
dFrequency
>=
0
);
m_iPeriodLengthSamples
=
(
int
)
round
(
m_dSampleRate
/
dFrequency
);
if
(
GetFunction
()
==
DIRAC
&&
dFrequency
<=
0.0
f
)
m_iPeriodLengthSamples
=
m_iSampleCount
;
else
{
assert
(
dFrequency
>
0.0
f
);
m_iPeriodLengthSamples
=
(
int
)
round
(
m_dSampleRate
/
dFrequency
);
}
}
int
ITAStreamFunctionGenerator
::
GetPeriodAsSamples
()
const
...
...
@@ -185,16 +190,18 @@ void ITAStreamFunctionGenerator::ProcessStream( const ITAStreamInfo* )
case
DIRAC
:
iNumSamples
=
(
m_bPeriodic
?
(
int
)
m_uiBlocklength
:
(
std
::
min
)(
(
int
)
m_uiBlocklength
,
m_iPeriodLengthSamples
-
m_iSampleCount
)
);
if
(
m_bPeriodic
)
{
for
(
int
i
=
0
;
i
<
iNumSamples
;
i
++
)
pfOutputData
[
i
]
=
(
m_iSampleCount
++
%
N
?
0
:
a
);
for
(
int
i
=
0
;
i
<
iNumSamples
;
i
++
)
pfOutputData
[
i
]
=
(
m_iSampleCount
++
%
N
?
0
:
a
);
}
else
{
else
{
pfOutputData
[
0
]
=
(
m_iSampleCount
==
0
?
a
:
0
);
for
(
int
i
=
1
;
i
<
iNumSamples
;
i
++
)
pfOutputData
[
i
]
=
0
;
m_iSampleCount
+=
iNumSamples
;
for
(
int
i
=
1
;
i
<
GetBlocklength
();
i
++
)
pfOutputData
[
i
]
=
0.0
f
;
m_iSampleCount
+=
GetBlocklength
();
}
break
;
...
...
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