⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 studiocontrol.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: *//*    Rosegarden    A MIDI and audio sequencer and musical notation editor.     This program is Copyright 2000-2007        Guillaume Laurent   <glaurent@telegraph-road.org>,        Chris Cannam        <cannam@all-day-breakfast.com>,        Richard Bown        <richard.bown@ferventsoftware.com>     The moral rights of Guillaume Laurent, Chris Cannam, and Richard    Bown to claim authorship of this work have been asserted.     Other copyrights also apply to some parts of this work.  Please    see the AUTHORS file and individual file headers for details.     This program is free software; you can redistribute it and/or    modify it under the terms of the GNU General Public License as    published by the Free Software Foundation; either version 2 of the    License, or (at your option) any later version.  See the file    COPYING included with this distribution for more information.*/#include "StudioControl.h"#include "sound/Midi.h"#include "misc/Debug.h"#include "base/MidiProgram.h"#include "base/Profiler.h"#include "base/RealTime.h"#include "gui/application/RosegardenApplication.h"#include "sound/MappedCommon.h"#include "sound/MappedComposition.h"#include "sound/MappedEvent.h"#include "sound/MappedInstrument.h"#include "sound/MappedStudio.h"#include <qcstring.h>#include <qdatastream.h>#include <qstring.h>namespace Rosegarden{MappedObjectIdStudioControl::createStudioObject(MappedObject::MappedObjectType type){Profiler profiler("StudioControl::createStudioObject", true);int value = -1;QByteArray data;QCString replyType;QByteArray replyData;QDataStream streamOut(data, IO_WriteOnly);streamOut << (int)type;if (!rgapp->sequencerCall("createMappedObject(int)",                          replyType, replyData, data)){    SEQMAN_DEBUG << "createStudioObject - "    << "failed to contact Rosegarden sequencer"    << endl;} else{    QDataStream streamIn(replyData, IO_ReadOnly);    streamIn >> value;}return value;}boolStudioControl::destroyStudioObject(MappedObjectId id){    Profiler profiler("StudioControl::destroyStudioObject", true);    int value = 0;    QByteArray data;    QCString replyType;    QByteArray replyData;    QDataStream streamOut(data, IO_WriteOnly);    streamOut << int(id);    if (!rgapp->sequencerCall("destroyMappedObject(int)",                              replyType, replyData, data)) {        SEQMAN_DEBUG << "destroyStudioObject - "        << "failed to contact Rosegarden sequencer"        << endl;    } else {        QDataStream streamIn(replyData, IO_ReadOnly);        streamIn >> value;    }    if (value == 1)        return true;    else        return false;}MappedObjectPropertyListStudioControl::getStudioObjectProperty(MappedObjectId id,                                       const MappedObjectProperty &property){    Profiler profiler("StudioControl::getStudioObjectProperty", true);    MappedObjectPropertyList list;    QByteArray data;    QCString replyType;    QByteArray replyData;    QDataStream streamOut(data, IO_WriteOnly);    streamOut << (int)id;    streamOut << QString(property);    if (!rgapp->sequencerCall("getPropertyList(int, QString)",                              replyType, replyData, data)) {        SEQMAN_DEBUG << "getStudioObjectProperty - "        << "failed to contact Rosegarden sequencer"        << endl;    } else {        QDataStream streamIn(replyData, IO_ReadOnly);        streamIn >> list;    }    return list;}boolStudioControl::setStudioObjectProperty(MappedObjectId id,                                       const MappedObjectProperty &property,                                       MappedObjectValue value){    Profiler profiler("StudioControl::setStudioObjectProperty(float)", true);    QByteArray data;    QDataStream streamOut(data, IO_WriteOnly);    streamOut << (int)id;    streamOut << (QString)property;    streamOut << (float)value;    rgapp->sequencerSend("setMappedProperty(int, QString, float)", data);    return true;}boolStudioControl::setStudioObjectProperties(const MappedObjectIdList &ids,        const MappedObjectPropertyList &properties,        const MappedObjectValueList &values){    Profiler profiler("StudioControl::setStudioObjectProperties(floats)", true);    QByteArray data;    QDataStream streamOut(data, IO_WriteOnly);    streamOut << ids;    streamOut << properties;    streamOut << values;    rgapp->sequencerSend("setMappedProperties(MappedObjectIdList, MappedObjectPropertyList, MappedObjectValueList)", data);    return true;}boolStudioControl::setStudioObjectProperty(MappedObjectId id,                                       const MappedObjectProperty &property,                                       const QString &value){    Profiler profiler("StudioControl::setStudioObjectProperty(string)", true);    QByteArray data;    QDataStream streamOut(data, IO_WriteOnly);    streamOut << (int)id;    streamOut << (QString)property;    streamOut << (QString)value;    rgapp->sequencerSend("setMappedProperty(int, QString, QString)", data);    return true;}boolStudioControl::setStudioObjectPropertyList(MappedObjectId id,        const MappedObjectProperty &property,        const MappedObjectPropertyList &values){    Profiler profiler("StudioControl::setStudioObjectPropertyList", true);    QByteArray data;    QDataStream streamOut(data, IO_WriteOnly);    streamOut << (int)id;    streamOut << (QString)property;    streamOut << values;    RG_DEBUG << "StudioControl::setStudioObjectPropertyList: " << values.size() << " values for property " << property << endl;    rgapp->sequencerSend("setMappedPropertyList(int, QString, MappedObjectPropertyList)",                         data);    return true;}MappedObjectIdStudioControl::getStudioObjectByType(MappedObject::MappedObjectType type){    Profiler profiler("StudioControl::getStudioObjectByType", true);    int value = -1;    QByteArray data;    QCString replyType;    QByteArray replyData;    QDataStream streamOut(data, IO_WriteOnly);    streamOut << (int)type;    if (!rgapp->sequencerCall("getMappedObjectId(int)",                              replyType, replyData, data)) {        SEQMAN_DEBUG << "getStudioObjectByType - "        << "failed to contact Rosegarden sequencer"        << endl;    } else {        QDataStream streamIn(replyData, IO_ReadOnly);        streamIn >> value;    }    return value;}voidStudioControl::setStudioPluginPort(MappedObjectId pluginId,                                   unsigned long portId,                                   MappedObjectValue value){    Profiler profiler("StudioControl::setStudioPluginPort", true);    QByteArray data;    QDataStream streamOut(data, IO_WriteOnly);    // Use new MappedEvent interface    //    streamOut << (int)pluginId;    streamOut << (unsigned long)portId;    streamOut << (float)value;    rgapp->sequencerSend("setMappedPort(int, unsigned long int, float)", data);}MappedObjectValueStudioControl::getStudioPluginPort(MappedObjectId pluginId,                                   unsigned long portId){    Profiler profiler("StudioControl::getStudioPluginPort", true);    float value = 0.0;    QByteArray data;    QCString replyType;    QByteArray replyData;    QDataStream streamOut(data, IO_WriteOnly);    streamOut << (int)pluginId;    streamOut << (unsigned long)portId;    if (!rgapp->sequencerCall("getMappedPort(int, unsigned long int)",                              replyType, replyData, data)) {        SEQMAN_DEBUG << "getStudioPluginPort - "        << "failed to contact Rosegarden sequencer"        << endl;    } else {        QDataStream streamIn(replyData, IO_ReadOnly);        streamIn >> value;    }    return value;}MappedObjectPropertyListStudioControl::getPluginInformation(){    MappedObjectPropertyList list;    QByteArray data;    QCString replyType;    QByteArray replyData;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -