MIDI range MKII (extracted from microtonal PR) (#5868)
* Update MIDI range to match MIDI specification Co-authored-by: IanCaio <iancaio_dev@hotmail.com> Co-authored-by: Kevin Zander <veratil@gmail.com> Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com> Co-authored-by: Spekular <Spekular@users.noreply.github.com>
This commit is contained in:
@@ -122,7 +122,9 @@ public:
|
||||
else if ( sKey == "B" ) {
|
||||
m_key = NoteKey::B;
|
||||
}
|
||||
return m_key + (nOctave*12)+57;
|
||||
|
||||
// Hydrogen records MIDI notes from C-1 to B5, and exports them as a number ranging from -3 to 3
|
||||
return m_key + ((nOctave + 3) * 12);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -130,8 +130,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks,
|
||||
if (n.nodeName() == "instrumenttrack")
|
||||
{
|
||||
QDomElement it = n.toElement();
|
||||
// transpose +12 semitones, workaround for #1857
|
||||
base_pitch = (69 - it.attribute("basenote", "57").toInt());
|
||||
base_pitch = (69 - it.attribute("basenote", "69").toInt());
|
||||
if (it.attribute("usemasterpitch", "1").toInt())
|
||||
{
|
||||
base_pitch += masterPitch;
|
||||
@@ -201,8 +200,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks,
|
||||
if (n.nodeName() == "instrumenttrack")
|
||||
{
|
||||
QDomElement it = n.toElement();
|
||||
// transpose +12 semitones, workaround for #1857
|
||||
base_pitch = (69 - it.attribute("basenote", "57").toInt());
|
||||
base_pitch = (69 - it.attribute("basenote", "69").toInt());
|
||||
if (it.attribute("usemasterpitch", "1").toInt())
|
||||
{
|
||||
base_pitch += masterPitch;
|
||||
|
||||
@@ -454,7 +454,7 @@ bool MidiImport::readSMF( TrackContainer* tc )
|
||||
int ticks = noteEvt->get_duration() * ticksPerBeat;
|
||||
Note n( (ticks < 1 ? 1 : ticks ),
|
||||
noteEvt->get_start_time() * ticksPerBeat,
|
||||
noteEvt->get_identifier() - 12,
|
||||
noteEvt->get_identifier(),
|
||||
noteEvt->get_loud() * (200.f / 127.f)); // Map from MIDI velocity to LMMS volume
|
||||
ch->addNote( n );
|
||||
|
||||
|
||||
@@ -300,8 +300,7 @@ bool OpulenzInstrument::handleMidiEvent( const MidiEvent& event, const TimePos&
|
||||
|
||||
switch(event.type()) {
|
||||
case MidiNoteOn:
|
||||
// to get us in line with MIDI(?)
|
||||
key = event.key() +12;
|
||||
key = event.key();
|
||||
vel = event.velocity();
|
||||
|
||||
voice = popVoice();
|
||||
@@ -316,7 +315,7 @@ bool OpulenzInstrument::handleMidiEvent( const MidiEvent& event, const TimePos&
|
||||
}
|
||||
break;
|
||||
case MidiNoteOff:
|
||||
key = event.key() +12;
|
||||
key = event.key();
|
||||
for(voice=0; voice<OPL2_VOICES; ++voice) {
|
||||
if( voiceNote[voice] == key ) {
|
||||
theEmulator->write(0xA0+voice, fnums[key] & 0xff);
|
||||
@@ -328,7 +327,7 @@ bool OpulenzInstrument::handleMidiEvent( const MidiEvent& event, const TimePos&
|
||||
velocities[key] = 0;
|
||||
break;
|
||||
case MidiKeyPressure:
|
||||
key = event.key() +12;
|
||||
key = event.key();
|
||||
vel = event.velocity();
|
||||
if( velocities[key] != 0) {
|
||||
velocities[key] = vel;
|
||||
|
||||
@@ -824,8 +824,8 @@ QString XpressiveHelpView::s_helpText=
|
||||
"<h4>Available variables:</h4><br>"
|
||||
"<b>t</b> - Time in seconds.<br>"
|
||||
"<b>f</b> - Note's pitched frequency. Available only in the output expressions.<br>"
|
||||
"<b>key</b> - Note's keyboard key. 0 denotes C0, 48 denotes C4, 96 denotes C8. Available only in the output expressions.<br>"
|
||||
"<b>bnote</b> - Base note. By default it is 57 which means A5, unless you change it.<br>"
|
||||
"<b>key</b> - Note's keyboard key. 0 denotes C-1, 60 denotes C4, 127 denotes G9. Available only in the output expressions.<br>"
|
||||
"<b>bnote</b> - Base note. By default it is 69 which means A4, unless you change it.<br>"
|
||||
"<b>srate</b> - Sample rate. In wave expression it returns the wave's number of samples.<br>"
|
||||
"<b>tempo</b> - Song's Tempo. Available only in the output expressions.<br>"
|
||||
"<b>v</b> - Note's volume. Note that the output is already multiplied by the volume. Available only in the output expressions.<br>"
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "Note.h"
|
||||
#include "CustomTextKnob.h"
|
||||
#include "SubWindow.h"
|
||||
#include "AutomatableModel.h"
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#define BUILD_REMOTE_PLUGIN_CLIENT
|
||||
|
||||
#include "Note.h"
|
||||
#include "RemotePlugin.h"
|
||||
#include "RemoteZynAddSubFx.h"
|
||||
#include "LocalZynAddSubFx.h"
|
||||
|
||||
Reference in New Issue
Block a user