]> Nishi Git Mirror - ksynth.git/commitdiff
Add support for specify ksmp path in ksynth_new function
authorkazu <kazu@7b47e76f-e598-2f43-bc14-414d160cc389>
Sun, 7 Apr 2024 03:06:47 +0000 (03:06 +0000)
committerkazu <kazu@7b47e76f-e598-2f43-bc14-414d160cc389>
Sun, 7 Apr 2024 03:06:47 +0000 (03:06 +0000)
git-svn-id: file:///raid/svn-main/kazu-ksynth/trunk@8 7b47e76f-e598-2f43-bc14-414d160cc389

src/ksynth.c
src/ksynth.h

index 70192132c022163b6c19fc9b00c8f2b7ff1e6238..0da06405de1c6a1a27da554619af746e6da397fc 100644 (file)
 
 #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);
index 9834497dc477d934708ec656e1ba8eba818456d8..6508721f25dd908164e2ce4b080f3f2b434e710a 100644 (file)
@@ -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.