-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_wav.cpp
More file actions
60 lines (54 loc) · 1.15 KB
/
Copy pathtest_wav.cpp
File metadata and controls
60 lines (54 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/***
* Filename: test_wav.cpp
*
* Description: Test the header file.
*
* Version: 0.0.1
* Created: 2017-11-25
* Revision: none
*
* Author: Dilawar Singh <dilawars@ncbs.res.in>
* Organization: NCBS Bangalore
*
* License: GNU GPL2
*/
#include "WAVReader.h"
#include <fstream>
#include <cassert>
using namespace std;
int main(int argn, const char *argv[])
{
WAVE wav;
bool toFile = false;
if( argn > 1 )
wav.parse( argv[1] );
else
wav.parse( "./kalia.wav" );
std::streambuf * buf;
std::ostream* fp;
ofstream outF;
if( argn > 2 )
{
outF.open( argv[2], std::ofstream::out );
toFile = true;
}
auto channelData = wav.getData( );
for( auto v : channelData )
{
if( toFile )
{
outF << v.first << ' ';
for( auto vv : v.second )
outF << vv << ' ';
outF << '\n';
}
else
{
cout << v.first << ' ';
for( auto vv : v.second )
cout << vv << ' ';
cout << '\n';
}
}
return 0;
}