aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alMidi.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-11-28 05:06:40 -0800
committerChris Robinson <[email protected]>2013-11-28 05:06:40 -0800
commit8615a109ce436bcd99a10596c20e50830ea97f4c (patch)
treeb941a628aa0f6210148ddb55d5f9c8474a0c6c39 /OpenAL32/alMidi.c
parentf8c68291d3b0ebbfa710c95a28b042393fb4b7d6 (diff)
Remove an unneeded MidiSynth field
Diffstat (limited to 'OpenAL32/alMidi.c')
-rw-r--r--OpenAL32/alMidi.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/OpenAL32/alMidi.c b/OpenAL32/alMidi.c
index f9fe5601..abfb7fd1 100644
--- a/OpenAL32/alMidi.c
+++ b/OpenAL32/alMidi.c
@@ -22,8 +22,8 @@ static inline void MidiSynth_setState(MidiSynth *self, ALenum state);
static inline void MidiSynth_reset(MidiSynth *self);
ALuint64 MidiSynth_getTime(const MidiSynth *self);
static inline ALuint64 MidiSynth_getNextEvtTime(const MidiSynth *self);
-static void MidiSynth_update(MidiSynth *self, ALCdevice *device);
-static void MidiSynth_updateSpeed(MidiSynth *self);
+static inline void MidiSynth_update(MidiSynth *self, ALCdevice *device);
+static void MidiSynth_setSampleRate(MidiSynth *self, ALdouble srate);
static ALenum MidiSynth_insertEvent(MidiSynth *self, ALuint64 time, ALuint event, ALsizei param1, ALsizei param2);
@@ -40,9 +40,7 @@ static void MidiSynth_Construct(MidiSynth *self, ALCdevice *device)
self->SamplesSinceLast = 0.0;
self->SamplesToNext = 0.0;
- self->SampleRate = device->Frequency;
- self->SamplesPerTick = (ALdouble)self->SampleRate / TICKS_PER_SECOND;
- MidiSynth_updateSpeed(self);
+ self->SamplesPerTick = (ALdouble)device->Frequency / TICKS_PER_SECOND;
}
static void MidiSynth_Destruct(MidiSynth *self)
@@ -78,15 +76,14 @@ static inline ALuint64 MidiSynth_getNextEvtTime(const MidiSynth *self)
return self->EventQueue.events[self->EventQueue.pos].time;
}
-static void MidiSynth_update(MidiSynth *self, ALCdevice *device)
+static inline void MidiSynth_update(MidiSynth *self, ALCdevice *device)
{
- self->SampleRate = device->Frequency;
- MidiSynth_updateSpeed(self);
+ MidiSynth_setSampleRate(self, device->Frequency);
}
-static void MidiSynth_updateSpeed(MidiSynth *self)
+static void MidiSynth_setSampleRate(MidiSynth *self, ALdouble srate)
{
- ALdouble sampletickrate = (ALdouble)self->SampleRate / TICKS_PER_SECOND;
+ ALdouble sampletickrate = srate / TICKS_PER_SECOND;
self->SamplesSinceLast = self->SamplesSinceLast * sampletickrate / self->SamplesPerTick;
self->SamplesToNext = self->SamplesToNext * sampletickrate / self->SamplesPerTick;