diff options
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/ChangeLog | 4 | ||||
-rw-r--r-- | muse2/muse/app.cpp | 23 | ||||
-rw-r--r-- | muse2/muse/audio.cpp | 10 | ||||
-rw-r--r-- | muse2/muse/audiotrack.cpp | 77 | ||||
-rw-r--r-- | muse2/muse/conf.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/gconfig.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/gconfig.h | 1 | ||||
-rw-r--r-- | muse2/muse/song.cpp | 8 | ||||
-rw-r--r-- | muse2/muse/wave.cpp | 9 | ||||
-rw-r--r-- | muse2/muse/widgets/genset.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/gensetbase.ui | 52 | ||||
-rw-r--r-- | muse2/muse/widgets/projectcreateimpl.cpp | 9 |
12 files changed, 143 insertions, 60 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 5e9bf356..08bb4df0 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,7 @@ +15.01.2011: + - fixed: bug were wave track appeared to be rec enabled but no file was created. (rj) + - made create project dialog optional, also some minor tweaks to the dialog (rj) + - 09.01.2011: - These changes marked as p4.0.14: - Applied aux send fix AudioTrack::writeProperties() by Remon. Thanks. (Tim) diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 2c4758a6..9760aea9 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -435,7 +435,8 @@ bool MusE::seqStart() if (midiSeqRunning) break; usleep(1000); - printf("looping waiting for sequencer thread to start\n"); + if(debugMsg) + printf("looping waiting for sequencer thread to start\n"); } if(!midiSeqRunning) { @@ -3158,13 +3159,21 @@ bool MusE::saveAs() { QString name; if (museProject == museProjectInitPath ) { - ProjectCreateImpl pci(muse); - if (pci.exec() == QDialog::Rejected) { - return false; - } + printf("config.useProjectSaveDialog=%d\n", config.useProjectSaveDialog); + if (config.useProjectSaveDialog) { + ProjectCreateImpl pci(muse); + if (pci.exec() == QDialog::Rejected) { + return false; + } + + song->setSongInfo(pci.getSongInfo()); + name = pci.getProjectPath(); + } else { + name = getSaveFileName(QString(""), med_file_save_pattern, this, tr("MusE: Save As")); + if (name.isEmpty()) + return false; + } - name = pci.getProjectPath(); - song->setSongInfo(pci.getSongInfo()); museProject = QFileInfo(name).absolutePath(); QDir dirmanipulator; if (!dirmanipulator.mkpath(museProject)) { diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp index 934a5387..1b62f15c 100644 --- a/muse2/muse/audio.cpp +++ b/muse2/muse/audio.cpp @@ -945,9 +945,12 @@ void Audio::startRolling() { // Changed by Tim. p3.3.8 //startRecordPos = _pos; - if(_loopCount == 0) + if (debugMsg) + printf("startRolling - loopCount=%d, _pos=%d\n", _loopCount, _pos.tick()); + + if(_loopCount == 0) { startRecordPos = _pos; - + } if (song->record()) { recording = true; TrackList* tracks = song->tracks(); @@ -1345,6 +1348,9 @@ void Audio::stopRolling() void Audio::recordStop() { + if (debugMsg) + printf("recordStop - startRecordPos=%d\n", startRecordPos.tick()); + audio->msgIdle(true); // gain access to all data structures song->startUndo(); diff --git a/muse2/muse/audiotrack.cpp b/muse2/muse/audiotrack.cpp index 19bbbaf1..eb70c51e 100644 --- a/muse2/muse/audiotrack.cpp +++ b/muse2/muse/audiotrack.cpp @@ -1569,36 +1569,14 @@ bool AudioTrack::setRecordFlag1(bool f) if (f == _recordFlag) return true; if (f) { - if (_recFile == 0) { - // - // create soundfile for recording - // - char buffer[128]; - QFile fil; - for (;;++recFileNumber) { - sprintf(buffer, "%s/rec%d.wav", - museProject.toLatin1().constData(), - recFileNumber); - fil.setFileName(QString(buffer)); - if (!fil.exists()) - break; - } - _recFile = new SndFile(QString(buffer)); - _recFile->setFormat( - SF_FORMAT_WAV | SF_FORMAT_FLOAT, - _channels, sampleRate); - } -// if(_recFile->openWrite()) -// { -// QMessageBox::critical(NULL, "MusE write error.", "Error creating target wave file\n" -// "Check your configuration."); -// return false; -// -// } - if (debugMsg) - printf("AudioNode::setRecordFlag1: create internal file %s\n", - _recFile->path().toLatin1().constData()); - } + // do nothing + if (_recFile == 0 && song->record()) { + // this rec-enables a track if the global arm already was done + // the standard case would be that rec-enable be done there + prepareRecording(); + } + + } else { if (_recFile) { // this file has not been processed and can be @@ -1614,14 +1592,49 @@ bool AudioTrack::setRecordFlag1(bool f) remove(s.toLatin1().constData()); if(debugMsg) - printf("AudioNode::setRecordFlag1: remove file %s\n", s.toLatin1().constData()); + printf("AudioNode::setRecordFlag1: remove file %s if it exists\n", s.toLatin1().constData()); //_recFile = 0; - } } + } return true; } + + +//--------------------------------------------------------- +// prepareRecording +// normally called from song->setRecord to defer creating +// wave files until MusE is globally rec-enabled +// also called from track->setRecordFlag (above) +// if global rec enable already was done +//--------------------------------------------------------- bool AudioTrack::prepareRecording() { + if(debugMsg) + printf("prepareRecording for track %s\n", _name.toLatin1().constData()); + + if (_recFile == 0) { + // + // create soundfile for recording + // + char buffer[128]; + QFile fil; + for (;;++recFileNumber) { + sprintf(buffer, "%s/rec%d.wav", + museProject.toLatin1().constData(), + recFileNumber); + fil.setFileName(QString(buffer)); + if (!fil.exists()) + break; + } + _recFile = new SndFile(QString(buffer)); + _recFile->setFormat( + SF_FORMAT_WAV | SF_FORMAT_FLOAT, + _channels, sampleRate); + } + + if (debugMsg) + printf("AudioNode::setRecordFlag1: init internal file %s\n", _recFile->path().toLatin1().constData()); + if(_recFile->openWrite()) { QMessageBox::critical(NULL, "MusE write error.", "Error creating target wave file\n" diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 328224f3..5ddc058d 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -911,6 +911,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) config.projectBaseFolder = xml.parse1(); else if (tag == "projectStoreInFolder") config.projectStoreInFolder = xml.parseInt(); + else if (tag == "useProjectSaveDialog") + config.useProjectSaveDialog = xml.parseInt(); else xml.unknown("configuration"); break; @@ -1161,6 +1163,7 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const xml.strTag(level, "startSong", config.startSong); xml.strTag(level, "projectBaseFolder", config.projectBaseFolder); xml.intTag(level, "projectStoreInFolder", config.projectStoreInFolder); + xml.intTag(level, "useProjectSaveDialog", config.useProjectSaveDialog); xml.intTag(level, "midiInputDevice", midiInputPorts); xml.intTag(level, "midiInputChannel", midiInputChannel); xml.intTag(level, "midiRecordType", midiRecordType); diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index 944035a7..912a59d8 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -166,6 +166,7 @@ GlobalConfigValues config = { 44100, // Dummy audio preferred sample rate 512, // Dummy audio buffer size QString("./"), // projectBaseFolder - true // projectStoreInFolder + true, // projectStoreInFolder + true // useProjectSaveDialog }; diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h index 2eeea7cb..6fb1bb17 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -141,6 +141,7 @@ struct GlobalConfigValues { int dummyAudioBufSize; QString projectBaseFolder; bool projectStoreInFolder; + bool useProjectSaveDialog; }; extern GlobalConfigValues config; diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 3ac818e5..42c9ce77 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -1073,6 +1073,9 @@ void Song::clearTrackRec() //--------------------------------------------------------- void Song::setRecord(bool f, bool autoRecEnable) { + if(debugMsg) + printf("setRecord recordflag =%d f(record state)=%d autoRecEnable=%d\n", recordFlag, f, autoRecEnable); + if (f && museProject == museProjectInitPath ) { // check that there is a project stored before commencing // no project, we need to create one. if (!muse->saveAs()) @@ -1121,8 +1124,9 @@ void Song::setRecord(bool f, bool autoRecEnable) } // prepare recording of wave files for all record enabled wave tracks for (iWaveTrack i = wtl->begin(); i != wtl->end(); ++i) { - if((*i)->recordFlag()) - { + if((*i)->recordFlag() || (selectedTrack == (*i) && autoRecEnable)) // prepare if record flag or if it is set to recenable + { // setRecordFlag may take too long time to complete + // so we try this case specifically (*i)->prepareRecording(); } } diff --git a/muse2/muse/wave.cpp b/muse2/muse/wave.cpp index b519ca70..30278c84 100644 --- a/muse2/muse/wave.cpp +++ b/muse2/muse/wave.cpp @@ -1044,6 +1044,9 @@ int ClipList::idx(const Clip& clip) const //void Song::cmdAddRecordedWave(WaveTrack* track, const Pos& s, const Pos& e) void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e) { + if (debugMsg) + printf("cmdAddRecordedWave - loopCount = %d, punchin = %d", audio->loopCount(), punchin()); + SndFile* f = track->recFile(); if (f == 0) { printf("cmdAddRecordedWave: no snd file for track <%s>\n", @@ -1068,13 +1071,13 @@ void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e) // No part to be created? Delete the rec sound file. if(s.tick() >= e.tick()) { - QString s = f->path(); + QString st = f->path(); delete f; // The function which calls this function already does this immediately after. But do it here anyway. track->setRecFile(0); - remove(s.toLatin1().constData()); + remove(st.toLatin1().constData()); if(debugMsg) - printf("Song::cmdAddRecordedWave: remove file %s\n", s.toLatin1().constData()); + printf("Song::cmdAddRecordedWave: remove file %s - start=%d end=%d\n", st.toLatin1().constData(), s.tick(), e.tick()); return; } // Round the start down using the Arranger part snap raster value. diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index 0d81d846..68405f9b 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -132,6 +132,7 @@ GlobalSettingsConfig::GlobalSettingsConfig(QWidget* parent) externalWavEditorSelect->setText(config.externalWavEditor); oldStyleStopCheckBox->setChecked(config.useOldStyleStopShortCut); moveArmedCheckBox->setChecked(config.moveArmedCheckBox); + projectSaveCheckBox->setChecked(config.useProjectSaveDialog); //updateSettings(); // TESTING @@ -236,6 +237,7 @@ void GlobalSettingsConfig::updateSettings() externalWavEditorSelect->setText(config.externalWavEditor); oldStyleStopCheckBox->setChecked(config.useOldStyleStopShortCut); moveArmedCheckBox->setChecked(config.moveArmedCheckBox); + projectSaveCheckBox->setChecked(config.useProjectSaveDialog); } //--------------------------------------------------------- @@ -314,6 +316,8 @@ void GlobalSettingsConfig::apply() config.externalWavEditor = externalWavEditorSelect->text(); config.useOldStyleStopShortCut = oldStyleStopCheckBox->isChecked(); config.moveArmedCheckBox = moveArmedCheckBox->isChecked(); + config.useProjectSaveDialog = projectSaveCheckBox->isChecked(); + //muse->showMixer(config.mixerVisible); muse->showMixer1(config.mixer1Visible); muse->showMixer2(config.mixer2Visible); diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui index 44261c87..4d937ecb 100644 --- a/muse2/muse/widgets/gensetbase.ui +++ b/muse2/muse/widgets/gensetbase.ui @@ -29,7 +29,7 @@ </sizepolicy> </property> <property name="currentIndex"> - <number>0</number> + <number>3</number> </property> <widget class="QWidget" name="TabPage"> <attribute name="title"> @@ -1124,13 +1124,7 @@ Shorter periods are desirable.</string> <property name="title"> <string>Behavior</string> </property> - <layout class="QGridLayout" name="gridLayout_2" columnminimumwidth="280,0,0"> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> + <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> <widget class="QLabel" name="TextLabel1"> <property name="text"> @@ -1141,7 +1135,7 @@ Shorter periods are desirable.</string> </property> </widget> </item> - <item row="0" column="1" colspan="2"> + <item row="0" column="1"> <widget class="QSpinBox" name="guiRefreshSelect"> <property name="suffix"> <string>/sec</string> @@ -1167,6 +1161,19 @@ Shorter periods are desirable.</string> </property> </widget> </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="oldStyleStopCheckBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> <item row="2" column="0"> <widget class="QLabel" name="textLabel1_4_2"> <property name="text"> @@ -1190,8 +1197,18 @@ Shorter periods are desirable.</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="oldStyleStopCheckBox"> + <item row="3" column="0"> + <widget class="QLabel" name="textLabel1_4_3"> + <property name="text"> + <string>Use project save dialog</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QCheckBox" name="projectSaveCheckBox"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -1203,6 +1220,19 @@ Shorter periods are desirable.</string> </property> </widget> </item> + <item row="4" column="0"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> </layout> </widget> </item> diff --git a/muse2/muse/widgets/projectcreateimpl.cpp b/muse2/muse/widgets/projectcreateimpl.cpp index a019df95..c7aa0fdb 100644 --- a/muse2/muse/widgets/projectcreateimpl.cpp +++ b/muse2/muse/widgets/projectcreateimpl.cpp @@ -41,10 +41,15 @@ void ProjectCreateImpl::selectDirectory() void ProjectCreateImpl::updateDirectoryPath() { + QString name = ""; if (createFolderCheckbox->isChecked()) { - storageDirEdit->setText(directoryPath + projectNameEdit->text() + "/" + projectNameEdit->text() + ".med"); + if (!projectNameEdit->text().isEmpty()) + name = projectNameEdit->text() + "/" + projectNameEdit->text() + ".med"; + storageDirEdit->setText(directoryPath + name ); } else { - storageDirEdit->setText(directoryPath + projectNameEdit->text() + ".med"); + if (!projectNameEdit->text().isEmpty()) + name = projectNameEdit->text() + ".med"; + storageDirEdit->setText(directoryPath + projectNameEdit->text() + name); } } |