Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
ITABase
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
ITABase
Commits
7a645a95
Commit
7a645a95
authored
Sep 12, 2018
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving from named enums to double namespaces
parent
16030b61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
28 deletions
+36
-28
include/ITABaseDefinitions.h
include/ITABaseDefinitions.h
+29
-23
src/ITAFade.cpp
src/ITAFade.cpp
+6
-4
src/ITASampleBuffer.cpp
src/ITASampleBuffer.cpp
+1
-1
No files found.
include/ITABaseDefinitions.h
View file @
7a645a95
...
...
@@ -31,44 +31,50 @@
namespace
ITABase
{
enum
MixingMethod
namespace
MixingMethod
{
OVERWRITE
=
0
,
//!< Overwrites the target buffer with new samples
ADD
=
1
,
//!< Adds (mixes) the new samples to the target buffer
};
enum
SwitchingMethod
{
};
enum
{
OVERWRITE
=
0
,
//!< Overwrites the target buffer with new samples
ADD
=
1
,
//!< Adds (mixes) the new samples to the target buffer
};
}
//! berblendfunktionen
enum
FadingFunction
namespace
FadingFunction
{
LINEAR
=
0
,
//!< Lineare berblendung aka. Rampe
COSINE_SQUARE
=
1
,
//!< Cosinus-Quadrat berblendung (aka Hanning-Fenster)
};
enum
{
SWITCH
=
-
1
,
LINEAR
=
0
,
//!< Lineare berblendung aka. Rampe
COSINE_SQUARE
,
//!< Cosinus-Quadrat berblendung (aka Hanning-Fenster)
};
}
//! Fading sign
/**
* Direction how to fade, i.e. in or out
*/
enum
FadingSign
namespace
FadingSign
{
IN
=
0
,
//!< Fade in
OUT
=
1
,
//!< Fade out
};
enum
{
FADE_IN
=
0
,
//!< Fade in
FADE_OUT
,
//!< Fade out
};
}
//! Crossfade direction
/**
* Fading direction from source or to source
*/
enum
CrossfadeDirection
namespace
CrossfadeDirection
{
TO_SOURCE
=
0
,
//!< Crossfade to the source signal
OFF_SOURCE
=
1
,
//!< Crossfade off source signal
};
enum
{
TO_SOURCE
=
0
,
//!< Crossfade to the source signal
FROM_SOURCE
,
//!< Crossfade off source signal
};
}
}
#endif // INCLUDE_WATCHER_ITA_BASE_DEFINITIONS
src/ITAFade.cpp
View file @
7a645a95
...
...
@@ -17,11 +17,12 @@ void Fade( float* pfData, int iFadeLength, int iFadingSign, int iFadeFunction, i
float
alpha
;
switch
(
iFadeFunction
)
{
switch
(
iFadeFunction
)
{
case
ITABase
::
FadingFunction
::
LINEAR
:
{
alpha
=
1
/
(
float
)
iFadeLength
;
if
(
iFadingSign
==
ITABase
::
FadingSign
::
IN
)
if
(
iFadingSign
==
ITABase
::
FadingSign
::
FADE_
IN
)
{
// Einblenden
for
(
int
i
=
0
;
i
<
iLength
;
i
++
)
...
...
@@ -54,7 +55,7 @@ void Fade( float* pfData, int iFadeLength, int iFadingSign, int iFadeFunction, i
{
alpha
=
ITAConstants
::
HALF_PI_F
/
(
float
)
iFadeLength
;
if
(
iFadingSign
==
ITABase
::
FadingSign
::
IN
)
if
(
iFadingSign
==
ITABase
::
FadingSign
::
FADE_
IN
)
for
(
int
i
=
0
;
i
<
iLength
;
i
++
)
{
// Saubere Werte vor bzw. hinter der Blendphase
...
...
@@ -116,7 +117,8 @@ void Crossfade( const float* pfSrc1, const float* pfSrc2, float* pfDest, int iFa
{
alpha
=
ITAConstants
::
HALF_PI_F
/
(
float
)
iFadeLength
;
for
(
int
i
=
0
;
i
<
iFadeLength
;
i
++
)
{
for
(
int
i
=
0
;
i
<
iFadeLength
;
i
++
)
{
float
c
=
cos
(
alpha
*
(
float
)
i
);
float
csq
=
(
float
)
(
c
*
c
);
pfDest
[
i
]
=
csq
*
pfSrc1
[
i
]
+
(
1
-
csq
)
*
pfSrc2
[
i
];
...
...
src/ITASampleBuffer.cpp
View file @
7a645a95
...
...
@@ -161,7 +161,7 @@ void ITASampleBuffer::Crossfade( const ITASampleBuffer* psbSrc, int iOffset, int
switch
(
iCrossfadeDirection
)
{
case
ITABase
::
CrossfadeDirection
::
OFF
_SOURCE
:
case
ITABase
::
CrossfadeDirection
::
FROM
_SOURCE
:
{
// Samples am Anfang kopieren
for
(
int
i
=
0
;
i
<
iOffset
;
i
++
)
...
...
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