Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void FaderportFunctions::SendTextToScribble(int scribbleId, int lineNumber, int alignment, std::string txt) {
- if (m_midiout == NULL) return;
- const char* text = txt.c_str();
- struct
- {
- MIDI_event_t evt;
- char data[512];
- }
- poo;
- poo.evt.frame_offset = 0;
- poo.evt.size = 0;
- poo.evt.midi_message[poo.evt.size++] = 0xF0;
- poo.evt.midi_message[poo.evt.size++] = 0x00;
- poo.evt.midi_message[poo.evt.size++] = 0x01;
- poo.evt.midi_message[poo.evt.size++] = 0x06;
- poo.evt.midi_message[poo.evt.size++] = m_states->GetIsFP8() ? FP8 : FP16;
- //<SysExHdr> 12, xx, yy, zz, tx,tx,tx,... F7
- poo.evt.midi_message[poo.evt.size++] = SCRIBBLE_SEND_STRING;
- poo.evt.midi_message[poo.evt.size++] = 0x00 + scribbleId; // xx strip id
- poo.evt.midi_message[poo.evt.size++] = 0x00 + lineNumber; // yy line number 0-3
- poo.evt.midi_message[poo.evt.size++] = 0x0000000 + alignment; // zz alignment flag 0000000=centre
- int length = strlen(text);
- if (length > 200) length = 200;
- int cnt = 0;
- while (cnt < length)
- {
- poo.evt.midi_message[poo.evt.size++] = *text++; // tx text in ASCII format
- cnt++;
- }
- poo.evt.midi_message[poo.evt.size++] = END;
- m_midiout->SendMsg(&poo.evt, -1);
- }
- int CSurf_Faderport::CalculateMeter(MediaTrack* track, int surface_displayid, int VU_BOTTOM, double decay) {
- if (!(GetPlayState() & 1)) return -1;
- double pp = VAL2DB((Track_GetPeakInfo(track, 0) + Track_GetPeakInfo(track, 1)) * 0.5);
- if (m_mcu_meterpos[surface_displayid] > -VU_BOTTOM * 2) m_mcu_meterpos[surface_displayid] -= decay;
- if (pp < m_mcu_meterpos[surface_displayid]) return -1;
- m_mcu_meterpos[surface_displayid] = pp;
- //int v = 0xd; // 0xe turns on clip indicator, 0xf turns it off
- int v = 0x0;
- if (pp < 0.0) pp < -VU_BOTTOM ? v = 0x0 : v = (int)((pp + VU_BOTTOM) * 13.0 / VU_BOTTOM) * 10;
- return v;
- }
- // Update the meterbar on the display
- void CSurf_Faderport::UpdateSurfaceMeter(int surface_displayid, int v) {
- (surface_displayid > 7) ? m_midiout->Send(PEAK_METER_9_16 + (surface_displayid & 7), v, 0, -1) : m_midiout->Send(PEAK_METER_1_8 + surface_displayid, v, 0, -1);
- }
- #define PEAK_METER_1_8 0xD0
- #define PEAK_METER_9_16 0xC0
- #define REDUCTION_METER_1_8 0xD9
- #define REDUCTION_METER_9_16 0xC9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement