commit b2c5936e1b2875fe29bac6c20981cd1dd485e6c7
parent ce11a8537f677f58a1941d7e9240083d9b143786
Author: Kjetil Matheussen <k.s.matheussen@usit.uio.no>
Date: Thu, 14 May 2015 09:43:39 +0200
Lots of uint32_t->int32_t and uint64_t->int64_t
Diffstat:
16 files changed, 101 insertions(+), 101 deletions(-)
diff --git a/examples/thyns/plugin.c b/examples/thyns/plugin.c
@@ -28,11 +28,11 @@ thyns_plugin_destroy(struct clap_plugin *plugin)
free(p);
}
-uint32_t
+int32_t
thyns_plugin_get_attribute(struct clap_plugin *plugin,
const char *attr,
char *buffer,
- uint32_t size)
+ int32_t size)
{
#define attr(Attr, Value) \
do { \
@@ -91,7 +91,7 @@ thyns_plugin_deactivate(struct clap_plugin *plugin)
{
}
-uint32_t
+int32_t
thyns_params_count(struct clap_plugin *plugin)
{
return sizeof (struct thyns_params) / sizeof (union clap_param_value);
@@ -99,14 +99,14 @@ thyns_params_count(struct clap_plugin *plugin)
bool
thyns_params_get(struct clap_plugin *plugin,
- uint32_t index,
+ int32_t index,
struct clap_param *param)
{
if (index >= thyns_params_count(plugin))
return false;
struct thyns_plugin *p = plugin->plugin_data;
- uint32_t i = 0;
+ int32_t i = 0;
param->index = index;
param->parent = -1;
@@ -157,7 +157,7 @@ thyns_params_get(struct clap_plugin *plugin,
}
bool
-thyns_state_save(struct clap_plugin *plugin, void **buffer, uint32_t *size)
+thyns_state_save(struct clap_plugin *plugin, void **buffer, int32_t *size)
{
struct thyns_plugin *p = plugin->plugin_data;
@@ -169,7 +169,7 @@ thyns_state_save(struct clap_plugin *plugin, void **buffer, uint32_t *size)
bool
thyns_state_restore(struct clap_plugin *plugin,
const void *buffer,
- uint32_t size)
+ int32_t size)
{
struct thyns_plugin *p = plugin->plugin_data;
@@ -179,7 +179,7 @@ thyns_state_restore(struct clap_plugin *plugin,
struct thyns_plugin *
thyns_plugin_create(struct clap_host *host,
- uint32_t sample_rate)
+ int32_t sample_rate)
{
struct thyns_plugin *p = calloc(sizeof (*p), 1);
if (!p)
@@ -209,10 +209,10 @@ thyns_plugin_create(struct clap_host *host,
}
struct clap_plugin *
-clap_create(uint32_t plugin_index,
+clap_create(int32_t plugin_index,
struct clap_host *host,
- uint32_t sample_rate,
- uint32_t *plugins_count)
+ int32_t sample_rate,
+ int32_t *plugins_count)
{
if (plugins_count)
*plugins_count = 1;
diff --git a/examples/thyns/thyns.h b/examples/thyns/thyns.h
@@ -10,10 +10,10 @@
struct thyns
{
- uint32_t sr; // sample rate
+ int32_t sr; // sample rate
double pi_sr; // M_PI / sample_rate
- uint64_t steady_time;
+ int64_t steady_time;
struct thyns_voice *voices_singing; // list
struct thyns_voice *voices_idle; // list
@@ -30,7 +30,7 @@ struct thyns
struct thyns_ramp ramps_buffer[THYNS_RAMPS_COUNT];
};
-static inline void thyns_init(struct thyns *thyns, uint32_t sr)
+static inline void thyns_init(struct thyns *thyns, int32_t sr)
{
memset(thyns, 0, sizeof (*thyns));
@@ -39,12 +39,12 @@ static inline void thyns_init(struct thyns *thyns, uint32_t sr)
thyns_params_init(&thyns->params);
- for (uint32_t i = 0; i < THYNS_VOICES_COUNT; ++i) {
+ for (int32_t i = 0; i < THYNS_VOICES_COUNT; ++i) {
thyns_voice_init(thyns->voices_buffer + i, sr);
thyns_dlist_push_back(thyns->voices_idle, thyns->voices_buffer + i);
}
- for (uint32_t i = 0; i < THYNS_RAMPS_COUNT; ++i)
+ for (int32_t i = 0; i < THYNS_RAMPS_COUNT; ++i)
thyns_dlist_push_back(thyns->ramps_idle, thyns->ramps_buffer + i);
}
@@ -229,7 +229,7 @@ thyns_process(struct thyns *thyns, struct clap_process *process)
struct clap_event *ev = process->events;
thyns->steady_time = process->steady_time;
- for (uint32_t i = 0; i < process->samples_count; ++i, ++thyns->steady_time) {
+ for (int32_t i = 0; i < process->samples_count; ++i, ++thyns->steady_time) {
// handle events
for (; ev; ev = ev->next) {
diff --git a/include/clap/clap.h b/include/clap/clap.h
@@ -143,7 +143,7 @@ struct clap_event_param
uint8_t key; // if !is_global, target key
/* parameter */
- uint32_t index; // parameter index
+ int32_t index; // parameter index
union clap_param_value value;
float increment; // for param ramp
char display_text[CLAP_DISPLAY_SIZE]; // use this for display.
@@ -159,7 +159,7 @@ struct clap_event_control
uint8_t key; // if !is_global, target key
/* control */
- uint32_t index;
+ int32_t index;
float value; // 0 .. 1.0f
};
@@ -176,28 +176,28 @@ struct clap_event_midi
/* midi event */
const uint8_t *buffer;
- uint32_t size;
+ int32_t size;
};
struct clap_event_latency
{
- uint32_t latency;
+ int32_t latency;
};
struct clap_event_jump
{
- uint32_t tempo; // tempo in samples
- uint32_t bar; // the bar number
- uint32_t bar_offset; // 0 <= cycle_offset < tsig_denom * tempo
- uint32_t tsig_num; // time signature numerator
- uint32_t tsig_denom; // time signature denominator
+ int32_t tempo; // tempo in samples
+ int32_t bar; // the bar number
+ int32_t bar_offset; // 0 <= cycle_offset < tsig_denom * tempo
+ int32_t tsig_num; // time signature numerator
+ int32_t tsig_denom; // time signature denominator
};
struct clap_event
{
struct clap_event *next; // linked list, NULL on end
enum clap_event_type type;
- uint64_t steady_time; // steady_time of the event, see host->steady_time(host)
+ int64_t steady_time; // steady_time of the event, see host->steady_time(host)
union {
struct clap_event_note note;
@@ -231,10 +231,10 @@ struct clap_process
/* audio buffers */
float **inputs;
float **outputs;
- uint32_t samples_count;
+ int32_t samples_count;
/* process info */
- uint64_t steady_time; // the steady time in samples
+ int64_t steady_time; // the steady time in samples
/* events */
struct clap_event *events;
@@ -246,13 +246,13 @@ struct clap_process
struct clap_host
{
- uint32_t clap_version; // initialized to CLAP_VERSION
+ int32_t clap_version; // initialized to CLAP_VERSION
/* returns the size of the original string, 0 if not string */
- uint32_t (*get_attribute)(struct clap_host *host,
+ int32_t (*get_attribute)(struct clap_host *host,
const char *attr,
char *buffer,
- uint32_t size);
+ int32_t size);
/* for events generated by the plugin. */
void (*events)(struct clap_host *host,
@@ -262,7 +262,7 @@ struct clap_host
/* The time in samples, this clock is monotonicaly increasing,
* it means that each time you read the value, it must be greater
* or equal to the previous one. */
- const uint64_t *steady_time;
+ const int64_t *steady_time;
/* Log a message through the host. */
void (*log)(struct clap_host *host,
@@ -289,7 +289,7 @@ enum clap_plugin_type
struct clap_plugin
{
- uint32_t clap_version; // initialized to CALP_VERSION
+ int32_t clap_version; // initialized to CALP_VERSION
void *host_data; // reserved pointer for the host
void *plugin_data; // reserved pointer for the plugin
@@ -302,10 +302,10 @@ struct clap_plugin
* This function must place a '\0' byte at the end of the string.
* Returns the size of the original string or 0 if there is no
* value for this attributes. */
- uint32_t (*get_attribute)(struct clap_plugin *plugin,
+ int32_t (*get_attribute)(struct clap_plugin *plugin,
const char *attr,
char *buffer,
- uint32_t size);
+ int32_t size);
/* activation */
bool (*activate)(struct clap_plugin *plugin);
@@ -320,10 +320,10 @@ struct clap_plugin
};
/* typedef for dlsym() cast */
-typedef struct clap_plugin *(*clap_create_f)(uint32_t plugin_index,
+typedef struct clap_plugin *(*clap_create_f)(int32_t plugin_index,
struct clap_host *host,
- uint32_t sample_rate,
- uint32_t *plugins_count);
+ int32_t sample_rate,
+ int32_t *plugins_count);
/* Plugin entry point. If plugins_count is not null, then clap_create has
* to store the number of plugins available in *plugins_count.
@@ -332,10 +332,10 @@ typedef struct clap_plugin *(*clap_create_f)(uint32_t plugin_index,
*
* This function must be thread-safe. */
struct clap_plugin *
-clap_create(uint32_t plugin_index,
+clap_create(int32_t plugin_index,
struct clap_host *host,
- uint32_t sample_rate,
- uint32_t *plugins_count);
+ int32_t sample_rate,
+ int32_t *plugins_count);
# ifdef __cplusplus
}
diff --git a/include/clap/ext/embed-win32.h b/include/clap/ext/embed-win32.h
@@ -10,7 +10,7 @@
struct clap_plugin_embed_win32
{
- void (*get_size)(uint32_t *width, uint32_t *height);
+ void (*get_size)(int32_t *width, int32_t *height);
bool (*attach)(struct clap_plugin *plugin, HWND window);
bool (*detach)(struct clap_plugin *plugin);
};
diff --git a/include/clap/ext/embed-xlib.h b/include/clap/ext/embed-xlib.h
@@ -10,7 +10,7 @@
struct clap_plugin_embed_xlib
{
- void (*get_size)(uint32_t *width, uint32_t *height);
+ void (*get_size)(int32_t *width, int32_t *height);
/* Note for the client, you can get a Display* by calling
* XOpenDisplay(display_name).
diff --git a/include/clap/ext/embed.h b/include/clap/ext/embed.h
@@ -9,7 +9,7 @@ struct clap_host_embed
{
/* Request the host to resize the client area to width, height.
* Return true on success, false otherwise. */
- bool (*resize)(struct clap_host *host, uint32_t width, uint32_t height);
+ bool (*resize)(struct clap_host *host, int32_t width, int32_t height);
};
#endif /* !CLAP_EXT_EMBED_H */
diff --git a/include/clap/ext/params.c b/include/clap/ext/params.c
@@ -1,7 +1,7 @@
static inline bool
clap_plugin_params_save(struct clap_plugin *plugin,
uint8_t *buffer,
- uint32_t *size)
+ int32_t *size)
{
struct clap_plugin_params *params = (struct clap_plugin_params *)
plugin->extension(plugin, CLAP_EXT_PARAMS);
@@ -17,8 +17,8 @@ clap_plugin_params_save(struct clap_plugin *plugin,
if (!clap_serializer_dict(&s))
return false;
- uint32_t count = params->count(plugin);
- for (uint32_t i = 0; i < count; ++i) {
+ int32_t count = params->count(plugin);
+ for (int32_t i = 0; i < count; ++i) {
struct clap_param param;
if (!params->get(plugin, i, ¶m))
@@ -60,8 +60,8 @@ clap_plugin_params_save(struct clap_plugin *plugin,
static inline void
clap_plugin_params_restore(struct clap_plugin *plugin,
const uint8_t *buffer,
- uint32_t size,
- uint64_t steady_time)
+ int32_t size,
+ int64_t steady_time)
{
struct clap_plugin_params *params = (struct clap_plugin_params *)
plugin->extension(plugin, CLAP_EXT_PARAMS);
@@ -69,12 +69,12 @@ clap_plugin_params_restore(struct clap_plugin *plugin,
return;
// allocate the ids
- uint32_t count = params->count(plugin);
+ int32_t count = params->count(plugin);
char ids[count][CLAP_ID_SIZE];
memset(ids, 0, sizeof (ids));
// fill ids
- for (uint32_t i = 0; i < count; ++i) {
+ for (int32_t i = 0; i < count; ++i) {
struct clap_param param;
if (params->get(plugin, i, ¶m))
memcpy(ids[i], param.id, sizeof (param.id));
@@ -93,7 +93,7 @@ clap_plugin_params_restore(struct clap_plugin *plugin,
return;
// find param index
- uint32_t index;
+ int32_t index;
for (index = 0; index < count; ++index)
if (!strncmp(ids[index], d.s, d.slen))
break;
diff --git a/include/clap/ext/params.h b/include/clap/ext/params.h
@@ -28,8 +28,8 @@ enum clap_param_scale
struct clap_param
{
/* tree fields */
- uint32_t index; // parameter's index
- uint32_t parent; // parent's index, -1 for no parent
+ int32_t index; // parameter's index
+ int32_t parent; // parent's index, -1 for no parent
/* param info */
char id[CLAP_ID_SIZE]; // a string which identify the param
@@ -52,12 +52,12 @@ struct clap_param
struct clap_plugin_params
{
/* Returns the number of parameters. */
- uint32_t (*count)(struct clap_plugin *plugin);
+ int32_t (*count)(struct clap_plugin *plugin);
/* Copies the parameter's info to param and returns true.
* If index is greater or equal to the number then return false. */
bool (*get)(struct clap_plugin *plugin,
- uint32_t index,
+ int32_t index,
struct clap_param *param);
};
@@ -69,7 +69,7 @@ struct clap_plugin_params
static inline bool
clap_plugin_params_save(struct clap_plugin *plugin,
uint8_t *buffer,
- uint32_t *size);
+ int32_t *size);
/* Helper that will deserialize parameters value from the buffer
* and send CLAP_EVENT_PARAM_SET to the plugin to restore them.
@@ -79,8 +79,8 @@ clap_plugin_params_save(struct clap_plugin *plugin,
static inline void
clap_plugin_params_restore(struct clap_plugin *plugin,
const uint8_t *buffer,
- uint32_t size,
- uint64_t steady_time);
+ int32_t size,
+ int64_t steady_time);
# include "params.c"
diff --git a/include/clap/ext/ports.h b/include/clap/ext/ports.h
@@ -29,8 +29,8 @@ struct clap_port_info
struct clap_ports_config
{
char name[CLAP_NAME_SIZE];
- uint32_t inputs_count;
- uint32_t outputs_count;
+ int32_t inputs_count;
+ int32_t outputs_count;
};
/* The audio ports configuration has to be done while the plugin is
@@ -38,19 +38,19 @@ struct clap_ports_config
struct clap_plugin_ports
{
/* Returns the number of available configurations */
- uint32_t (*get_configs_count)(struct clap_plugin *plugin);
+ int32_t (*get_configs_count)(struct clap_plugin *plugin);
bool (*get_config)(struct clap_plugin *plugin,
- uint32_t config_index,
+ int32_t config_index,
struct clap_ports_config *config);
bool (*get_info)(struct clap_plugin *plugin,
- uint32_t config_index,
- uint32_t port_index,
+ int32_t config_index,
+ int32_t port_index,
struct clap_port_info *port);
bool (*set_config)(struct clap_plugin *plugin,
- uint32_t config_index);
+ int32_t config_index);
bool (*set_repeat)(struct clap_plugin *plugin,
- uint32_t port_index,
- uint32_t count);
+ int32_t port_index,
+ int32_t count);
};
#endif /* !CLAP_EXT_PORT_H */
diff --git a/include/clap/ext/state.h b/include/clap/ext/state.h
@@ -10,8 +10,8 @@ struct clap_plugin_state
/* The plugin has to allocate and save its state into *buffer.
* The plugin is also responsible to free the buffer on the
* next call to save() or when the plugin is destroyed. */
- bool (*save)(struct clap_plugin *plugin, void **buffer, uint32_t *size);
- bool (*restore)(struct clap_plugin *plugin, const void *buffer, uint32_t size);
+ bool (*save)(struct clap_plugin *plugin, void **buffer, int32_t *size);
+ bool (*restore)(struct clap_plugin *plugin, const void *buffer, int32_t size);
};
#endif /* !CLAP_EXT_STATE_H */
diff --git a/include/clap/midi/parser.c b/include/clap/midi/parser.c
@@ -155,10 +155,10 @@ clap_midi_parse_be32(const uint8_t *in)
}
static inline uint32_t
-clap_midi_parse_variable_length(struct clap_midi_parser *parser, uint32_t *offset)
+clap_midi_parse_variable_length(struct clap_midi_parser *parser, int32_t *offset)
{
uint32_t value = 0;
- uint32_t i = *offset;
+ int32_t i = *offset;
for (; i < parser->size; ++i) {
value = (value << 7) | (parser->in[i] & 0x7f);
@@ -229,7 +229,7 @@ clap_midi_parse_meta_event(struct clap_midi_parser *parser)
return CLAP_MIDI_PARSER_EOB;
parser->meta.type = parser->in[1];
- uint32_t offset = 2;
+ int32_t offset = 2;
parser->meta.length = clap_midi_parse_variable_length(parser, &offset);
// check buffer size
@@ -281,7 +281,7 @@ clap_midi_parse(struct clap_midi_parser *parser)
static inline void
clap_midi_convert(const uint8_t *in,
- uint32_t size,
+ int32_t size,
struct clap_event *event)
{
struct clap_midi_parser parser;
diff --git a/include/clap/midi/parser.h b/include/clap/midi/parser.h
@@ -26,15 +26,15 @@ enum clap_midi_parser_status
struct clap_midi_header
{
- uint32_t size;
+ int32_t size;
uint16_t format;
- uint16_t tracks_count;
- uint16_t time_division;
+ int16_t tracks_count;
+ int16_t time_division;
};
struct clap_midi_track
{
- uint32_t size;
+ int32_t size;
};
enum clap_midi_channel_event_type
@@ -50,7 +50,7 @@ enum clap_midi_channel_event_type
struct clap_midi_channel_event
{
- uint64_t delta_time;
+ int64_t delta_time;
unsigned event_type : 4;
unsigned channel : 4;
uint8_t param1;
@@ -60,7 +60,7 @@ struct clap_midi_channel_event
struct clap_midi_meta_event
{
uint8_t type;
- uint32_t length;
+ int32_t length;
const uint8_t *bytes; // reference to the input buffer
};
@@ -68,7 +68,7 @@ struct clap_midi_sysex_event
{
uint8_t sysex;
uint8_t type;
- uint32_t length;
+ int32_t length;
const uint8_t *bytes; // reference to the input buffer
};
@@ -78,7 +78,7 @@ struct clap_midi_parser
/* input buffer */
const uint8_t *in;
- uint32_t size;
+ int32_t size;
/* result */
struct clap_midi_header header;
@@ -96,7 +96,7 @@ clap_midi_parse(struct clap_midi_parser *parser);
* converted as a clap_midi_event. */
static inline void
clap_midi_convert(const uint8_t *in,
- uint32_t size,
+ int32_t size,
struct clap_event *event);
# include "parser.c"
diff --git a/include/clap/serialize/serialize.c b/include/clap/serialize/serialize.c
@@ -83,7 +83,7 @@ clap_serializer_float(struct clap_serializer *s, float value)
static inline bool
clap_serializer_str(struct clap_serializer *s,
const char *str,
- uint32_t len)
+ int32_t len)
{
if (!s->out || s->out + 5 + len >= s->out_end)
return false;
diff --git a/include/clap/serialize/serialize.h b/include/clap/serialize/serialize.h
@@ -44,7 +44,7 @@ clap_serializer_end(struct clap_serializer *s);
static inline bool
clap_serializer_str(struct clap_serializer *s,
const char *str,
- uint32_t len);
+ int32_t len);
/* Pushes an 32 bits integer. Returns false on EOB. */
static inline bool
@@ -72,7 +72,7 @@ struct clap_deserializer
float f;
const char *s;
};
- uint32_t slen;
+ int32_t slen;
};
/* Decodes one token into *d.
diff --git a/tools/clap-info/clap-info.c b/tools/clap-info/clap-info.c
@@ -17,7 +17,7 @@ static void *host_extension(struct clap_host *host, const char *extension_id)
static void initialize_host(struct clap_host *host)
{
- static uint64_t steady_time = 0;
+ static int64_t steady_time = 0;
host->clap_version = CLAP_VERSION;
host->events = host_events;
@@ -68,11 +68,11 @@ static void print_params(struct clap_plugin *plugin)
return;
}
- uint32_t count = params->count(plugin);
+ int32_t count = params->count(plugin);
fprintf(stdout, "parameters count: %d\n", count);
struct clap_param param;
- for (uint32_t i = 0; i < count; ++i) {
+ for (int32_t i = 0; i < count; ++i) {
if (!params->get(plugin, i, ¶m))
continue;
@@ -135,8 +135,8 @@ int main(int argc, char **argv)
return 1;
}
- uint32_t plugin_count = -1;
- for (uint32_t index = 0; index < plugin_count; ++index) {
+ int32_t plugin_count = -1;
+ for (int32_t index = 0; index < plugin_count; ++index) {
struct clap_plugin *plugin = symbol.clap_create(
index, &host, 48000, &plugin_count);
diff --git a/tools/clap-jack-host/clap-jack-host.c b/tools/clap-jack-host/clap-jack-host.c
@@ -24,8 +24,8 @@ struct clap_jack_host
void *library_handle;
/* host */
- uint32_t sample_rate;
- uint64_t steady_time;
+ int32_t sample_rate;
+ int64_t steady_time;
/* jack */
jack_client_t *client;
@@ -71,10 +71,10 @@ static void host_log(struct clap_host *host,
fprintf(stdout, "[%s] %s\n", severities[severity], msg);
}
-static uint32_t host_attribute(struct clap_host *host,
+static int32_t host_attribute(struct clap_host *host,
const char *attr,
char *buffer,
- uint32_t size)
+ int32_t size)
{
return 0;
}
@@ -90,7 +90,7 @@ int process(jack_nframes_t nframes, void *arg)
out[i] = jack_port_get_buffer(app->output_ports[i], nframes);
}
void *midi_in_buf = jack_port_get_buffer(app->midi_in, nframes);
- uint32_t midi_in_count = jack_midi_get_event_count(midi_in_buf);
+ int32_t midi_in_count = jack_midi_get_event_count(midi_in_buf);
struct clap_process p;
p.inputs = in;
@@ -102,7 +102,7 @@ int process(jack_nframes_t nframes, void *arg)
/* convert midi events */
p.events = NULL;
struct clap_event *last_event = NULL;
- for (uint32_t i = 0; i < midi_in_count; ++i) {
+ for (int32_t i = 0; i < midi_in_count; ++i) {
jack_midi_event_t midi;
jack_midi_event_get(&midi, midi_in_buf, i);
@@ -139,7 +139,7 @@ void shutdown(void *arg)
static bool initialize(struct clap_jack_host *app,
const char *plugin_path,
- uint32_t plugin_index)
+ int32_t plugin_index)
{
app->quit = false;
@@ -198,7 +198,7 @@ static bool initialize(struct clap_jack_host *app,
goto fail_dlclose;
}
- uint32_t plugin_count;
+ int32_t plugin_count;
app->plugin = symbol.clap_create(plugin_index, &app->host, app->sample_rate, &plugin_count);
if (!app->plugin) {
fprintf(stderr, "failed to create plugin\n");
@@ -263,7 +263,7 @@ static void save_state(struct clap_jack_host *app)
}
void *buffer = NULL;
- uint32_t size = 0;
+ int32_t size = 0;
if (!state->save(app->plugin, &buffer, &size)) {
fprintf(stdout, "failed to save the state\n");
return;