Revert "Merge pull request #4538 from MichaelFroelich/68456_fixesPitchBends"

This reverts commit 1d5ae8afbb.
This commit is contained in:
anatoly-os 2019-05-22 10:31:10 +02:00
parent ada5188b76
commit 740c428a14
17 changed files with 8 additions and 19 deletions

View file

@ -21,7 +21,6 @@
#include "fluid.h"
#include "sfont.h"
#include "gen.h"
#include "synthesizer/event.h"
namespace FluidS {
@ -70,7 +69,7 @@ void Channel::initCtrl()
key_pressure = 0;
channel_pressure = 0;
pitch_bend = 0x2000; // Range is 0x4000, pitch bend wheel starts in centered position
pitch_wheel_sensitivity = PITCH_BEND_SENSITIVITY; /* four semi-tones, default for many DAWs */
pitch_wheel_sensitivity = 12; /* twelve semi-tones */
bank_msb = 0;
for (int i = 0; i < GEN_LAST; i++) {

View file

@ -331,9 +331,9 @@ static void collectNote(EventMap* events, int channel, const Note* note, int vel
int pitch = pitchValue.pitch;
if (pitchIndex == 0 && (pitch == nextPitch.pitch)) {
int midiPitch = midiBendPitch(pitch);
int msb = (midiPitch / 128);
int lsb = (midiPitch % 128);
int midiPitch = (pitch * 16384) / 1200 + 8192;
int msb = midiPitch / 128;
int lsb = midiPitch % 128;
NPlayEvent ev(ME_PITCHBEND, channel, lsb, msb);
ev.setOriginatingStaff(staffIdx);
events->insert(std::pair<int, NPlayEvent>(lastPointTick, ev));
@ -358,7 +358,7 @@ static void collectNote(EventMap* events, int channel, const Note* note, int vel
int p = pitch + dx * pitchDelta / tickDelta;
// We don't support negative pitch, but Midi does. Let's center by adding 8192.
int midiPitch = midiBendPitch(p);
int midiPitch = (p * 16384) / 1200 + 8192;
// Representing pitch as two bytes
int msb = midiPitch / 128;
int lsb = midiPitch % 128;

View file

@ -258,7 +258,7 @@ bool ExportMidi::write(QIODevice* device, bool midiExpandRepeats, bool exportRPN
// set pitch bend sensitivity to 12 semitones:
track.insert(0, MidiEvent(ME_CONTROLLER, channel, CTRL_LRPN, 0));
track.insert(0, MidiEvent(ME_CONTROLLER, channel, CTRL_HRPN, 0));
track.insert(0, MidiEvent(ME_CONTROLLER, channel, CTRL_HDATA, PITCH_BEND_SENSITIVITY));
track.insert(0, MidiEvent(ME_CONTROLLER, channel, CTRL_HDATA, 12));
// reset fine tuning
/*track.insert(0, MidiEvent(ME_CONTROLLER, channel, CTRL_LRPN, 1));

View file

@ -987,14 +987,14 @@ void Seq::initInstruments(bool realTime)
if (realTime) {
putEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_LRPN, 0));
putEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_HRPN, 0));
putEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_HDATA, PITCH_BEND_SENSITIVITY));
putEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_HDATA,12));
putEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_LRPN, 127));
putEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_HRPN, 127));
}
else {
sendEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_LRPN, 0));
sendEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_HRPN, 0));
sendEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_HDATA, PITCH_BEND_SENSITIVITY));
sendEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_HDATA,12));
sendEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_LRPN, 127));
sendEvent(NPlayEvent(ME_CONTROLLER, channel->channel(), CTRL_HRPN, 127));
}

View file

@ -204,8 +204,6 @@ bool MidiCoreEvent::isChannelEvent() const
// return false;
}
//---------------------------------------------------------
// Event::write
//---------------------------------------------------------
@ -356,10 +354,6 @@ QString midiMetaName(int meta)
return QString(s);
}
int midiBendPitch(int pitch) {
return (pitch * 8192) / (PITCH_BEND_SENSITIVITY * 100) + 8192;
}
//---------------------------------------------------------
// insert
//---------------------------------------------------------

View file

@ -22,9 +22,6 @@ class XmlWriter;
enum class BeatType : char;
// 4 is the default for the majority of synthesisers, aka VSTis
const int PITCH_BEND_SENSITIVITY = 4;
//---------------------------------------------------------
// Event types
//---------------------------------------------------------
@ -336,7 +333,6 @@ typedef EventList::const_iterator ciEvent;
extern QString midiMetaName(int meta);
extern int midiBendPitch(int pitch);
}
#endif