Update of /cvsroot/lmuse/muse/muse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1395 Modified Files: audio.cpp audio.h ctrl.cpp midictrl.cpp seqmsg.cpp song.cpp song.h track.cpp undo.cpp undo.h Log Message: misc Index: audio.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/audio.cpp,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** audio.cpp 23 Sep 2004 18:28:06 -0000 1.72 --- audio.cpp 26 Sep 2004 20:42:36 -0000 1.73 *************** *** 43,47 **** "SEQM_MIDI_CTRL", "SEQM_MIDI_MASTER_VOLUME", "SEQM_PLAY_MIDI_EVENT", - "SEQM_SCAN_ALSA_MIDI_PORTS", "AUDIO_RECORD", "AUDIO_ROUTEADD", "AUDIO_ROUTEREMOVE", --- 43,46 ---- *************** *** 50,55 **** "AUDIO_SET_PREFADER", "AUDIO_SET_CHANNELS", "MS_PROCESS", "MS_STOP", "MS_SET_RTC", - // "MS_UPDATE_POLL_FD", "SEQM_IDLE", "SEQM_SEEK", }; --- 49,54 ---- "AUDIO_SET_PREFADER", "AUDIO_SET_CHANNELS", "MS_PROCESS", "MS_STOP", "MS_SET_RTC", "SEQM_IDLE", "SEQM_SEEK", + "SEQM_ADD_CTRL", "SEQM_REMOVE_CTRL" }; *************** *** 383,387 **** switch(msg->id) { case AUDIO_RECORD: ! msg->snode->setRecordFlag2(msg->ival); break; case AUDIO_ROUTEADD: --- 382,386 ---- switch(msg->id) { case AUDIO_RECORD: ! msg->track->setRecordFlag2(msg->ival); break; case AUDIO_ROUTEADD: *************** *** 392,402 **** break; case AUDIO_SET_PREFADER: ! msg->snode->setPrefader(msg->ival); break; case AUDIO_SET_CHANNELS: ! msg->snode->setChannels(msg->ival); break; case AUDIO_ADDPLUGIN: ! msg->snode->addPlugin(msg->plugin, msg->ival); break; --- 391,401 ---- break; case AUDIO_SET_PREFADER: ! ((AudioTrack*)msg->track)->setPrefader(msg->ival); break; case AUDIO_SET_CHANNELS: ! msg->track->setChannels(msg->ival); break; case AUDIO_ADDPLUGIN: ! ((AudioTrack*)msg->track)->addPlugin(msg->plugin, msg->ival); break; *************** *** 426,432 **** panic(); break; - case SEQM_SCAN_ALSA_MIDI_PORTS: - alsaScanMidiPorts(); - break; case SEQM_ADD_TEMPO: case SEQM_REMOVE_TEMPO: --- 425,428 ---- Index: track.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/track.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** track.cpp 24 Sep 2004 16:25:50 -0000 1.42 --- track.cpp 26 Sep 2004 20:42:37 -0000 1.43 *************** *** 391,395 **** iCtrl i = controller()->find(id); if (i == controller()->end()) { ! printf("AudioTrack::changeControllerVal(): id 0x%x not found, listsize %d\n", id, controller()->size()); return; --- 391,395 ---- iCtrl i = controller()->find(id); if (i == controller()->end()) { ! printf("Track::changeControllerVal(): id 0x%x not found, listsize %d\n", id, controller()->size()); return; *************** *** 407,411 **** iCtrl i = controller()->find(id); if (i == controller()->end()) { ! printf("AudioTrack::removeControllerVal(): id 0x%x not found, listsize %d\n", id, controller()->size()); return; --- 407,411 ---- iCtrl i = controller()->find(id); if (i == controller()->end()) { ! printf("Track::removeControllerVal(): id 0x%x not found, listsize %d\n", id, controller()->size()); return; Index: undo.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/undo.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** undo.cpp 23 Sep 2004 18:28:06 -0000 1.17 --- undo.cpp 26 Sep 2004 20:42:37 -0000 1.18 *************** *** 65,68 **** --- 65,70 ---- case AddSig: case SwapTrack: + case AddCtrl: + case RemoveCtrl: break; } *************** *** 170,173 **** --- 172,178 ---- updateFlags |= SC_SIG; break; + case UndoOp::AddCtrl: + case UndoOp::RemoveCtrl: + break; } } *************** *** 251,254 **** --- 256,262 ---- updateFlags |= SC_SIG; break; + case UndoOp::AddCtrl: + case UndoOp::RemoveCtrl: + break; } } *************** *** 332,335 **** --- 340,356 ---- } + void Song::undoOp(UndoOp::UndoType type, Track* t, int id, unsigned time, + float f1, float f2) + { + UndoOp i; + i.type = type; + i.track = t; + i.a = id; + i.time = time; + i.val1 = f1; + i.val2 = f2; + addUndo(i); + } + //--------------------------------------------------------- // addUndo *************** *** 365,368 **** --- 386,392 ---- insertTrack1(i->oTrack, i->trackno); break; + case UndoOp::AddCtrl: + case UndoOp::RemoveCtrl: + break; default: break; *************** *** 396,399 **** --- 420,426 ---- i->oPart->track()->partListChanged(); break; + case UndoOp::AddCtrl: + case UndoOp::RemoveCtrl: + break; default: break; *************** *** 424,427 **** --- 451,457 ---- removeTrack1(i->oTrack); break; + case UndoOp::AddCtrl: + case UndoOp::RemoveCtrl: + break; default: break; *************** *** 454,457 **** --- 484,490 ---- i->oPart->track()->partListChanged(); break; + case UndoOp::AddCtrl: + case UndoOp::RemoveCtrl: + break; default: break; Index: audio.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/audio.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** audio.h 23 Sep 2004 18:28:06 -0000 1.34 --- audio.h 26 Sep 2004 20:42:37 -0000 1.35 *************** *** 58,67 **** SEQM_ADD_PART, SEQM_REMOVE_PART, SEQM_CHANGE_PART, SEQM_ADD_EVENT, SEQM_REMOVE_EVENT, SEQM_CHANGE_EVENT, ! SEQM_ADD_TEMPO, SEQM_SET_TEMPO, SEQM_REMOVE_TEMPO, SEQM_ADD_SIG, SEQM_SET_GLOBAL_TEMPO, SEQM_UNDO, SEQM_REDO, SEQM_RESET_DEVICES, SEQM_INIT_DEVICES, SEQM_PANIC, SEQM_MIDI_LOCAL_OFF, - SEQM_SCAN_ALSA_MIDI_PORTS, // AUDIO_RECORD, --- 58,67 ---- SEQM_ADD_PART, SEQM_REMOVE_PART, SEQM_CHANGE_PART, SEQM_ADD_EVENT, SEQM_REMOVE_EVENT, SEQM_CHANGE_EVENT, ! SEQM_ADD_TEMPO, SEQM_SET_TEMPO, SEQM_REMOVE_TEMPO, ! SEQM_ADD_SIG, SEQM_SET_GLOBAL_TEMPO, SEQM_UNDO, SEQM_REDO, SEQM_RESET_DEVICES, SEQM_INIT_DEVICES, SEQM_PANIC, SEQM_MIDI_LOCAL_OFF, // AUDIO_RECORD, *************** *** 73,76 **** --- 73,78 ---- MS_PROCESS, MS_STOP, MS_SET_RTC, SEQM_IDLE, SEQM_SEEK, + + SEQM_ADD_CTRL, SEQM_REMOVE_CTRL }; *************** *** 84,94 **** int serialNo; SndFile* downmix; - AudioTrack* snode; - AudioTrack* dnode; Route sroute, droute; AudioDevice* device; int ival; int iival; ! double dval; PluginI* plugin; SynthI* synth; --- 86,94 ---- int serialNo; SndFile* downmix; Route sroute, droute; AudioDevice* device; int ival; int iival; ! float fval1, fval2; PluginI* plugin; SynthI* synth; *************** *** 102,105 **** --- 102,106 ---- int a, b, c; Pos pos; + unsigned time; }; *************** *** 208,212 **** void msgDeleteEvent(Event&, Part*, bool u = true); void msgChangeEvent(Event&, Event&, Part*, bool u = true); - void msgScanAlsaMidiPorts(); void msgAddTempo(int tick, int tempo, bool doUndoFlag = true); void msgSetTempo(int tick, int tempo, bool doUndoFlag = true); --- 209,212 ---- *************** *** 237,240 **** --- 237,242 ---- void msgIdle(bool); void msgBounce(); + void msgAddController(Track*, int id, unsigned time, float val); + void msgRemoveController(Track*, int id, unsigned time); void msgPlayMidiEvent(const MidiPlayEvent* event); Index: undo.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/undo.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** undo.h 14 Sep 2004 18:17:24 -0000 1.7 --- undo.h 26 Sep 2004 20:42:37 -0000 1.8 *************** *** 28,32 **** AddTempo, DeleteTempo, AddSig, ! SwapTrack }; UndoType type; --- 28,33 ---- AddTempo, DeleteTempo, AddSig, ! SwapTrack, ! AddCtrl, RemoveCtrl }; UndoType type; *************** *** 60,63 **** --- 61,70 ---- int nVal; }; + struct { + Track* track; + int id; + unsigned time; + float val1, val2; + }; }; Event oEvent; Index: seqmsg.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/seqmsg.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** seqmsg.cpp 23 Sep 2004 18:28:06 -0000 1.39 --- seqmsg.cpp 26 Sep 2004 20:42:37 -0000 1.40 *************** *** 60,64 **** { if (doUndo) ! song->startUndo(); sendMsg(m); if (doUndo) --- 60,64 ---- { if (doUndo) ! song->startUndo(); sendMsg(m); if (doUndo) *************** *** 131,135 **** AudioMsg msg; msg.id = AUDIO_ADDPLUGIN; ! msg.snode = node; msg.ival = idx; msg.plugin = plugin; --- 131,135 ---- AudioMsg msg; msg.id = AUDIO_ADDPLUGIN; ! msg.track = node; msg.ival = idx; msg.plugin = plugin; *************** *** 149,153 **** AudioMsg msg; msg.id = AUDIO_RECORD; ! msg.snode = node; msg.ival = int(val); sendMsg(&msg); --- 149,153 ---- AudioMsg msg; msg.id = AUDIO_RECORD; ! msg.track = node; msg.ival = int(val); sendMsg(&msg); *************** *** 162,166 **** AudioMsg msg; msg.id = AUDIO_SET_PREFADER; ! msg.snode = node; msg.ival = val; sendMsg(&msg); --- 162,166 ---- AudioMsg msg; msg.id = AUDIO_SET_PREFADER; ! msg.track = node; msg.ival = val; sendMsg(&msg); *************** *** 227,231 **** AudioMsg msg; msg.id = AUDIO_SET_CHANNELS; ! msg.snode = node; msg.ival = n; sendMsg(&msg); --- 227,231 ---- AudioMsg msg; msg.id = AUDIO_SET_CHANNELS; ! msg.track = node; msg.ival = n; sendMsg(&msg); *************** *** 550,564 **** //--------------------------------------------------------- - // msgScanAlsaMidiPorts - //--------------------------------------------------------- - - void Audio::msgScanAlsaMidiPorts() - { - AudioMsg msg; - msg.id = SEQM_SCAN_ALSA_MIDI_PORTS; - sendMessage(&msg, false); - } - - //--------------------------------------------------------- // msgResetMidiDevices //--------------------------------------------------------- --- 550,553 ---- *************** *** 644,645 **** --- 633,670 ---- } + //--------------------------------------------------------- + // msgAddController + // add controller value + //--------------------------------------------------------- + + void Audio::msgAddController(Track* track, int id, unsigned time, float val) + { + AudioMsg msg; + msg.id = SEQM_ADD_CTRL; + msg.track = track; + msg.a = id; + msg.time = time; + msg.fval1 = val; + song->startUndo(); + song->undoOp(UndoOp::AddCtrl, track, id, time, val, 0.0f); + sendMessage(&msg, false); + song->endUndo(0); + } + + //--------------------------------------------------------- + // msgRemoveController + //--------------------------------------------------------- + + void Audio::msgRemoveController(Track* track, int id, unsigned time) + { + AudioMsg msg; + msg.id = SEQM_REMOVE_CTRL; + msg.track = track; + msg.a = id; + msg.time = time; + song->startUndo(); + song->undoOp(UndoOp::RemoveCtrl, track, id, time, 0.0f, 0.0f); + sendMessage(&msg, false); + song->endUndo(0); + } + Index: ctrl.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/ctrl.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ctrl.cpp 24 Sep 2004 16:25:50 -0000 1.8 --- ctrl.cpp 26 Sep 2004 20:42:37 -0000 1.9 *************** *** 130,135 **** //--------------------------------------------------------- ! void Ctrl::del(unsigned /* frame*/) { } --- 130,137 ---- //--------------------------------------------------------- ! void Ctrl::del(unsigned frame) { + iCtrlVal e = find(frame); + erase(e); } Index: song.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/song.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** song.h 23 Sep 2004 18:28:06 -0000 1.47 --- song.h 26 Sep 2004 20:42:37 -0000 1.48 *************** *** 295,298 **** --- 295,299 ---- void undoOp(UndoOp::UndoType, int channel, int ctrl, int oval, int nval); void undoOp(UndoOp::UndoType, Part* oPart, Part* nPart); + void undoOp(UndoOp::UndoType, Track*, int, unsigned, float, float); bool doUndo1(); void doUndo2(); Index: song.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/song.cpp,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** song.cpp 24 Sep 2004 16:25:50 -0000 1.79 --- song.cpp 26 Sep 2004 20:42:37 -0000 1.80 *************** *** 1290,1293 **** --- 1290,1303 ---- break; + case SEQM_ADD_CTRL: + printf("RT: song: add ctrl\n"); + msg->track->changeControllerVal(msg->a, msg->time, msg->fval1); + break; + + case SEQM_REMOVE_CTRL: + printf("RT: song: remove ctrl\n"); + msg->track->removeControllerVal(msg->a, msg->time); + break; + default: printf("unknown seq message %d\n", msg->id); *************** *** 1908,1917 **** void Song::movePart(Part* oPart, unsigned pos, Track* track) { - startUndo(); Part* nPart = oPart->clone(); nPart->setTrack(track); nPart->setTick(pos); ! audio->msgChangePart(oPart, nPart, false); ! endUndo(SC_PART_MODIFIED); oPart->track()->partListChanged(); } --- 1918,1925 ---- void Song::movePart(Part* oPart, unsigned pos, Track* track) { Part* nPart = oPart->clone(); nPart->setTrack(track); nPart->setTick(pos); ! audio->msgChangePart(oPart, nPart, true); oPart->track()->partListChanged(); } *************** *** 2104,2108 **** void Song::addControllerVal(Track* t, int id, unsigned time, float val) { ! t->changeControllerVal(id, time, val); } --- 2112,2117 ---- void Song::addControllerVal(Track* t, int id, unsigned time, float val) { ! audio->msgAddController(t, id, time, val); ! // t->changeControllerVal(id, time, val); } *************** *** 2113,2117 **** void Song::removeControllerVal(Track* t, int id, unsigned time) { ! t->removeControllerVal(id, time); } --- 2122,2127 ---- void Song::removeControllerVal(Track* t, int id, unsigned time) { ! audio->msgRemoveController(t, id, time); ! // t->removeControllerVal(id, time); } Index: midictrl.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/midictrl.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** midictrl.cpp 18 Sep 2004 16:14:36 -0000 1.23 --- midictrl.cpp 26 Sep 2004 20:42:37 -0000 1.24 *************** *** 140,144 **** if (ctrl < 0x10000) return QString(ctrlName[ctrl]); ! return QString("?N?"); } --- 140,162 ---- if (ctrl < 0x10000) return QString(ctrlName[ctrl]); ! QString s("?N?"); ! switch(ctrl) { ! case CTRL_PITCH: ! s = "Pitch"; ! break; ! case CTRL_PROGRAM: ! s = "ProgramChange"; ! break; ! case CTRL_VELOCITY: ! s = "Velocity"; ! break; ! case CTRL_MASTER_VOLUME: ! s = "MasterVolume"; ! break; ! default: ! printf("midiCtrlName unknown %x\n", ctrl); ! break; ! } ! return s; } |