Added check for libsndfile library to cmake
This commit is contained in:
@@ -3,9 +3,12 @@ set(CMAKE_CXX_STANDARD 11)
|
|||||||
# Set the project name
|
# Set the project name
|
||||||
project (concatenator)
|
project (concatenator)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
### Boost Settings
|
### Boost Settings
|
||||||
find_package(Boost 1.60.0 COMPONENTS program_options log log_setup thread date_time filesystem system REQUIRED)
|
find_package(Boost 1.60.0 COMPONENTS program_options log log_setup thread date_time filesystem system REQUIRED)
|
||||||
|
find_package(LibSndFile REQUIRED)
|
||||||
|
|
||||||
if (NOT FO_BOOST_STATIC_LINK)
|
if (NOT FO_BOOST_STATIC_LINK)
|
||||||
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK -DBOOST_LOG_DYN_LINK)
|
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK -DBOOST_LOG_DYN_LINK)
|
||||||
@@ -48,6 +51,7 @@ set(CONCATENATOR_TEST_SOURCES
|
|||||||
|
|
||||||
include_directories(${CONCATENATOR_INCLUDE_DIR})
|
include_directories(${CONCATENATOR_INCLUDE_DIR})
|
||||||
include_directories(${Boost_INCLUDE_DIRS})
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
|
include_directories(${LIBSNDFILE_INCLUDE_DIR})
|
||||||
add_subdirectory(external)
|
add_subdirectory(external)
|
||||||
|
|
||||||
add_executable(concatenator ${CONCATENATOR_SOURCE_FILES} ${CONCATENATOR_HEADER_FILES})
|
add_executable(concatenator ${CONCATENATOR_SOURCE_FILES} ${CONCATENATOR_HEADER_FILES})
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# - Try to find libsndfile
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# LIBSNDFILE_FOUND - system has libsndfile
|
||||||
|
# LIBSNDFILE_INCLUDE_DIRS - the libsndfile include directories
|
||||||
|
# LIBSNDFILE_LIBRARIES - link these to use libsndfile
|
||||||
|
|
||||||
|
# Use pkg-config to get hints about paths
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(LIBSNDFILE_PKGCONF sndfile)
|
||||||
|
endif(PKG_CONFIG_FOUND)
|
||||||
|
|
||||||
|
# Include dir
|
||||||
|
find_path(LIBSNDFILE_INCLUDE_DIR
|
||||||
|
NAMES sndfile.h
|
||||||
|
PATHS ${LIBSNDFILE_PKGCONF_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Library
|
||||||
|
find_library(LIBSNDFILE_LIBRARY
|
||||||
|
NAMES sndfile libsndfile-1
|
||||||
|
PATHS ${LIBSNDFILE_PKGCONF_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(PackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(LibSndFile DEFAULT_MSG LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(LIBSNDFILE_FOUND)
|
||||||
|
set(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY})
|
||||||
|
set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR})
|
||||||
|
endif(LIBSNDFILE_FOUND)
|
||||||
|
|
||||||
|
mark_as_advanced(LIBSNDFILE_LIBRARY LIBSNDFILE_LIBRARIES LIBSNDFILE_INCLUDE_DIR LIBSNDFILE_INCLUDE_DIRS)
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#include <string>
|
||||||
|
#include <sndfile.hh>
|
||||||
|
|
||||||
|
class AudioFile {
|
||||||
|
public:
|
||||||
|
AudioFile(const char * fname, bool open=true);
|
||||||
|
AudioFile(const char * fname, int format, int channels, int samplerate);
|
||||||
|
~AudioFile();
|
||||||
|
void swap_mode(std::string m);
|
||||||
|
bool is_open() { return open; };
|
||||||
|
private:
|
||||||
|
std::string mode;
|
||||||
|
std::string name;
|
||||||
|
bool open;
|
||||||
|
SndfileHandle file;
|
||||||
|
};
|
||||||
|
|
||||||
|
class AnalysedAudioFile : public AudioFile {
|
||||||
|
public:
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|||||||
+20
-10
@@ -1,12 +1,22 @@
|
|||||||
#include <sndfile.hh>
|
#include "AudioFile.h"
|
||||||
|
#include <string>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
class AudioFile {
|
AudioFile::AudioFile(const char * fname, bool open)
|
||||||
public:
|
{
|
||||||
private:
|
if(open) {
|
||||||
SndfileHandle file;
|
file = SndfileHandle(fname);
|
||||||
};
|
}
|
||||||
|
name = fname;
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioFile::AudioFile(const char * fname, const int format, const int channels, const int samplerate)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioFile::swap_mode(string m)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
class AnalysedAudioFile : public AudioFile {
|
|
||||||
public:
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user