MCPcopy Create free account
hub / github.com/VASTDynamics/Vaporizer2 / nextNote

Method nextNote

VASTvaporizer/Source/Engine/VASTSingleNote.cpp:1072–1129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1070}
1071
1072void CVASTSingleNote::nextNote(bool legato) {
1073 m_Set->sendStatusMessage("------CVASTSingleNote::nextNote Voice#, note#", mVoiceNo, m_uMIDINoteNext);
1074 m_uChannel = m_uChannelNext;
1075 m_uMIDINote = m_uMIDINoteNext;
1076 m_uVelocity = m_uVelocityNext;
1077
1078 struct timeval tp;
1079 m_Set->_gettimeofday(&tp);
1080 m_startPlayTimestamp = static_cast<ULong64_t>(tp.tv_sec) * 1000 + tp.tv_usec / 1000;
1081
1082 m_Set->iAftertouch[getVoiceNo()] = -1;
1083 m_Set->iAftertouchMidiNote[getVoiceNo()] = -1;
1084
1085 if (legato) {
1086 for (int bank = 0; bank < 4; bank++)
1087 m_Oscillator[bank].noteOn(m_uChannel, m_uMIDINote, m_uVelocity);
1088
1089 m_OscillatorNoise.noteOn(m_uChannel, m_uMIDINote, m_uVelocity);
1090 m_VCA.noteOn(m_startPlayTimestamp, true); //but in sustain phase!!
1091 }
1092 else {
1093 resetSmoothers();
1094 m_VCF[0]->resetSmoothers();
1095 m_VCF[1]->resetSmoothers();
1096 m_VCF[2]->resetSmoothers();
1097
1098 for (int bank = 0; bank < 4; bank++) {
1099 //New start all oscs!
1100
1101 m_Oscillator[bank].noteOn(m_uChannel, m_uMIDINote, m_uVelocity);
1102 for (int i = 0; i < C_MAX_PARALLEL_OSC; i++) {
1103 //VDBG("resynch voice: "+ String(mVoiceNo));
1104 m_Oscillator[bank].resynch(i, false); //re-synch - immendiately
1105 //VDBG("resynch");
1106 }
1107
1108 //CHECK
1109 ///m_Poly->m_OscBank[bank].setChangedFlagOsc(); //redraw on new note??
1110
1111 m_iCurCycleSamples[bank] = 0;
1112 m_iLastCycleSamples[bank] = 0;
1113 }
1114 m_OscillatorNoise.noteOn(m_uChannel, m_uMIDINote, m_uVelocity);
1115 m_OscillatorNoise.resynch(0, false); //re-synch - immediately
1116
1117 m_fOscADivisor = *m_Set->m_State->m_iNumOscs_OscA;
1118 m_fOscAMaxPeak = 1.0;
1119 m_fOscBDivisor = *m_Set->m_State->m_iNumOscs_OscB;
1120 m_fOscBMaxPeak = 1.0;
1121 m_fOscCDivisor = *m_Set->m_State->m_iNumOscs_OscC;
1122 m_fOscCMaxPeak = 1.0;
1123 m_fOscDDivisor = *m_Set->m_State->m_iNumOscs_OscD;
1124 m_fOscDMaxPeak = 1.0;
1125 m_fNoiseDivisor = *m_Set->m_State->m_bNoiseOnOff; //bool but ok!
1126 m_fNoiseMaxPeak = 1.0;
1127 m_VCA.noteOn(m_startPlayTimestamp, false);
1128 }
1129}

Callers

nothing calls this directly

Calls 6

getVoiceNoFunction · 0.85
sendStatusMessageMethod · 0.80
_gettimeofdayMethod · 0.80
resynchMethod · 0.80
noteOnMethod · 0.45
resetSmoothersMethod · 0.45

Tested by

no test coverage detected