/[svn]/qsampler/trunk/src/qsamplerMainForm.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.ui.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 454 by capela, Mon Mar 14 10:59:57 2005 UTC revision 462 by capela, Tue Mar 15 11:39:12 2005 UTC
# Line 642  bool qsamplerMainForm::saveSessionFile ( Line 642  bool qsamplerMainForm::saveSessionFile (
642      }      }
643    
644      // Write the file.      // Write the file.
645      int iErrors = 0;      int  iErrors = 0;
646      QTextStream ts(&file);      QTextStream ts(&file);
647      ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;      ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;
648      ts << "# " << tr("Version")      ts << "# " << tr("Version")
# Line 653  bool qsamplerMainForm::saveSessionFile ( Line 653  bool qsamplerMainForm::saveSessionFile (
653      ts << "# " << tr("File")      ts << "# " << tr("File")
654         << ": " << QFileInfo(sFilename).fileName() << endl;         << ": " << QFileInfo(sFilename).fileName() << endl;
655      ts << "# " << tr("Date")      ts << "# " << tr("Date")
656         << ": " << QDate::currentDate().toString("MMMM dd yyyy")         << ": " << QDate::currentDate().toString("MMM dd yyyy")
657         << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;         << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;
658      ts << "#"  << endl;      ts << "#"  << endl;
659      ts << endl;      ts << endl;
660            // It is assumed that this new kind of device+session file
661            // will be loaded from a complete
662            int *piDeviceIDs;
663            int  iDevice;
664            ts << "RESET" << endl;
665            // Audio device mapping.
666            QMap<int, int> audioDeviceMap;
667            piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
668            for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
669                    qsamplerDevice device(m_pClient, qsamplerDevice::Audio, piDeviceIDs[iDevice]);
670                    ts << endl;
671            ts << "# " << device.deviceTypeName() << " " << device.driverName()
672                       << " " << tr("Device") << " " << iDevice << endl;
673                    ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
674                    const qsamplerDeviceParamMap& params = device.params();
675                    qsamplerDeviceParamMap::ConstIterator iter;
676                    for (iter = params.begin(); iter != params.end(); ++iter)
677                            ts << " " << iter.key() << "='" << iter.data().value << "'";
678                    ts << endl;
679                    audioDeviceMap[device.deviceID()] = iDevice;
680            // Try to keep it snappy :)
681            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
682            }
683            // MIDI device mapping.
684            QMap<int, int> midiDeviceMap;
685            piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
686            for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
687                    qsamplerDevice device(m_pClient, qsamplerDevice::Midi, piDeviceIDs[iDevice]);
688                    ts << endl;
689            ts << "# " << device.deviceTypeName() << " " << device.driverName()
690                       << " " << tr("Device") << " " << iDevice << endl;
691                    ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
692                    const qsamplerDeviceParamMap& params = device.params();
693                    qsamplerDeviceParamMap::ConstIterator iter;
694                    for (iter = params.begin(); iter != params.end(); ++iter)
695                            ts << " " << iter.key() << "='" << iter.data().value << "'";
696                    ts << endl;
697                    midiDeviceMap[device.deviceID()] = iDevice;
698            // Try to keep it snappy :)
699            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
700            }
701            ts << endl;
702            // Sampler channel mapping.
703      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
704      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
705          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
706          if (pChannelStrip) {          if (pChannelStrip) {
707              qsamplerChannel *pChannel = pChannelStrip->channel();              qsamplerChannel *pChannel = pChannelStrip->channel();
708              if (pChannel) {              if (pChannel) {
709                  ts << "# Channel " << iChannel << endl;                  ts << "# " << tr("Channel") << " " << iChannel << endl;
710                  ts << "ADD CHANNEL" << endl;                  ts << "ADD CHANNEL" << endl;
711                  ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel << " " << pChannel->audioDriver() << endl;                  if (audioDeviceMap.isEmpty()) {
712                  ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel << " " << pChannel->midiDriver() << endl;                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel
713              //  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel << " " << pChannel->midiPort() << endl;                                              << " " << pChannel->audioDriver() << endl;
714                                } else {
715                            ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel
716                                               << " " << audioDeviceMap[pChannel->audioDevice()] << endl;
717                                    }
718                    if (midiDeviceMap.isEmpty()) {
719                            ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel
720                                           << " " << pChannel->midiDriver() << endl;
721                                } else {
722                            ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel
723                                               << " " << midiDeviceMap[pChannel->midiDevice()] << endl;
724                                }
725                    ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel
726                                   << " " << pChannel->midiPort() << endl;
727                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " ";                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " ";
728                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
729                      ts << "ALL";                      ts << "ALL";

Legend:
Removed from v.454  
changed lines
  Added in v.462

  ViewVC Help
Powered by ViewVC