From 37650e41485483740bbe974f56907362d19ba186 Mon Sep 17 00:00:00 2001 From: kazu Date: Sun, 7 Apr 2024 03:06:47 +0000 Subject: [PATCH] Add support for specify ksmp path in ksynth_new function git-svn-id: file:///raid/svn-main/kazu-ksynth/trunk@8 7b47e76f-e598-2f43-bc14-414d160cc389 --- src/ksynth.c | 4 ++-- src/ksynth.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ksynth.c b/src/ksynth.c index 7019213..0da0640 100644 --- a/src/ksynth.c +++ b/src/ksynth.c @@ -12,13 +12,13 @@ #define MAX_POLYPHONY 100000 -struct KSynth* ksynth_new(int sample_rate, int num_channel, int max_polyphony) { +struct KSynth* ksynth_new(const char* file_path, int sample_rate, int num_channel, int max_polyphony) { struct KSynth* ksynth_instance = malloc(sizeof(struct KSynth)); if(ksynth_instance != NULL) { ksynth_instance->samples = malloc(sizeof(struct Sample*) * 128); // Load samples from file - FILE* f = fopen("sample.ksmp", "rb"); + FILE* f = fopen(file_path, "rb"); if(f == NULL) { fprintf(stderr, "[KSynth] Error: Failed to open sample file.\n"); free(ksynth_instance); diff --git a/src/ksynth.h b/src/ksynth.h index 9834497..6508721 100644 --- a/src/ksynth.h +++ b/src/ksynth.h @@ -33,7 +33,7 @@ struct KSynth { * @param max_polyphony Maximum polyphony (1-100,000) * @return struct KSynth* A pointer to the newly created KSynth instance on success, NULL on failure. */ -struct KSynth* ksynth_new(int sample_rate, int num_channel, int max_polyphony); +struct KSynth* ksynth_new(const char* file_path, int sample_rate, int num_channel, int max_polyphony); /** * @brief Turns a note on for the specified MIDI channel and note. -- 2.43.0