aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ambdec.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-01-16 09:37:55 -0800
committerChris Robinson <[email protected]>2017-01-16 09:37:55 -0800
commite9009968fbfe3f89b308f6f2880e3bbafbb27884 (patch)
tree3c86677269412a217d320dbcfdb3a9e1e12ce365 /Alc/ambdec.c
parentf1f93a593a62b1a06f900d809628b5678eab4d8b (diff)
More ALsizei, with the B-Format decoder
Diffstat (limited to 'Alc/ambdec.c')
-rw-r--r--Alc/ambdec.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/Alc/ambdec.c b/Alc/ambdec.c
index 255011d5..719b509c 100644
--- a/Alc/ambdec.c
+++ b/Alc/ambdec.c
@@ -90,6 +90,15 @@ static char *my_strtok_r(char *str, const char *delim, char **saveptr)
return str;
}
+static char *read_int(ALint *num, const char *line, int base)
+{
+ char *end;
+ *num = strtol(line, &end, base);
+ if(end && *end != '\0')
+ end = lstrip(end);
+ return end;
+}
+
static char *read_uint(ALuint *num, const char *line, int base)
{
char *end;
@@ -131,7 +140,7 @@ char *read_clipped_line(FILE *f, char **buffer, size_t *maxlen)
static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t *maxlen, char **saveptr)
{
- ALuint cur = 0;
+ ALsizei cur = 0;
while(cur < conf->NumSpeakers)
{
const char *cmd = my_strtok_r(NULL, " \t", saveptr);
@@ -184,10 +193,10 @@ static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t
return 1;
}
-static int load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS], ALuint maxrow, FILE *f, char **buffer, size_t *maxlen, char **saveptr)
+static int load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS], ALsizei maxrow, FILE *f, char **buffer, size_t *maxlen, char **saveptr)
{
int gotgains = 0;
- ALuint cur = 0;
+ ALsizei cur = 0;
while(cur < maxrow)
{
const char *cmd = my_strtok_r(NULL, " \t", saveptr);
@@ -269,7 +278,7 @@ static int load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS]
void ambdec_init(AmbDecConf *conf)
{
- ALuint i;
+ ALsizei i;
memset(conf, 0, sizeof(*conf));
AL_STRING_INIT(conf->Description);
@@ -282,7 +291,7 @@ void ambdec_init(AmbDecConf *conf)
void ambdec_deinit(AmbDecConf *conf)
{
- ALuint i;
+ ALsizei i;
al_string_deinit(&conf->Description);
for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
@@ -370,7 +379,7 @@ int ambdec_load(AmbDecConf *conf, const char *fname)
else if(strcmp(dec, "speakers") == 0)
{
line = my_strtok_r(NULL, "", &saveptr);
- line = read_uint(&conf->NumSpeakers, line, 10);
+ line = read_int(&conf->NumSpeakers, line, 10);
if(line && *line != '\0')
{
ERR("Extra junk after speakers: %s\n", line);