Signal/Geometry Processing Library (SPL)  1.1.24
audioFile.hpp
Go to the documentation of this file.
1 // Copyright (c) 2011 Michael D. Adams
2 // All rights reserved.
3 
4 // __START_OF_LICENSE__
5 //
6 // Copyright (c) 2015 Michael D. Adams
7 // All rights reserved.
8 //
9 // This file is part of the Signal Processing Library (SPL).
10 //
11 // This program is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU General Public License as
13 // published by the Free Software Foundation; either version 3,
14 // or (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public
22 // License along with this program; see the file LICENSE. If not,
23 // see <http://www.gnu.org/licenses/>.
24 //
25 // __END_OF_LICENSE__
26 
33 #ifndef SPL_audioFile_hpp
34 #define SPL_audioFile_hpp
35 
37 // Header Files.
39 
40 #include <SPL/config.hpp>
41 #include <iostream>
42 #include <string>
43 #include <algorithm>
44 #if defined(SPL_HAVE_LIBSNDFILE)
45 #include <sndfile.h>
46 #endif
47 #include <SPL/Array1.hpp>
48 
49 namespace SPL {
50 
56 // Functions for Loading/Saving Audio Files.
59 
76 int loadAudioFile(const std::string& fileName, int& samplingRate,
77  RealArray1& samples);
78 
92 int saveAudioFile(const std::string& fileName, int samplingRate,
93  const RealArray1& samples);
94 
97 
102 }
103 
104 #endif
Definition: Arcball.hpp:48
Array1< double > RealArray1
A one-dimensional array with real elements.
Definition: Array1.hpp:1023
int loadAudioFile(const std::string &fileName, int &samplingRate, RealArray1 &samples)
Read audio data from a file in WAV format.
Definition: audioFile.cpp:159
This file contains the Array1 template class and supporting code.
int saveAudioFile(const std::string &fileName, int samplingRate, const RealArray1 &samples)
Write a sequence to a file in WAV format.
Definition: audioFile.cpp:165