default pan command for InstrumentCore

master
zetaPRIME 2019-07-23 07:52:56 -04:00
parent b1449ebcf6
commit 1b8eeffbcf
3 changed files with 8 additions and 1 deletions

2
notes
View File

@ -36,7 +36,7 @@ TODO {
distortion effect
single-selection sampler
global (default) pan (PXX) for InstrumentCore
- global (default) pan (PXX) for InstrumentCore
add ,XX support to global tempo
}

View File

@ -37,6 +37,7 @@ void InstrumentCore::reset() {
time = 0;
volume = 1.0;
pan = 0.0;
}
void InstrumentCore::process(Node* n) {
@ -102,6 +103,7 @@ void InstrumentCore::process(CommandPort* i, AudioPort* o) {
forceRetrigger:
note.note = n;
note.time = note.adsrTime = -smpTime; // compensate for first-advance
note.pan = pan;
if (onNoteOn) onNoteOn(note);
}
} else { // existing note
@ -194,6 +196,10 @@ void InstrumentCore::process(CommandPort* i, AudioPort* o) {
volume = (1.0*v) / 255.0;
continue;
}
case 'P': {
pan = std::clamp((1.0*static_cast<int8_t>(v)) / 127.0, -1.0, 1.0);
continue;
}
default:
break;
}

View File

@ -78,6 +78,7 @@ namespace Xybrid::NodeLib {
};
double volume = 1.0;
double pan = 0.0;
std::unordered_map<uint16_t, Note> activeNotes;
std::unordered_multimap<uint16_t, Tween> activeTweens;