Skip to content

Commit

Permalink
1.0: separate code and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zvezdochiot committed Sep 7, 2022
1 parent 65ad9fe commit f7baaa1
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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)
add_executable(${PROJECT_NAME} src/main.c)

target_link_libraries(${PROJECT_NAME} -lm)
Empty file modified LICENSE
100755 → 100644
Empty file.
Empty file modified README.md
100755 → 100644
Empty file.
Empty file modified sample.wav
100755 → 100644
Empty file.
0 dr_mp3.h → src/dr_mp3.h
100755 → 100644
File renamed without changes.
0 dr_wav.h → src/dr_wav.h
100755 → 100644
File renamed without changes.
28 changes: 14 additions & 14 deletions main.c → src/main.c
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand All @@ -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;
Expand Down
0 stb_fft.h → src/stb_fft.h
100755 → 100644
File renamed without changes.
0 timing.h → src/timing.h
100755 → 100644
File renamed without changes.

0 comments on commit f7baaa1

Please sign in to comment.