From aa70b335c592bb3b215dfb1ee3b6feff2d59b383 Mon Sep 17 00:00:00 2001 From: kazu Date: Sat, 15 Jun 2024 13:54:29 +0000 Subject: [PATCH] change `ksynth_new` `max_polyphony` argument to `unsigned int` git-svn-id: file:///raid/svn-main/kazu-ksynth/trunk@46 7b47e76f-e598-2f43-bc14-414d160cc389 --- src/ksynth.c | 4 ++-- src/ksynth.h | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ksynth.c b/src/ksynth.c index 67ff3bf..d8e165f 100644 --- a/src/ksynth.c +++ b/src/ksynth.c @@ -151,7 +151,7 @@ int ksynth_get_revision(void) { return n; } -struct KSynth* ksynth_new(const char* sample_file_path, unsigned int sample_rate, unsigned char num_channel, unsigned long max_polyphony) { +struct KSynth* ksynth_new(const char* sample_file_path, unsigned int sample_rate, unsigned char num_channel, unsigned int max_polyphony) { struct KSynth* ksynth_instance = calloc(1, sizeof(struct KSynth)); if(ksynth_instance != NULL) { // HARDCODED? @@ -315,7 +315,7 @@ int ksynth_get_max_polyphony(struct KSynth* ksynth_instance) { return ksynth_instance->max_polyphony; }; -bool ksynth_set_max_polyphony(struct KSynth* ksynth_instance, unsigned long max_polyphony) { +bool ksynth_set_max_polyphony(struct KSynth* ksynth_instance, unsigned int max_polyphony) { if(!ksynth_instance) return false; struct Voice** old_ptr = ksynth_instance->voices; diff --git a/src/ksynth.h b/src/ksynth.h index b0bd630..6b8231d 100644 --- a/src/ksynth.h +++ b/src/ksynth.h @@ -1,4 +1,4 @@ -#ifndef KSYNTH_H +#ifndef KSYNTH_H #define KSYNTH_H #ifdef __cplusplus extern "C" { @@ -32,9 +32,9 @@ struct KSynth { struct Sample** samples; unsigned int sample_rate; unsigned char num_channel; - unsigned long polyphony; + unsigned int polyphony; unsigned char polyphony_per_channel[16]; - unsigned long max_polyphony; + unsigned int max_polyphony; float rendering_time; struct Chan channels[16]; struct Voice** voices; @@ -90,7 +90,7 @@ int ksynth_get_revision(void); * @param max_polyphony 最大ポリフォニー(1〜100,000) * @return 成功した場合は新しいKSynthインスタンスへのポインタ、失敗した場合はNULL */ -struct KSynth* ksynth_new(const char* sample_file_path, unsigned int sample_rate, unsigned char num_channel, unsigned long max_polyphony); +struct KSynth* ksynth_new(const char* sample_file_path, unsigned int sample_rate, unsigned char num_channel, unsigned int max_polyphony); /** * @~english @@ -209,7 +209,7 @@ int ksynth_get_max_polyphony(struct KSynth* ksynth_instance); * @param max_polyphony 最大ポリフォニー(注:100,000を超える値はクランプされます) * @return 成功した場合はtrue、失敗した場合はfalse */ -bool ksynth_set_max_polyphony(struct KSynth* ksynth_instance, unsigned long max_polyphony); +bool ksynth_set_max_polyphony(struct KSynth* ksynth_instance, unsigned int max_polyphony); /** * @~english @@ -252,7 +252,7 @@ void ksynth_fill_buffer(struct KSynth* ksynth_instance, float* buffer, unsigned * this function prepares it for them and gives them a pointer as a return value. * * @param ksynth_instance Pointer to the KSynth instance - * @param buffer_size Size of the buffer (Note: Values are typically between 8 and 65536) + * @param buffer_size Size of the buffer (Note: Values are typically between 32 and 16384) * @return A pointer to the generated buffer on success, NULL on failure. * * @~japanese @@ -262,7 +262,7 @@ void ksynth_fill_buffer(struct KSynth* ksynth_instance, float* buffer, unsigned * この関数は内部的に ksynth_fill_buffer を指しますが、ユーザーにバッファーを管理させる代わりに、この関数はユーザーのためにバッファーを準備し、戻り値としてポインターを与えます。 * * @param ksynth_instance KSynthインスタンスへのポインタ - * @param buffer_size バッファのサイズ(注:通常は8から65536の値です) + * @param buffer_size バッファのサイズ(注:通常は32から16384の値です) * @return 成功した場合は生成されたバッファへのポインタ、失敗した場合はNULL */ float* ksynth_generate_buffer(struct KSynth* ksynth_instance, unsigned int buffer_size); -- 2.43.0