📄 studiocontrol.cpp
字号:
if (!rgapp->sequencerCall("getPluginInformation()", replyType, replyData, data)) { SEQMAN_DEBUG << "getPluginInformation - " << "failed to contact Rosegarden sequencer" << endl; } else { QDataStream streamIn(replyData, IO_ReadOnly); streamIn >> list; } return list;}QStringStudioControl::getPluginProgram(MappedObjectId id, int bank, int program){ QByteArray data; QCString replyType; QByteArray replyData; QDataStream streamOut(data, IO_WriteOnly); streamOut << (int)id; streamOut << (int)bank; streamOut << (int)program; QString programName; if (!rgapp->sequencerCall("getPluginProgram(int, int, int)", replyType, replyData, data)) { SEQMAN_DEBUG << "getPluginProgram - " << "failed to contact Rosegarden sequencer" << endl; } else { QDataStream streamIn(replyData, IO_ReadOnly); streamIn >> programName; } return programName;}unsigned longStudioControl::getPluginProgram(MappedObjectId id, QString name){ QByteArray data; QCString replyType; QByteArray replyData; QDataStream streamOut(data, IO_WriteOnly); streamOut << (int)id; streamOut << name; unsigned long rv; if (!rgapp->sequencerCall("getPluginProgram(int, QString)", replyType, replyData, data)) { SEQMAN_DEBUG << "getPluginProgram - " << "failed to contact Rosegarden sequencer" << endl; } else { QDataStream streamIn(replyData, IO_ReadOnly); streamIn >> rv; } return rv;}voidStudioControl::connectStudioObjects(MappedObjectId id1, MappedObjectId id2){ Profiler profiler("StudioControl::connectStudioObjects", true); QByteArray data; QDataStream streamOut(data, IO_WriteOnly); streamOut << (int)id1; streamOut << (int)id2; if (!rgapp->sequencerSend("connectMappedObjects(int, int)", data)) { SEQMAN_DEBUG << "connectStudioObjects - " << "failed to contact Rosegarden sequencer" << endl; } return ;}voidStudioControl::disconnectStudioObjects(MappedObjectId id1, MappedObjectId id2){ Profiler profiler("StudioControl::disconnectStudioObjects", true); QByteArray data; QDataStream streamOut(data, IO_WriteOnly); streamOut << (int)id1; streamOut << (int)id2; if (!rgapp->sequencerSend("disconnectMappedObjects(int, int)", data)) { SEQMAN_DEBUG << "disconnectStudioObjects - " << "failed to contact Rosegarden sequencer" << endl; } return ;}voidStudioControl::disconnectStudioObject(MappedObjectId id){ Profiler profiler("StudioControl::disconnectStudioObject", true); QByteArray data; QDataStream streamOut(data, IO_WriteOnly); streamOut << (int)id; if (!rgapp->sequencerSend("disconnectMappedObject(int)", data)) { SEQMAN_DEBUG << "disconnectStudioObject - " << "failed to contact Rosegarden sequencer" << endl; } return ;}voidStudioControl::sendMappedEvent(const MappedEvent &mE){ Profiler profiler("StudioControl::sendMappedEvent", true); static MappedEvent mEs; mEs = mE; // just in case the passed mapped event has dubious // origins and taking its address isn't safe mEs.setPersistent(true); // to avoid that MappedComposition dtor try to free it MappedComposition mC; mC.insert(&mEs); StudioControl::sendMappedComposition(mC);}voidStudioControl::sendMappedComposition(const MappedComposition &mC){ Profiler profiler("StudioControl::sendMappedComposition", true); if (mC.size() == 0) return ; QCString replyType; QByteArray replyData; MappedComposition::const_iterator it = mC.begin(); for (; it != mC.end(); it++) { QByteArray data; QDataStream streamOut(data, IO_WriteOnly); streamOut << (*it); rgapp->sequencerSend("processMappedEvent(MappedEvent)", data); }}voidStudioControl::sendMappedInstrument(const MappedInstrument &mI){ Profiler profiler("StudioControl::sendMappedInstrument", true); QByteArray data; QDataStream streamOut(data, IO_WriteOnly); streamOut << (int)mI.getType(); streamOut << (unsigned char)mI.getChannel(); streamOut << (unsigned int)mI.getId(); rgapp->sequencerSend("setMappedInstrument(int, unsigned char, unsigned int)", data);}voidStudioControl::sendQuarterNoteLength(const RealTime &length){ Profiler profiler("StudioControl::sendQuarterNoteLength", true); QByteArray data; QDataStream streamOut(data, IO_WriteOnly); streamOut << (long)length.sec; streamOut << (long)length.nsec; rgapp->sequencerSend("setQuarterNoteLength(long int, long int)", data);}voidStudioControl::sendRPN(InstrumentId instrumentId, MidiByte paramMSB, MidiByte paramLSB, MidiByte /* controller */, MidiByte value){ Profiler profiler("StudioControl::sendRPN", true); MappedComposition mC; MappedEvent *mE = new MappedEvent(instrumentId, MappedEvent::MidiController, MIDI_CONTROLLER_RPN_2, paramMSB); mC.insert(mE); mE = new MappedEvent(instrumentId, MappedEvent::MidiController, MIDI_CONTROLLER_RPN_1, paramLSB); mC.insert(mE); mE = new MappedEvent(instrumentId, MappedEvent::MidiController, 6, // data value changed value); mC.insert(mE); // Null the controller using - this is "best practice" // mE = new MappedEvent(instrumentId, MappedEvent::MidiController, MIDI_CONTROLLER_RPN_2, MidiMaxValue); // null mC.insert(mE); mE = new MappedEvent(instrumentId, MappedEvent::MidiController, MIDI_CONTROLLER_RPN_1, MidiMaxValue); // null mC.insert(mE); StudioControl::sendMappedComposition(mC);}voidStudioControl::sendNRPN(InstrumentId instrumentId, MidiByte paramMSB, MidiByte paramLSB, MidiByte /* controller */, MidiByte value){ Profiler profiler("StudioControl::sendNRPN", true); MappedComposition mC; MappedEvent *mE = new MappedEvent(instrumentId, MappedEvent::MidiController, MIDI_CONTROLLER_NRPN_2, paramMSB); mC.insert(mE); mE = new MappedEvent(instrumentId, MappedEvent::MidiController, MIDI_CONTROLLER_NRPN_1, paramLSB); mC.insert(mE); mE = new MappedEvent(instrumentId, MappedEvent::MidiController, 6, // data value changed value); mC.insert(mE); // Null the controller using - this is "best practice" // mE = new MappedEvent(instrumentId, MappedEvent::MidiController, MIDI_CONTROLLER_RPN_2, MidiMaxValue); // null mC.insert(mE); mE = new MappedEvent(instrumentId, MappedEvent::MidiController, MIDI_CONTROLLER_RPN_1, MidiMaxValue); // null mC.insert(mE);}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -