Пример #1
0
void
MarkerRuler::slotEditMarker()
{
    Rosegarden::Marker* marker = getMarkerAtClickPosition();

    if (!marker) return;

    // I think the ruler should be doing all this stuff itself, or
    // emitting signals connected to a dedicated marker model object,
    // not just relying on the app object.  Same goes for practically
    // everything else we do.  Hey ho.  Having this here is
    // inconsistent with the other methods, so if anyone wants to move
    // it, be my guest.

    MarkerModifyDialog dialog(this, &m_doc->getComposition(), marker);
    if (dialog.exec() == QDialog::Accepted) {
        ModifyMarkerCommand *command =
            new ModifyMarkerCommand(&m_doc->getComposition(),
                                    marker->getID(),
                                    dialog.getOriginalTime(),
                                    dialog.getTime(),
                                    qstrtostr(dialog.getName()),
                                    qstrtostr(dialog.getDescription()));
        CommandHistory::getInstance()->addCommand(command);
    }
}
Пример #2
0
Event* Chord::getAsEvent(timeT absoluteTime) const
{
    Event *e = new Event(EventType, absoluteTime, 0, EventSubOrdering);
    e->set<String>(RootPropertyName, qstrtostr(m_root));
    e->set<String>(ExtPropertyName, qstrtostr(m_ext));
    e->set<String>(FingeringPropertyName, getFingering().toString());
    return e;
}
void
ControlParameterEditDialog::populate()
{
    m_nameEdit->setText(strtoqstr(m_control->getName()));

    m_description->setText(strtoqstr(m_control->getDescription()));
    m_controllerBox->setValue(int(m_control->getControllerValue()));

    QString hexValue;
    hexValue.sprintf("(0x%x)", m_control->getControllerValue());
    m_hexValue->setText(hexValue);

    m_minBox->setValue(m_control->getMin());
    m_maxBox->setValue(m_control->getMax());
    m_defaultBox->setValue(m_control->getDefault());

    int pos = 0, setItem = 0;
    ColourMap &colourMap = m_doc->getComposition().getGeneralColourMap();
    RCMap::const_iterator it;

    // I can't believe we never fixed this in all these years.  The way this was
    // structured, it was impossible for setItem to increment in order to arrive
    // at any useful value, so the color always came out "Default" 100% of the
    // time.
    for (it = colourMap.begin(); it != colourMap.end(); ++it) {
        pos++;
        if (m_control->getColourIndex() == it->first) setItem = (pos - 1);
    }

    m_colourCombo->setCurrentIndex(setItem);

    // set combo position
    m_ipbPosition->setCurrentIndex(m_control->getIPBPosition() + 1);

    // If the type has changed and there are no defaults then we have to
    // supply some.
    //
    if (qstrtostr(m_typeCombo->currentText()) == PitchBend::EventType ||
            qstrtostr(m_typeCombo->currentText()) == KeyPressure::EventType ||
            qstrtostr(m_typeCombo->currentText()) == ChannelPressure::EventType) {
        m_controllerBox->setEnabled(false);
        m_ipbPosition->setEnabled(false);
        m_colourCombo->setEnabled(false);
        m_hexValue->setEnabled(false);
        m_minBox->setEnabled(false);
        m_maxBox->setEnabled(false);
        m_defaultBox->setEnabled(false);
    } else if (qstrtostr(m_typeCombo->currentText()) == Controller::EventType) {
        m_controllerBox->setEnabled(true);
        m_ipbPosition->setEnabled(true);
        m_colourCombo->setEnabled(true);
        m_hexValue->setEnabled(true);
        m_minBox->setEnabled(true);
        m_maxBox->setEnabled(true);
        m_defaultBox->setEnabled(true);
    }

}
void
AudioSegmentInsertCommand::execute()
{
    if (!m_segment) {
        // Create and insert Segment
        //
        m_segment = new Segment(Segment::Audio);
        m_segment->setTrack(m_track);
        m_segment->setStartTime(m_startTime);
        m_segment->setAudioStartTime(m_audioStartTime);
        m_segment->setAudioEndTime(m_audioEndTime);
        m_segment->setAudioFileId(m_audioFileId);

        // Set color for audio segment (DMM)
        //
        m_segment->setColourIndex(GUIPalette::AudioDefaultIndex);

        // Calculate end time
        //
        RealTime startTime =
            m_composition->getElapsedRealTime(m_startTime);

        RealTime endTime =
            startTime + m_audioEndTime - m_audioStartTime;

        timeT endTimeT = m_composition->getElapsedTimeForRealTime(endTime);

        RG_DEBUG << "AudioSegmentInsertCommand::execute : start timeT "
        << m_startTime << ", startTime " << startTime << ", audioStartTime " << m_audioStartTime << ", audioEndTime " << m_audioEndTime << ", endTime " << endTime << ", end timeT " << endTimeT << endl;

        m_segment->setEndTime(endTimeT);

        if (endTimeT > m_composition->getEndMarker()) {
            m_composition->setEndMarker(m_composition->getBarEndForTime(endTimeT));
        }

        // Label by audio file name
        //
        AudioFile *aF =
            m_audioFileManager->getAudioFile(m_audioFileId);

        if (aF) {
            std::string label = aF->getLabel();
            m_segment->setLabel(appendLabel(label, qstrtostr(tr("(inserted)"))));
        } else {
            m_segment->setLabel(qstrtostr( tr("unknown audio file")) );
        }
        m_composition->addSegment(m_segment);
    } else {
        m_composition->addSegment(m_segment);
    }

    m_detached = false;
}
Пример #5
0
void shareDialog::on_okButton_clicked()
{
    if(ui_core->listWidget->selectedItems().empty() && ui_core->specificradioButton->isChecked())
    {
        qDebug()<<"Please select some user to share with!";
        return;
    }
    if(ui_core->publicradioButton->isChecked())
    {
        sendmsg("Share With Public");
        recievemsg();
        if(msgstr=="Send Path")
        {
            sendmsg(qstrtostr(ui_core->pathlabel->text()));
            this->close();
        }

        // write file path to my public folder
    }
    else if(ui_core->specificradioButton->isChecked())
    {
        string specific_user = qstrtostr(ui_core->listWidget->currentItem()->text()); // ensure that listwidget contains only other users
        sendmsg("Share With Specific User");
        recievemsg();
        if(msgstr=="Send Specific User")
        {
            sendmsg(specific_user);
            recievemsg();
            if(msgstr=="Send Path")
            {
                sendmsg(qstrtostr(ui_core->pathlabel->text()));
                recievemsg();
                if(msgstr=="Folder Or File?")\
                {
                    if(this->isFolder)
                    {
                        sendmsg("Folder");
                    }
                    else
                    {
                        sendmsg("File");
                    }
                    recievemsg();
                    if(msgstr=="Shared!")
                    {
                        this->close();
                    }
                }

            }
        }
        // write file path to shared-folder/specific-user
    }
}
Пример #6
0
bool
ImportDeviceDialog::importFromSF2(QString filename)
{
    SF2PatchExtractor::Device sf2device;
    try {
        sf2device = SF2PatchExtractor::read( qstrtostr(filename) );

        // These exceptions shouldn't happen -- the isSF2File call before this
        // one should have weeded them out
    } catch (SF2PatchExtractor::FileNotFoundException e) {
        return false;
    } catch (SF2PatchExtractor::WrongFileFormatException e) {
        return false;
    }

    std::vector<MidiBank> banks;
    std::vector<MidiProgram> programs;

    for (SF2PatchExtractor::Device::const_iterator i = sf2device.begin();
            i != sf2device.end(); ++i) {

        int bankNumber = i->first;
        const SF2PatchExtractor::Bank &sf2bank = i->second;

        int msb = bankNumber / 128;
        int lsb = bankNumber % 128;

        MidiBank bank
        (msb == 1, msb, lsb,
         qstrtostr(tr("Bank %1:%2").arg(msb).arg(lsb)));

        banks.push_back(bank);

        for (SF2PatchExtractor::Bank::const_iterator j = sf2bank.begin();
                j != sf2bank.end(); ++j) {

            MidiProgram program(bank, j->first, j->second);
            programs.push_back(program);
        }
    }

    // This is a temporary device, so we can use device and instrument
    // IDs that other devices in the Studio may also be using without
    // expecting any problems
    MidiDevice *device = new MidiDevice
        (0, MidiInstrumentBase, "", MidiDevice::Play);
    device->replaceBankList(banks);
    device->replaceProgramList(programs);
    m_devices.push_back(device);

    return true;
}
Пример #7
0
PresetGroup::PresetGroup() :
        m_errorString(tr("unknown error")),
        m_elCategoryName(""),
        m_elInstrumentName(""),
        m_elClef(0),
        m_elTranspose(0),
        m_elLowAm(0),
        m_elHighAm(0),
        m_elLowPro(0),
        m_elHighPro(0),
        m_lastCategory( -1),
        m_currentCategory( -1),
        m_lastInstrument( -1),
        m_currentInstrument( -1),
        m_name(false),
        m_clef(false),
        m_transpose(false),
        m_amateur(false),
        m_pro(false)
{
    // NOTE: the following code was simplified to remove three layers of trying
    // different ways to find presets.xml which were left over from the old
    // translation mechanism of having multiple presets-XX.xml to choose from.
    // Once cleaned of this language property, all statements distilled down to
    // the same statement, so I removed the redundant code.
    ResourceFinder rf;
    QString presetFileName = rf.getResourcePath
        ("presets", QString("presets.xml"));

    if (presetFileName == "" || !QFileInfo(presetFileName).isReadable()) {

        RG_DEBUG << "Failed to open " << presetFileName;

        throw PresetFileReadFailed
        (qstrtostr(tr("Can't open preset file %1").arg(presetFileName)));
    }

    QFile presetFile(presetFileName);

    QXmlInputSource source(&presetFile);
    QXmlSimpleReader reader;
    reader.setContentHandler(this);
    reader.setErrorHandler(this);
    bool ok = reader.parse(source);
    presetFile.close();

    if (!ok) {
        throw PresetFileReadFailed(qstrtostr(m_errorString));
    }
}
static int osc_message_handler(const char *path, const char *types, lo_arg **argv,
                               int argc, lo_message, void *user_data)
{
    AudioPluginOSCGUIManager *manager = (AudioPluginOSCGUIManager *)user_data;

    InstrumentId instrument;
    int position;
    QString method;

    if (!manager->parseOSCPath(path, instrument, position, method)) {
        return 1;
    }

    OSCMessage *message = new OSCMessage();
    message->setTarget(instrument);
    message->setTargetData(position);
    message->setMethod(qstrtostr(method));

    int arg = 0;
    while (types && arg < argc && types[arg]) {
        message->addArg(types[arg], argv[arg]);
        ++arg;
    }

    manager->postMessage(message);
    return 0;
}
Пример #9
0
void
ColourConfigurationPage::slotAddNew()
{
    QColor temp;

    bool ok = false;

    QString newName = InputDialog::getText(this, tr("New Color Name"),
                                           tr("Enter new name"), LineEdit::Normal,
                                           tr("New"),
                                           &ok, 0);

    // !!! This is very suspicious
    bool c_ok;
    
    if ((ok == true) && (!newName.isEmpty())) {
        //QColorDialog box(this, "", true);

        //int result = box.getColor( temp );
        //QColor col = QColorDialog::getColor();
        // QRgb rgba = QColorDialog::getRgba( 0xFFFFFFFF, &c_ok, 0 );    // 0 == parent
        
        if ( c_ok ) {
            Colour temp2 = GUIPalette::convertColour(temp);
            m_map.addItem(temp2, qstrtostr(newName));
            m_colourtable->populate_table(m_map, m_listmap);
        }
        // Else we don't do anything as they either didn't give a name
        //  or didn't give a colour
    }

}
void
ControlParameterEditDialog::slotTypeChanged(int value)
{
    RG_DEBUG << "ControlParameterEditDialog::slotTypeChanged";
    m_dialogControl.setType(qstrtostr(m_typeCombo->itemText(value)));

    populate();
}
Пример #11
0
Mark
UseOrnamentDialog::getMark() const
{
    if (int(m_marks.size()) > m_mark->currentIndex())
        return m_marks[m_mark->currentIndex()];
    else
        return Marks::getTextMark(qstrtostr(m_text->text()));
}
Пример #12
0
void
TrackParameterBox::slotLoadPressed()
{
    // Inherits style.  Centers on main window.
    //PresetHandlerDialog dialog(this);
    // Does not inherit style?  Centers on monitor #1?
    PresetHandlerDialog dialog(0);

    Track *track = getTrack();
    if (!track)
        return;

    try {
        // Launch the PresetHandlerDialog.  If the user selects OK...
        if (dialog.exec() == QDialog::Accepted) {
            // Update the Track.
            track->setPresetLabel(qstrtostr(dialog.getName()));
            track->setClef(dialog.getClef());
            track->setTranspose(dialog.getTranspose());
            track->setHighestPlayable(dialog.getHighRange());
            track->setLowestPlayable(dialog.getLowRange());

            // Enable this until it is subsequently re-disabled by the
            // user overriding the preset, calling one of the other slots
            // in the normal course.
            // ??? This is too subtle.  We should probably just clear it
            //     when modifications are made.  After all, it's no longer
            //     the selected preset.  Or add "(modified)"?  Or change
            //     color?  Or allow the user to edit it and save it to the
            //     .rg file as part of the Track.
            m_preset->setEnabled(true);

            // If we need to convert the track's segments
            if (dialog.getConvertAllSegments()) {
                Composition &comp = m_doc->getComposition();
                SegmentSyncCommand* command = new SegmentSyncCommand(
                        comp.getSegments(), m_selectedTrackId,
                        dialog.getTranspose(), dialog.getLowRange(),
                        dialog.getHighRange(),
                        clefIndexToClef(dialog.getClef()));
                CommandHistory::getInstance()->addCommand(command);
            }

            m_doc->slotDocumentModified();

            // Notify observers
            // This will trigger a call to updateWidgets2().
            Composition &comp = m_doc->getComposition();
            comp.notifyTrackChanged(track);
        }
    } catch (Exception &e) {  // from PresetHandlerDialog
        // !!! This should be a more verbose error to pass along the
        //     row/column of the corruption.
        QMessageBox::warning(0, tr("Rosegarden"),
                tr("The instrument preset database is corrupt.  Check your installation."));
    }
}
Пример #13
0
void
UseOrnamentDialog::setupFromConfig()
{
    QSettings settings;
    settings.beginGroup( NotationViewConfigGroup );

    Mark mark = qstrtostr(settings.value("useornamentmark", "trill").toString());
    int seg = settings.value("useornamentlastornament", 0).toInt() ;
    std::string timing = qstrtostr(settings.value("useornamenttiming",
            strtoqstr(BaseProperties::TRIGGER_SEGMENT_ADJUST_SQUISH)).toString());
    bool retune = qStrToBool( settings.value("useornamentretune", "true" ) ) ;

    size_t i = 0;
    for (i = 0; i < m_marks.size(); ++i) {
        if (mark == m_marks[i]) {
            m_mark->setCurrentIndex(i);
            m_text->setEnabled(false);
            break;
        }
    }
    if (i >= m_marks.size()) {
        m_mark->setCurrentIndex(m_marks.size());
        m_text->setEnabled(true);
        m_text->setText(strtoqstr(Marks::getTextFromMark(mark)));
    }

    if (seg >= 0 && seg < m_ornament->count())
        m_ornament->setCurrentIndex(seg);

    if (timing == BaseProperties::TRIGGER_SEGMENT_ADJUST_NONE) {
        m_adjustTime->setCurrentIndex(0);
    } else if (timing == BaseProperties::TRIGGER_SEGMENT_ADJUST_SQUISH) {
        m_adjustTime->setCurrentIndex(3);
    } else if (timing == BaseProperties::TRIGGER_SEGMENT_ADJUST_SYNC_START) {
        m_adjustTime->setCurrentIndex(1);
    } else if (timing == BaseProperties::TRIGGER_SEGMENT_ADJUST_SYNC_END) {
        m_adjustTime->setCurrentIndex(2);
    }

    m_retune->setChecked(retune);

    settings.endGroup();
}
Пример #14
0
std::string
KeySignatureDialog::getKeyName(const QString &s, bool minor)
{
    QString u((s.length() >= 1) ? (s.left(1).toUpper() + s.right(s.length() - 1))
              : s);

    std::string name(qstrtostr(u));
    name = name + " " + (minor ? "minor" : "major");
    return name;
}
Пример #15
0
CopyCommand::CopyCommand(EventSelection &selection,
                         Clipboard *clipboard) :
        NamedCommand(getGlobalName()),
        m_targetClipboard(clipboard)
{
    m_sourceClipboard = new Clipboard;
    m_savedClipboard = 0;
    std::string label = selection.getSegment().getLabel();
    m_sourceClipboard->newSegment(&selection)->setLabel(
            appendLabel(label, qstrtostr(tr("(excerpt)"))));
}
Пример #16
0
void
SegmentQuickCopyCommand::execute()
{
    if (!m_segment) {
        m_segment = m_segmentToCopy->clone(false);
        std::string label = m_segment->getLabel();
        m_segment->setLabel(appendLabel(label, qstrtostr(tr("(copied)"))));
    }
    m_composition->addSegment(m_segment);
    m_detached = false;
}
Пример #17
0
Note
NotationStrings::getNoteForName(QString name)
{
    std::string origName(qstrtostr(name));
    int pos = name.indexOf('-');
    int dots = 0;

    if (pos > 0 && pos < 6 && pos < name.length() - 1) {
        dots = name.left(pos).toInt();
        name = name.right(name.length() - pos - 1);
        if (dots < 2) {
            throw MalformedNoteName("Non-numeric or invalid dot count in \"" +
                                    origName + "\"");
        }
    }

    if (name.length() > 7 &&
            (name.left(7) == "dotted " || name.left(7) == "dotted-")) {
        if (dots == 0)
            dots = 1;
        name = name.right(name.length() - 7);
    } else {
        if (dots > 1) {
            throw MalformedNoteName("Dot count without dotted tag in \"" +
                                    origName + "\"");
        }
    }

    if (name.length() > 5 && name.right(5) == " note") {
        name = name.left(name.length() - 5);
    }

    Note::Type type;

    static const char *names[][4] = {
        { "64th", "sixty-fourth", "hemidemisemi", "hemidemisemiquaver" },
        { "32nd", "thirty-second", "demisemi", "demisemiquaver"	},
        { "16th", "sixteenth", "semi", "semiquaver"	},
        { "8th", "eighth", 0, "quaver"	},
        { "quarter", 0, 0, "crotchet", },
        { "half", 0, 0, "minim"	},
        { "whole", 0, 0, "semibreve"	},
        { "double whole", 0, 0, "breve"	}
    };

    for (type = Note::Shortest; type <= Note::Longest; ++type) {
        for (int i = 0; i < 4; ++i) {
            if (!names[type][i]) continue;
            if (name == names[type][i]) return Note(type, dots);
        }
    }

    throw MalformedNoteName("Can't parse note name \"" + origName + "\"");
}
Пример #18
0
void
Studio::
resyncDeviceConnections(void)
{
    // Sync all the device connections
    DeviceList *devices = getDevices();
    for (uint i = 0; i < devices->size(); ++i) {
        DeviceId id = (*devices)[i]->getId();
        QString connection = RosegardenSequencer::getInstance()->getConnection(id);
        (*devices)[i]->setConnection(qstrtostr(connection));
    }
}
Пример #19
0
void
SegmentLabelCommand::execute()
{
    bool addLabels = false;
    if (m_labels.empty())
        addLabels = true;

    for (size_t i = 0; i < m_segments.size(); ++i) {
        if (addLabels)
            m_labels.push_back(strtoqstr(m_segments[i]->getLabel()));

        m_segments[i]->setLabel(qstrtostr(m_newLabel));
    }
}
Пример #20
0
void
MidiKeyMappingEditor::slotNameChanged(const QString& name)
{
    const LineEdit* lineEdit = dynamic_cast<const LineEdit*>(sender());
    if (!lineEdit) {
        RG_DEBUG << "MidiKeyMappingEditor::slotNameChanged() : %%% ERROR - signal sender is not a Rosegarden::LineEdit\n";
        return ;
    }

    QString senderName = sender()->objectName();

    // Adjust value back to zero rated
    //
    unsigned int pitch = senderName.toUInt() - 1;

    RG_DEBUG << "MidiKeyMappingEditor::slotNameChanged("
    << name << ") : pitch = " << pitch << endl;

    if (qstrtostr(name) != m_mapping.getMap()[pitch]) {
        m_mapping.getMap()[pitch] = qstrtostr(name);
        m_bankEditor->slotApply();
    }
}
Пример #21
0
void
TextEventDialog::slotTextChanged(const QString &qtext)
{
    std::string type(getTextType());

    QString qtrunc(qtext);
    if (qtrunc.length() > 20)
        qtrunc = qtrunc.left(20) + "...";
    std::string text(qstrtostr(qtrunc));
    if (text == "")
        text = "Sample";

    Text rtext(text, type);
    m_textExampleLabel->setPixmap(m_notePixmapFactory->makeTextPixmap(rtext));
}
Пример #22
0
CopyCommand::CopyCommand(SegmentSelection &selection,
                         Clipboard *clipboard) :
        NamedCommand(getGlobalName()),
        m_targetClipboard(clipboard)
{
    m_sourceClipboard = new Clipboard;
    m_savedClipboard = 0;

    for (SegmentSelection::iterator i = selection.begin();
            i != selection.end(); ++i) {
        std::string label = (*i)->getLabel();
        m_sourceClipboard->newSegment(*i)->setLabel(
                appendLabel(label, qstrtostr(tr("(copied)"))));
    }
}
Пример #23
0
void
TrackParameterBox::slotColorChanged(int index)
{
    //RG_DEBUG << "slotColorChanged(" << index << ")";

    Track *track = getTrack();
    if (!track)
        return;

    track->setColor(index);
    m_doc->slotDocumentModified();

    // Notify observers
    // This will trigger a call to updateWidgets2().
    Composition &comp = m_doc->getComposition();
    comp.notifyTrackChanged(track);

#if 0
// This will never happen since the "Add Color" option is never added.
    if (index == m_addColourPos) {
        ColourMap newMap = m_doc->getComposition().getSegmentColourMap();
        QColor newColour;
        bool ok = false;
        
        QString newName = InputDialog::getText(this,
                                               tr("New Color Name"),
                                               tr("Enter new name:"),
                                               LineEdit::Normal,
                                               tr("New"), &ok);
        
        if ((ok == true) && (!newName.isEmpty())) {
//             QColorDialog box(this, "", true);
//             int result = box.getColor(newColour);
            
            //QRgb QColorDialog::getRgba(0xffffffff, &ok, this);
            QColor newColor = QColorDialog::getColor(Qt::white, this);

            if (newColor.isValid()) {
                Colour newRColour = GUIPalette::convertColour(newColour);
                newMap.addItem(newRColour, qstrtostr(newName));
                slotDocColoursChanged();
            }
        }
        // Else we don't do anything as they either didn't give a name
        // or didn't give a colour
    }
#endif
}
Пример #24
0
AddIndicationCommand::AddIndicationCommand(std::string indicationType,
                                           EventSelection &selection) :
    BasicCommand(getGlobalName(indicationType),
                 selection.getSegment(),
                 std::min(selection.getStartTime(), selection.getNotationStartTime()),
                 std::max(selection.getEndTime(), selection.getNotationEndTime())),
    m_indicationType(indicationType),
    m_indicationStart(selection.getNotationStartTime()),
    m_indicationDuration(selection.getTotalNotationDuration()),
    m_lastInsertedEvent(0)
{
    if (!canExecute()) {
        throw CommandFailed
            //!!! need to use text from trunk/src/gui/editors/notation/NotationView.cpp (but this requires an informal human-readable version of the indication name)
            (qstrtostr(tr("Can't add identical overlapping indications")));
    }
}
Пример #25
0
void
AudioPlugin::addPort(int number,
                     const QString &name,
                     PluginPort::PortType type,
                     PluginPort::PortDisplayHint hint,
                     PortData lowerBound,
                     PortData upperBound,
                     PortData defaultValue)
{
    PluginPort *port = new PluginPort(number,
                                      qstrtostr(name),
                                      type,
                                      hint,
                                      lowerBound,
                                      upperBound,
                                      defaultValue);
    m_ports.push_back(port);

}
Пример #26
0
bool
SoundDriver::addAudioFile(const QString &fileName, unsigned int id)
{
    AudioFile *ins = 0;

    try {
        ins = new WAVAudioFile(id, qstrtostr(fileName), fileName);
        ins->open();
        m_audioFiles.push_back(ins);

        //RG_DEBUG << "Sequencer::addAudioFile() = \"" << fileName << "\"";

        return true;

    } catch (SoundFile::BadSoundFileException e) {
        RG_DEBUG << "SoundDriver::addAudioFile: Failed to add audio file " << fileName << ": " << e.getMessage();
        delete ins;
        return false;
    }
}
Пример #27
0
void
ReconnectDeviceCommand::execute()
{
    Device *device = m_studio->getDevice(m_deviceId);

    if (device) {
        m_oldConnection = qstrtostr(RosegardenSequencer::getInstance()
                                    ->getConnection(device->getId()));
        RosegardenSequencer::getInstance()->setConnection
            (m_deviceId, strtoqstr(m_newConnection));
        device->setConnection(m_newConnection);

        std::cerr << "ReconnectDeviceCommand::execute - "
                     << " reconnected device " << m_deviceId
                     << " to " << m_newConnection << std::endl;
    }

    // ??? Instead of this kludge, we should be calling a Studio::hasChanged()
    //     which would then notify all observers (e.g. MIPP) who, in turn,
    //     would update themselves.
    RosegardenMainWindow::self()->uiUpdateKludge();
}
CreateOrDeleteDeviceCommand::CreateOrDeleteDeviceCommand(Studio *studio,
                                                         DeviceId id) :
    NamedCommand(getGlobalName(true)),
    m_studio(studio),
    m_deviceId(id),
    m_deviceCreated(true)
{
    Device *device = m_studio->getDevice(m_deviceId);

    if (device) {
        m_name = device->getName();
        m_type = device->getType();
        m_direction = MidiDevice::Play;
        MidiDevice *md = dynamic_cast<MidiDevice *>(device);
        if (md) m_direction = md->getDirection();
        m_connection = qstrtostr(RosegardenSequencer::getInstance()
                                 ->getConnection(md->getId()));
    } else {
        RG_DEBUG << "CreateOrDeleteDeviceCommand: No such device as "
                 << m_deviceId << endl;
    }
}
Пример #29
0
RIFFAudioFile::RIFFAudioFile(const QString &fileName,
                             unsigned int channels = 1,
                             unsigned int sampleRate = 48000,
                             unsigned int bytesPerSecond = 6000,
                             unsigned int bytesPerFrame = 2,
                             unsigned int bitsPerSample = 16):
        AudioFile(0, "", fileName)
{
    m_bitsPerSample = bitsPerSample;
    m_sampleRate = sampleRate;
    m_bytesPerSecond = bytesPerSecond;
    m_bytesPerFrame = bytesPerFrame;
    m_channels = channels;

    if (bitsPerSample == 16)
        m_subFormat = PCM;
    else if (bitsPerSample == 32)
        m_subFormat = FLOAT;
    else
        throw(BadSoundFileException(m_fileName, qstrtostr(QObject::tr("Rosegarden currently only supports 16 or 32-bit PCM or IEEE floating-point RIFF files for writing"))));

}
Пример #30
0
void
MidiKeyMappingEditor::populate(QTreeWidgetItem* item)
{
    RG_DEBUG << "MidiKeyMappingEditor::populate\n";

    MidiKeyMapTreeWidgetItem *keyItem =
        dynamic_cast<MidiKeyMapTreeWidgetItem *>(item);
    if (!keyItem) {
        RG_DEBUG << "MidiKeyMappingEditor::populate : not a key item - returning\n";
        return ;
    }

    MidiDevice* device = m_bankEditor->getCurrentMidiDevice();
    if (!device)
        return ;

    m_device = device;
    m_mappingName = qstrtostr(keyItem->getName());

    setEnabled(true);

    reset();
}