Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITABase
Commits
9f4297e3
Commit
9f4297e3
authored
Nov 29, 2016
by
Dipl.-Ing. Jonas Stienen
Browse files
Implementing load/store for ITASampleFrame and adding test
parent
b4a6022e
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/ITASampleFrame.cpp
View file @
9f4297e3
...
...
@@ -78,6 +78,7 @@ void ITASampleFrame::Load( const std::string& sFilePath )
void
ITASampleFrame
::
Load
(
const
std
::
string
&
sFilePath
,
double
&
dSampleRate
)
{
#ifdef ITABASE_WITH_SNDFILE
ITAAudiofileReader
*
pReader
(
NULL
);
try
{
...
...
@@ -105,15 +106,11 @@ void ITASampleFrame::Load( const std::string& sFilePath, double& dSampleRate )
}
delete
pReader
;
#else
ITA_EXCEPT1
(
NOT_IMPLEMENTED
,
"ITASampleFrame::Store() function not available without libsndfile"
);
#endif
}
void
ITASampleFrame
::
free
()
{
m_vChannels
.
clear
();
m_iChannels
=
0
;
m_iLength
=
0
;
};
void
ITASampleFrame
::
Store
(
const
std
::
string
&
sFilePath
,
double
dSamplingRate
)
const
{
#ifdef ITABASE_WITH_SNDFILE
...
...
@@ -148,6 +145,13 @@ void ITASampleFrame::Store( const std::string& sFilePath, double dSamplingRate )
}
void
ITASampleFrame
::
free
()
{
m_vChannels
.
clear
();
m_iChannels
=
0
;
m_iLength
=
0
;
};
void
ITASampleFrame
::
fill
(
float
fValue
)
{
for
(
ch_it
it
=
m_vChannels
.
begin
();
it
!=
m_vChannels
.
end
();
++
it
)
...
...
tests/CMakeLists.txt
View file @
9f4297e3
...
...
@@ -2,25 +2,34 @@ cmake_minimum_required( VERSION 2.8 )
if
(
NOT ITABASE_COMMON_BUILD
)
project
(
SampleBuffer
Test
)
project
(
ITABase
Test
s
)
list
(
APPEND CMAKE_MODULE_PATH
"$ENV{VISTA_CMAKE_COMMON}"
)
include
(
VistaCommon
)
endif
()
vista_use_package
(
ITABase REQUIRED
)
vista_use_package
(
ITABase REQUIRED
FIND_DEPENDENCIES
)
if
(
WIN32
)
add_definitions
(
-DITA_BASE_DLL
)
endif
(
WIN32
)
if
(
VFOUND_SNDFILE AND ITA_BASE_WITH_SNDFILE
)
add_executable
(
SampleBufferTest SampleBufferTest.cpp
)
target_link_libraries
(
SampleBufferTest
${
VISTA_USE_PACKAGE_LIBRARIES
}
)
add_executable
(
SampleBufferTest SampleBufferTest.cpp
)
target_link_libraries
(
SampleBufferTest
${
VISTA_USE_PACKAGE_LIBRARIES
}
)
vista_configure_app
(
SampleBufferTest
)
vista_install
(
SampleBufferTest
)
vista_create_default_info_file
(
SampleBufferTest
)
vista_configure_app
(
SampleBufferTest
)
vista_install
(
SampleBufferTest
)
vista_create_default_info_file
(
SampleBufferTest
)
set_property
(
TARGET SampleBufferTest PROPERTY FOLDER
"ITATests/ITABase"
)
endif
(
VFOUND_SNDFILE AND ITA_BASE_WITH_SNDFILE
)
set_property
(
TARGET SampleBufferTest PROPERTY FOLDER
"ITACoreLibs/Tests/ITABase"
)
if
(
ITA_BASE_WITH_SNDFILE
)
add_executable
(
SampleFrameTest SampleFrameTest.cpp
)
target_link_libraries
(
SampleFrameTest
${
VISTA_USE_PACKAGE_LIBRARIES
}
)
vista_configure_app
(
SampleFrameTest
)
vista_install
(
SampleFrameTest
)
vista_create_default_info_file
(
SampleFrameTest
)
set_property
(
TARGET SampleFrameTest PROPERTY FOLDER
"ITACoreLibs/Tests/ITABase"
)
endif
(
ITA_BASE_WITH_SNDFILE
)
tests/SampleFrameTest.cpp
0 → 100644
View file @
9f4297e3
#include
<ITAException.h>
#include
<ITAStopWatch.h>
#include
<ITASampleFrame.h>
#include
<iostream>
#include
<assert.h>
using
namespace
std
;
int
main
(
int
argc
,
char
**
argv
)
{
ITASampleFrame
sf
;
double
dSampleRate
;
sf
.
Load
(
"OldDiesel.wav"
,
dSampleRate
);
sf
.
div_scalar
(
2
);
sf
.
Store
(
"OldDiesel_out.wav"
,
dSampleRate
);
// ITA_FLOAT
return
0
;
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment