Mercurial > hg > enc-imaf
comparison IM_AF Encoder/IM_AM Encoder/main.c @ 8:c51c0b844461 tip
Ok
author | Eugenio Oñate Hospital <eo301@eecs.qmul.ac.uk> |
---|---|
date | Tue, 28 Aug 2012 12:20:04 +0100 |
parents | 1636a6250528 |
children |
comparison
equal
deleted
inserted
replaced
7:53c7dfb137ac | 8:c51c0b844461 |
---|---|
3 // IM_AM Enco§er | 3 // IM_AM Enco§er |
4 // | 4 // |
5 // Created by eugenio oñate hospital on 14/06/12. | 5 // Created by eugenio oñate hospital on 14/06/12. |
6 // Copyright (c) 2012 QM. All rights reserved. | 6 // Copyright (c) 2012 QM. All rights reserved. |
7 // | 7 // |
8 | 8 //File input/output |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 //Standard library: numeric conversion, memory allocation... | |
10 #include <stdlib.h> | 11 #include <stdlib.h> |
12 //Operations with strings | |
11 #include <string.h> | 13 #include <string.h> |
14 //Get the creation time: clock | |
12 #include <time.h> | 15 #include <time.h> |
13 #include "IM_AF Encoder.h" | 16 #include "IM_AF Encoder.h" |
14 | 17 |
15 /*Prototype*/ | 18 /*Prototype*/ |
16 | 19 |
68 //Media Data Box - Contains the audio | 71 //Media Data Box - Contains the audio |
69 FILE *song; | 72 FILE *song; |
70 char nametrack[20]; | 73 char nametrack[20]; |
71 //Specify the path directory where there are the songs. | 74 //Specify the path directory where there are the songs. |
72 //If change folder, change the path here (3 times) and in readTrack function!!! | 75 //If change folder, change the path here (3 times) and in readTrack function!!! |
73 char pathdir[60] ="/Users/eugin/Desktop/IM_AF Encoder/Rock/"; | 76 char pathdir[60] ="/Users/eugin/Desktop/IM_AF Encoder/Electro/"; |
74 int numtr, ex = 0; | 77 int numtr, ex = 0; |
75 for (numtr=0; numtr<totaltracks; numtr++) { | 78 for (numtr=0; numtr<totaltracks; numtr++) { |
76 | 79 |
77 printf("Name of the track number: %d\n", numtr+1); | 80 printf("Name of the track number: %d\n", numtr+1); |
78 fflush(stdin); | 81 fflush(stdin); |
79 scanf("%s", nametrack); | 82 scanf("%s", nametrack); |
80 strcpy(pathdir, "/Users/eugin/Desktop/IM_AF Encoder/Rock/"); | 83 strcpy(pathdir, "/Users/eugin/Desktop/IM_AF Encoder/Electro/"); |
81 strcat(pathdir, nametrack); | 84 strcat(pathdir, nametrack); |
82 ex = 0; | 85 ex = 0; |
83 //Check if the track exist and then open it. | 86 //Check if the track exist and then open it. |
84 while (ex == 0){ | 87 while (ex == 0){ |
85 song = fopen(pathdir, "rb"); | 88 song = fopen(pathdir, "rb"); |
86 if((song)==NULL) { | 89 if((song)==NULL) { |
87 printf("Name does not exist. Try again:\n"); | 90 printf("Name does not exist. Try again:\n"); |
88 fflush(stdin); | 91 fflush(stdin); |
89 scanf("%s", nametrack); | 92 scanf("%s", nametrack); |
90 strcpy(pathdir, "/Users/eugin/Desktop/IM_AF Encoder/Rock/"); | 93 strcpy(pathdir, "/Users/eugin/Desktop/IM_AF Encoder/Electro/"); |
91 strcat(pathdir, nametrack); | 94 strcat(pathdir, nametrack); |
92 }else{ | 95 }else{ |
93 ex = 1; | 96 ex = 1; |
94 } | 97 } |
95 } | 98 } |
451 FILE *song; | 454 FILE *song; |
452 int d=0, cnt = 0, i=0, j=0, cnt2 = 0, find = 0, swap, num_entr = 0; | 455 int d=0, cnt = 0, i=0, j=0, cnt2 = 0, find = 0, swap, num_entr = 0; |
453 int dat = 0, dat1 = 0, dat2 = 0, dat3 = 0, num_frame = 0, end =0, pos = 0; | 456 int dat = 0, dat1 = 0, dat2 = 0, dat3 = 0, num_frame = 0, end =0, pos = 0; |
454 u32 size[9000]; | 457 u32 size[9000]; |
455 //Change path directory here | 458 //Change path directory here |
456 char pathdir[60] = "/Users/eugin/Desktop/IM_AF Encoder/Rock/"; | 459 char pathdir[60] = "/Users/eugin/Desktop/IM_AF Encoder/Electro/"; |
457 strcat(pathdir, name); | 460 strcat(pathdir, name); |
458 //Open the audio file with the name introduced by the user | 461 //Open the audio file with the name introduced by the user |
459 song = fopen (pathdir,"rb"); | 462 song = fopen (pathdir,"rb"); |
460 if (song == NULL) { | 463 if (song == NULL) { |
461 printf("Error opening input file\n"); | 464 printf("Error opening input file\n"); |