From 4760257aff79e373e271a5ae72a5a07a97f5cdd2 Mon Sep 17 00:00:00 2001 From: HiveBeats Date: Thu, 15 Jun 2023 19:10:28 +0400 Subject: [PATCH] fix(sound): init samples corrected --- .cproject | 107 ++++++++++++++++++++++++++++++++ .gitignore | 4 +- .project | 26 ++++++++ .settings/language.settings.xml | 25 ++++++++ .vscode/settings.json | 5 +- main.c | 4 +- 6 files changed, 166 insertions(+), 5 deletions(-) create mode 100644 .cproject create mode 100644 .project create mode 100644 .settings/language.settings.xml diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..ae2dd97 --- /dev/null +++ b/.cproject @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.gitignore b/.gitignore index a05bb43..a5c2d27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /bin -.DS_Store \ No newline at end of file +.DS_Store +/Debug/ +*.wav \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..9685b1c --- /dev/null +++ b/.project @@ -0,0 +1,26 @@ + + + SeeSynth + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml new file mode 100644 index 0000000..b37a71d --- /dev/null +++ b/.settings/language.settings.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 873fec4..03743e0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,8 @@ { "cpplint.filters": [ "readability/casting" - ] + ], + "files.associations": { + "algorithm": "c" + } } \ No newline at end of file diff --git a/main.c b/main.c index b370a3f..b971967 100644 --- a/main.c +++ b/main.c @@ -86,7 +86,7 @@ static Sound get_init_samples(float duration) { float* samples = malloc(sizeof(float) * sample_count); for (double i = 0.0; i < duration * SAMPLE_RATE; i++) { - samples[(int)i] = i / SAMPLE_RATE; + samples[(int)i] = i; } Sound res = { @@ -196,7 +196,6 @@ static Sound freq(float duration, OscillatorParameterList osc) { float* output = malloc(sizeof(float) * samples.sample_count); for (int i = 0; i < samples.sample_count; i++) { float sample = samples.samples[i]; - // todo: OscillatorGenerationParameter param = { .oscillators = osc, .sample = sample @@ -392,7 +391,6 @@ int main(int argc, char **argv) { uint16_t* song_pcm = malloc(sizeof(uint16_t) * song.sample_count); for (size_t i = 0; i < song.sample_count; i++) { song_pcm[i] = toInt16Sample(song.samples[i]); - // printf("Sample: %d\n", song_pcm[i]); } pack(song_pcm, song.sample_count);