diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index 77e95e1..466efa0 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,10 @@ cmake_minimum_required(VERSION 2.8) -project(SimpleDenoise LANGUAGES C) +project(sadenoise LANGUAGES C) set(CMAKE_POSITION_INDEPENDENT_CODE ON) SET(CMAKE_BUILD_TYPE "Release") -include_directories(include) -add_executable(${PROJECT_NAME} main.c) +include_directories(src) -target_link_libraries(${PROJECT_NAME} -lm) \ No newline at end of file +add_executable(${PROJECT_NAME} src/main.c) + +target_link_libraries(${PROJECT_NAME} -lm) diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/sample.wav b/sample.wav old mode 100755 new mode 100644 diff --git a/dr_mp3.h b/src/dr_mp3.h old mode 100755 new mode 100644 similarity index 100% rename from dr_mp3.h rename to src/dr_mp3.h diff --git a/dr_wav.h b/src/dr_wav.h old mode 100755 new mode 100644 similarity index 100% rename from dr_wav.h rename to src/dr_wav.h diff --git a/main.c b/src/main.c old mode 100755 new mode 100644 similarity index 95% rename from main.c rename to src/main.c index 49ef03e..65226b3 --- a/main.c +++ b/src/main.c @@ -265,22 +265,21 @@ int SimpleDenoise_Proc(SimpleDenoiseHandle *handle, const float *input, float *o return 1; } -void printUsage() +void printUsage(char *pname) { printf("usage:\n"); - printf("./SimpleDenoise input.wav\n"); - printf("./SimpleDenoise input.mp3\n"); + printf("%s input.wav\n", pname); + printf("%s input.mp3\n", pname); printf("or\n"); - printf("./SimpleDenoise input.wav output.wav\n"); - printf("./SimpleDenoise input.mp3 output.wav\n"); - printf("press any key to exit.\n"); - getchar(); + printf("%s input.wav output.wav\n", pname); + printf("%s input.mp3 output.wav\n", pname); } -void simpleDenoise(char *in_file, char *out_file) +void simpleDenoise(char *in_file, char *out_file, char *pname) { - if (in_file == NULL || out_file == NULL) { - printUsage(); + if (in_file == NULL || out_file == NULL) + { + printUsage(pname); return; } uint32_t sampleRate = 0; @@ -341,15 +340,16 @@ int main(int argc, char *argv[]) { printf("Audio Processing\n"); printf("blog:http://cpuimage.cnblogs.com/\n"); - printf("Audio Simple Denoise\n"); + printf("Simple Audio Denoise\n"); + char *pname = argv[0]; if (argc < 2) { - printUsage(); + printUsage(pname); return -1; } char *in_file = argv[1]; if (argc > 2) { char *out_file = argv[2]; - simpleDenoise(in_file, out_file); + simpleDenoise(in_file, out_file, pname); } else { char drive[3]; @@ -359,7 +359,7 @@ int main(int argc, char *argv[]) char out_file[1024]; splitpath(in_file, drive, dir, fname, ext); sprintf(out_file, "%s%s%s_out.wav", drive, dir, fname); - simpleDenoise(in_file, out_file); + simpleDenoise(in_file, out_file, pname); } printf("done.\n"); return 0; diff --git a/stb_fft.h b/src/stb_fft.h old mode 100755 new mode 100644 similarity index 100% rename from stb_fft.h rename to src/stb_fft.h diff --git a/timing.h b/src/timing.h old mode 100755 new mode 100644 similarity index 100% rename from timing.h rename to src/timing.h