54 CHECKNULL(fp = fopen(filename,
"r"));
56 leidos += fscanf(fp,
"%d\n", &Param->
N_BASES);
57 leidos += fscanf(fp,
"%d\n", &Param->
N_STATES);
60 leidos += fscanf(fp,
"%f\n", &Param->
NoteLen);
61 leidos += fscanf(fp,
"%f\n", &Param->
ALPHA);
63 leidos += fscanf(fp,
"%lf\n", &Param->
NoteLen);
64 leidos += fscanf(fp,
"%lf\n", &Param->
ALPHA);
71 NameFiles->
file_kmax =(
char *)malloc(1024);
72 NameFiles->
file_kmin =(
char *)malloc(1024);
79 leidos += fscanf(fp,
"%s\n", NameFiles->
file_frame);
81 leidos += fscanf(fp,
"%s\n", NameFiles->
file_kmax);
82 leidos += fscanf(fp,
"%s\n", NameFiles->
file_kmin);
88 leidos += fscanf(fp,
"%d\n", &Param->
WAVorMIC);
89 leidos += fscanf(fp,
"%s\n", Param->
SoundID);
90 leidos += fscanf(fp,
"%d\n", &Param->
Time_MIC);
92 leidos += fscanf(fp,
"%d\n", &Param->
NCliOSC);
93 if (Param->
NCliOSC > MaxOSC)
return ErrInfoReaded;
95 for (i=0; i<Param->
NCliOSC; i++)
97 leidos += fscanf(fp,
"%s\n", Param->
HostIP[i]);
98 leidos += fscanf(fp,
"%s\n", Param->
HostPort[i]);
103 printf(
"Number of Bases: %d\n", Param->
N_BASES);
104 printf(
"Number of States: %d\n", Param->
N_STATES);
105 printf(
"Note durarion (sec.): %f\n", Param->
NoteLen);
106 printf(
"ALPHA: %f\n", Param->
ALPHA);
109 printf(
"Wav File: %s. USED\n", NameFiles->
file_frame);
111 printf(
"Wav File: %s. NOT USED\n", NameFiles->
file_frame);
113 printf(
"KMAX File: %s\n", NameFiles->
file_kmax);
114 printf(
"KMIN File: %s\n", NameFiles->
file_kmin);
121 printf(
"Used sound device ID: %s\n", Param->
SoundID);
122 printf(
"Used sound MIDI time: %d\n", Param->
Time_MIC);
124 printf(
"%d OSC clients are used. They are:\n", Param->
NCliOSC);
125 for (i=0; i<Param->
NCliOSC; i++)
127 printf(
"Host IP: %s\n", Param->
HostIP[i]);
128 printf(
"Host Port: %s\n", Param->
HostPort[i]);
132 if (leidos != (17 + (Param->
NCliOSC*2)))
return ErrInfoReaded;
else return OK;
144 int ReadVector(MyType *vector,
const int size,
const char *filename)
148 CHECKNULL(fp = fopen(filename,
"rb"));
149 if (fread(vector,
sizeof(MyType), size, fp) != size)
150 { fclose(fp);
return ErrReadFile; }
152 { fclose(fp);
return OK; }
188 int contLineas, leidos;
192 long long int valorLong;
193 int nbytes=
sizeof(
long long int);
196 int nbytes=
sizeof(
long int);
199 CHECKNULL(fp=fopen(filename,
"rb"));
203 leidos=fread(&valorLong, nbytes, 1, fp);
204 if (leidos != 1) { fclose(fp);
return ErrReadFile; }
208 if (contLineas < size) vector[contLineas]=(int)valorLong;
211 leidos=fread(&valorLong, nbytes, 1, fp);
212 if ((leidos != 1) && (!feof(fp))) { fclose(fp);
return ErrReadFile; }
215 if (contLineas != size)
return ErrInfoReaded;
else return OK;
228 int ReadS_fk(MyType *s_fk,
const int BASES,
const char *filename)
232 long size = N_MIDI_PAD*BASES;
237 CHECKNULL(fp=fopen(filename,
"rb"));
240 k=fread(&data,
sizeof(MyType), 1, fp);
241 if (k != 1) { fclose(fp);
return ErrReadFile; }
248 if ((i%N_MIDI_PAD)< (N_MIDI-1))
251 i += (N_MIDI_PAD-N_MIDI+1);
254 k=fread(&data,
sizeof(MyType), 1, fp);
255 if ((k != 1) && (!feof(fp))) { fclose(fp);
return ErrReadFile; }
258 if (i != size)
return ErrInfoReaded;
else return OK;
Struct for store the name of input/verificaton files. Each composition needs a file with values for ...
Header file with auxiliar functions using by ReMAS, both CPU and GPU.
int ReadVectorInt64(int *vector, const int size, const char *filename)
ReadVectorInt64 fills a int vector with the int64 info stores in a file.
void FreeFiles(DTWfiles *NameFiles)
FreeFiles frees the reserved memory of a struct.
int ReadVector(MyType *vector, const int size, const char *filename)
ReadVector fills a MyType vector with the MyType info stores in a file.
int ReadS_fk(MyType *s_fk, const int BASES, const char *filename)
ReadS_fk fills the vector s_fk with the info stores in a file.
int ReadParameters(DTWconst *Param, DTWfiles *NameFiles, const char *filename)
ReadParameters reads ReMAS global parameters from file.
Struct for store global information of the problem. Each composition needs a file with values for th...