From: kazu Date: Sun, 7 Apr 2024 03:24:31 +0000 (+0000) Subject: Update document and change ksynth_new argument name (`file_path` -> `sample_file_path`) X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=3f2ee1991b944306b6eb8b21aa928a75891df329;p=ksynth.git Update document and change ksynth_new argument name (`file_path` -> `sample_file_path`) git-svn-id: file:///raid/svn-main/kazu-ksynth/trunk@9 7b47e76f-e598-2f43-bc14-414d160cc389 --- diff --git a/src/ksynth.c b/src/ksynth.c index 0da0640..f00bdd3 100644 --- a/src/ksynth.c +++ b/src/ksynth.c @@ -12,13 +12,13 @@ #define MAX_POLYPHONY 100000 -struct KSynth* ksynth_new(const char* file_path, int sample_rate, int num_channel, int max_polyphony) { +struct KSynth* ksynth_new(const char* sample_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(file_path, "rb"); + FILE* f = fopen(sample_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 6508721..eec9084 100644 --- a/src/ksynth.h +++ b/src/ksynth.h @@ -28,12 +28,14 @@ struct KSynth { * The `max_polyphony` parameter sets the maximum number of simultaneous notes that can be played. * Values exceeding 100,000 will be clamped to 100,000. * + * @param sample_file_path Path to the sample file * @param sample_rate Sample rate * @param num_channel Number of channels (1-2) * @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(const char* file_path, int sample_rate, int num_channel, int max_polyphony); +struct KSynth* ksynth_new(const char* sample_file_path, int sample_rate, int num_channel, int max_polyphony); + /** * @brief Turns a note on for the specified MIDI channel and note.