~munt/munt/trunk

« back to all changes in this revision

Viewing changes to mt32emu/src/TVP.cpp

  • Committer: sergm
  • Date: 2019-08-25 13:31:57 UTC
  • Revision ID: git-v1:1ea0469877a5a30e146ec9141bb50649901073d6
Refactored MidiEventQueue

Introduced helper interface SysexDataStorage that facilitates
various ways the SysEx data is stored. Specifically,
along with the dynamic memory allocation, a storage buffer
can now be preallocated and used to keep the SysEx data
of the MIDI event stored on the queue. This makes it possible
to push MIDI events to the queue even from a realtime thread.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
2
 
 * Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
 
2
 * Copyright (C) 2011-2019 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
3
3
 *
4
4
 *  This program is free software: you can redistribute it and/or modify
5
5
 *  it under the terms of the GNU Lesser General Public License as published by
104
104
 
105
105
        // MT-32 GEN0 does 16-bit calculations here, allowing an integer overflow.
106
106
        // This quirk is observable playing the patch defined for timbre "HIT BOTTOM" in Larry 3.
 
107
        // Note, the upper bound isn't checked either.
107
108
        if (controlROMFeatures->quirkBasePitchOverflow) {
108
109
                basePitch = basePitch & 0xffff;
109
110
        } else if (basePitch < 0) {
110
111
                basePitch = 0;
111
 
        }
112
 
        if (basePitch > 59392) {
 
112
        } else if (basePitch > 59392) {
113
113
                basePitch = 59392;
114
114
        }
115
115
        return Bit32u(basePitch);
151
151
 
152
152
        // FIXME: We're using a per-TVP timer instead of a system-wide one for convenience.
153
153
        timeElapsed = 0;
 
154
        processTimerIncrement = 0;
154
155
 
155
156
        basePitch = calcBasePitch(partial, partialParam, patchTemp, key, partial->getSynth()->controlROMFeatures);
156
157
        currentPitchOffset = calcTargetPitchOffsetWithoutLFO(partialParam, 0, velocity);
194
195
        } else if (newPitch < 0) {
195
196
                newPitch = 0;
196
197
        }
 
198
        // This check is present in every unit.
197
199
        if (newPitch > 59392) {
198
200
                newPitch = 59392;
199
201
        }