forked from harimohanraj89/SoniScan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
181 lines (147 loc) · 5.3 KB
/
main.cpp
File metadata and controls
181 lines (147 loc) · 5.3 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//
// main.cpp
// SoniScan_2_0
//
// Created by Hariharan Mohanraj on 11/30/12.
// Copyright (c) 2012 Hariharan Mohanraj. All rights reserved.
//
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <string>
#include "ControlBlock.h"
#include "SonificationEngine.h"
using namespace std;
int main(void);
int main(void)
{
//================================================================================
// ================================
// FILE AND STRING TESTING GROUNDS
// ================================
float parameterInput;
char charInput[128];
strcpy(charInput,"gen_BB01_perspec");
ControlBlock control;
SonificationEngine engine;
control.SetEngine(&engine);
char dataLine[MAX_SCORELINE_LENGTH];
sprintf(dataLine,TEST_DATA_PATH TEST_DATA_FILENAME_1 ".txt");
control.ReadFile(charInput);
engine.SetInstrBoundary(0.5,0);
engine.SetInstrBoundary(0.75,1);
engine.SetInstrBoundary(0.87,2);
engine.SetInstrBoundary(0.92,3);
engine.SetInstrBoundary(1,4);
// ================================
// BATCH PROCESSOR PARAMETERS
// ================================
char fileBase[50][MAX_SCORELINE_LENGTH];
char batchFileName[MAX_SCORELINE_LENGTH];
ofstream numLog;
strcpy(fileBase[0] , "nor_AA01");
strcpy(fileBase[1] , "nor_BB01");
strcpy(fileBase[2] , "nor_DG01");
strcpy(fileBase[3] , "nor_DG02");
strcpy(fileBase[4] , "nor_KF01");
strcpy(fileBase[5] , "nor_LB01");
strcpy(fileBase[6] , "nor_LF01");
strcpy(fileBase[7] , "nor_RF01");
strcpy(fileBase[8] , "nor_RS01");
strcpy(fileBase[9] , "nor_YA01");
strcpy(fileBase[10], "mil_DO01");
strcpy(fileBase[11], "mil_GO01");
strcpy(fileBase[12], "mil_HG01");
strcpy(fileBase[13], "mil_JA01");
strcpy(fileBase[14], "mil_LS01");
strcpy(fileBase[15], "mil_RB02");
strcpy(fileBase[16], "mil_RD01");
strcpy(fileBase[17], "mil_SF01");
strcpy(fileBase[18], "mod_DK01");
strcpy(fileBase[19], "mod_HC01");
strcpy(fileBase[20], "mod_JN01");
strcpy(fileBase[21], "mod_MG01");
strcpy(fileBase[22], "mod_ND02");
strcpy(fileBase[23], "mod_PM01");
strcpy(fileBase[24], "mod_RB01");
strcpy(fileBase[25], "mod_SG01");
strcpy(fileBase[26], "mod_WS01");
strcpy(fileBase[27], "sev_CN01");
strcpy(fileBase[28], "sev_HB01");
strcpy(fileBase[29], "sev_JC01");
strcpy(fileBase[30], "sev_KD01");
strcpy(fileBase[31], "sev_MA01");
strcpy(fileBase[32], "sev_ND01");
strcpy(fileBase[33], "sev_NR01");
strcpy(fileBase[34], "sev_RC01");
strcpy(fileBase[35], "sev_RJ01");
int numBase = 36;
// ================================
// TESTING GROUNDS
// ================================
// ================================
// USER INTERFACE
// ================================
char userInput;
do
{
// system("clear");
cout << "SONISCAN\n========\n\n";
cout << "Current center freq : " << engine.GetCenterFreq() << "\n";
cout << "Current detune factor : " << engine.GetDetuneFactor() << "\n";
cout << "\n";
for (int i=0; i<NUM_INSTR+1; i++)
{
cout << "Instr boundary " << i+1 << " : " << engine.GetInstrBoundary(i) << "\n";
}
cout << "\n";
cout << "'s' : Set Center Frequency\n";
cout << "'d' : Set Detune Factor\n";
cout << "'p' : Batch Sonify\n";
cout << "'x' : Exit\n\n";
cout << "User input : ";
cin >> userInput;
switch (userInput)
{
case 's' :
cout << "\nEnter center frequency : ";
cin >> parameterInput;
engine.SetCenterFreq(parameterInput);
break;
case 'd' :
cout << "\nEnter detune factor : ";
cin >> parameterInput;
engine.SetDetuneFactor(parameterInput);
break;
case 'p' :
// ================================
// BATCH PROCESSOR
// ================================
numLog.open(OUTPUT_PATH NUMBERS_LOG, std::ios::trunc);
numLog << "Brain, L Frontal, L SMC, L Parietal, R Frontal, R SMC, R Parietal\n";
numLog.close();
for (int baseNum=0; baseNum<numBase; baseNum++) {
strcpy(batchFileName, fileBase[baseNum]);
strcat(batchFileName, "_orthogl");
cout << batchFileName << "\n";
control.ReadFile(batchFileName);
engine.SetSlice(29);
engine.SonifySelect();
strcpy(batchFileName, fileBase[baseNum]);
strcat(batchFileName, "_perspec");
cout << batchFileName << "\n";
control.ReadFile(batchFileName);
engine.SetSlice(0);
engine.SonifySelect();
}
break;
case 'x' :
cout << "\nThank you for using SoniScan.\n";
break;
default :
break;
}
}while (userInput != 'x');
}