From: Mathias G. <lun...@us...> - 2009-10-25 19:22:30
|
Update of /cvsroot/lmuse/muse/muse/remote In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4367/muse/remote Modified Files: Tag: REL07 pyapi.cpp pyapi.h Log Message: see changelog Index: pyapi.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/remote/Attic/pyapi.h,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** pyapi.h 19 Oct 2009 21:10:25 -0000 1.1.2.4 --- pyapi.h 25 Oct 2009 19:22:14 -0000 1.1.2.5 *************** *** 12,24 **** { public: ! enum EventType { SONG_UPDATE=0, SONGLEN_CHANGE, SONG_POSCHANGE, SONG_SETPLAY, SONG_SETSTOP, SONG_REWIND }; QPybridgeEvent( QPybridgeEvent::EventType _type, int _p1=0, int _p2=0); EventType getType() { return type; } int getP1() { return p1; } int getP2() { return p2; } private: EventType type; int p1, p2; }; --- 12,27 ---- { public: ! enum EventType { SONG_UPDATE=0, SONGLEN_CHANGE, SONG_POSCHANGE, SONG_SETPLAY, SONG_SETSTOP, SONG_REWIND, SONG_SETMUTE }; QPybridgeEvent( QPybridgeEvent::EventType _type, int _p1=0, int _p2=0); EventType getType() { return type; } int getP1() { return p1; } int getP2() { return p2; } + void setS1(QString in) { s1 = in; } + const QString& getS1() { return s1; } private: EventType type; int p1, p2; + QString s1; }; Index: pyapi.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/remote/Attic/pyapi.cpp,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -C2 -d -r1.1.2.9 -r1.1.2.10 *** pyapi.cpp 22 Oct 2009 17:35:01 -0000 1.1.2.9 --- pyapi.cpp 25 Oct 2009 19:22:14 -0000 1.1.2.10 *************** *** 492,495 **** --- 492,537 ---- } //------------------------------------------------------------ + // getMute trackname + //------------------------------------------------------------ + PyObject* getMute(PyObject*, PyObject* args) + { + const char* trackname; + if (!PyArg_ParseTuple(args, "s", &trackname)) { + return NULL; + } + + Track* track = song->findTrack(QString(trackname)); + if (track == NULL) + return NULL; + + return Py_BuildValue("b", track->isMute()); + } + //------------------------------------------------------------ + // setMute (trackname, boolean) + //------------------------------------------------------------ + PyObject* setMute(PyObject*, PyObject* args) + { + const char* trackname; + bool muted; + + if (!PyArg_ParseTuple(args, "sb", &trackname, &muted)) { + return NULL; + } + + Track* track = song->findTrack(QString(trackname)); + if (track == NULL) + return NULL; + + int mutedint = 1; + if (muted == false) + mutedint = 0; + + QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETMUTE, mutedint); + pyevent->setS1(trackname); + QApplication::postEvent(song, pyevent); + return Py_None; + } + + //------------------------------------------------------------ // Global method definitions for MusE:s Python API // *************** *** 518,521 **** --- 560,566 ---- { "getSongLen", getSongLen, METH_VARARGS, "Get length of song (in ticks)" }, + { "getMute", getMute, METH_VARARGS, "Get track mute property (if track is played or not)" }, + { "setMute", setMute, METH_VARARGS, "Set track mute property (if track should be played or not)" }, + { "setMidiTrackParameter", setMidiTrackParameter, METH_VARARGS, "Set transposition, velocity, compression or delay on track level" }, |