aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/midi/base.h
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/midi/base.h')
-rw-r--r--Alc/midi/base.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/Alc/midi/base.h b/Alc/midi/base.h
index 42a4c279..157f2399 100644
--- a/Alc/midi/base.h
+++ b/Alc/midi/base.h
@@ -17,8 +17,13 @@ typedef struct Reader {
void *ptr;
int error;
} Reader;
-#define READ(x_, buf_, len_) ((x_)->cb((buf_), (len_), (x_)->ptr))
-#define READERR(x_) ((x_)->error)
+inline size_t Reader_read(Reader *self, void *buf, size_t len)
+{
+ size_t got = (!self->error) ? self->cb(buf, len, self->ptr) : 0;
+ if(got < len) self->error = 1;
+ return got;
+}
+#define READERR(x_) ((x_)->error)
ALboolean loadSf2(Reader *stream, struct ALsoundfont *sfont, ALCcontext *context);