ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/Vago/soundWizard/soundpagefinal.cpp
(Generate patch)

Comparing s10k/Vago/soundWizard/soundpagefinal.cpp (file contents):
Revision 1092 by s10k, Sat Dec 30 13:43:28 2017 UTC vs.
Revision 1093 by s10k, Sat Dec 30 13:57:32 2017 UTC

# Line 1 | Line 1
1   #include "soundpagefinal.h"
2   #include "ui_soundpagefinal.h"
3  
4 < SoundPageFinal::SoundPageFinal(QString AppDir, QString soundsLocation, DropTableWidget *page2Table, Logger *myLogger, QHash<QString, QString> *commandMap, QWidget *parent) :
4 > SoundPageFinal::SoundPageFinal(QString AppDir, QString soundsLocation, DropTableWidget *page2Table, QHash<QString, QString> *commandMap, QWidget *parent) :
5      QWizardPage(parent),
6      ui(new Ui::soundpagefinal)
7   {
8      ui->setupUi(this);
9      this->soundsLocation=soundsLocation;
10      this->page2Table=page2Table;
11    this->myLogger=myLogger;
11      this->commandMap=commandMap;
12  
13      this->xmlCommands = new QStringList();
14      this->oniSplitCommands = new QStringList();
15 <    this->myXmlProcessor = new XmlProcessor(AppDir, this->myLogger,this->xmlCommands);
16 <    this->myConverter = new Converter(AppDir, this->myLogger,this->oniSplitCommands);
15 >    this->myXmlProcessor = new XmlProcessor(AppDir, this->xmlCommands);
16 >    this->myConverter = new Converter(AppDir,this->oniSplitCommands);
17  
18      ui->lbComplete->setText("<html>The wizard is now complete. The sounds have been converted. "
19                              "You can view all converted files clicking <a href=' '>here.</a><br />"
# Line 125 | Line 124 | void SoundPageFinal::startProcessing(){
124          flags << "CanPan";
125      }
126  
127 <    sphereRadious=Util::normalizeDecimalSeparator(field("leSphereRadious").toString());
128 <    minElapsedTime=Util::normalizeDecimalSeparator(field("leMinElapsedTime").toString());
129 <    maxElapsedTime=Util::normalizeDecimalSeparator(field("leMaxElapsedTime").toString());
130 <    minVolumeDistance=Util::normalizeDecimalSeparator(field("leMinVolumeDistance").toString());
131 <    maxVolumeDistance=Util::normalizeDecimalSeparator(field("leMaxVolumeDistance").toString());
132 <    minOcclusion=Util::normalizeDecimalSeparator(field("leMinOcclusion").toString());
133 <    treshold=Util::normalizeDecimalSeparator(field("leTreshold").toString());
127 >    sphereRadious=Util::String::normalizeDecimalSeparator(field("leSphereRadious").toString());
128 >    minElapsedTime=Util::String::normalizeDecimalSeparator(field("leMinElapsedTime").toString());
129 >    maxElapsedTime=Util::String::normalizeDecimalSeparator(field("leMaxElapsedTime").toString());
130 >    minVolumeDistance=Util::String::normalizeDecimalSeparator(field("leMinVolumeDistance").toString());
131 >    maxVolumeDistance=Util::String::normalizeDecimalSeparator(field("leMaxVolumeDistance").toString());
132 >    minOcclusion=Util::String::normalizeDecimalSeparator(field("leMinOcclusion").toString());
133 >    treshold=Util::String::normalizeDecimalSeparator(field("leTreshold").toString());
134  
135      // Get data page 4
136  
137 <    volume=Util::normalizeDecimalSeparator(field("leVolume").toString());
138 <    minVolume=Util::normalizeDecimalSeparator(field("leMinVolume").toString());
139 <    maxVolume=Util::normalizeDecimalSeparator(field("leMaxVolume").toString());
140 <    pitch=Util::normalizeDecimalSeparator(field("lePitch").toString());
141 <    minPitch=Util::normalizeDecimalSeparator(field("leMinPitch").toString());
142 <    maxPitch=Util::normalizeDecimalSeparator(field("leMaxPitch").toString());
143 <    weight=Util::normalizeDecimalSeparator(field("leWeight").toString());
137 >    volume=Util::String::normalizeDecimalSeparator(field("leVolume").toString());
138 >    minVolume=Util::String::normalizeDecimalSeparator(field("leMinVolume").toString());
139 >    maxVolume=Util::String::normalizeDecimalSeparator(field("leMaxVolume").toString());
140 >    pitch=Util::String::normalizeDecimalSeparator(field("lePitch").toString());
141 >    minPitch=Util::String::normalizeDecimalSeparator(field("leMinPitch").toString());
142 >    maxPitch=Util::String::normalizeDecimalSeparator(field("leMaxPitch").toString());
143 >    weight=Util::String::normalizeDecimalSeparator(field("leWeight").toString());
144  
145      preventRepeat=field("cbPreventRepeat").toBool();
146  
# Line 175 | Line 174 | void SoundPageFinal::startProcessing(){
174          priorityImp="Highest";
175      }
176  
177 <    minVolumeDistanceImp=Util::normalizeDecimalSeparator(field("leMinVolumeDistanceImp").toString());
178 <    maxVolumeDistanceImp=Util::normalizeDecimalSeparator(field("leMaxVolumeDistanceImp").toString());
179 <    minAngleImp=Util::normalizeDecimalSeparator(field("leMinAngleImp").toString());
180 <    maxAngleImp=Util::normalizeDecimalSeparator(field("leMaxAngleImp").toString());
181 <    minAttenuationImp=Util::normalizeDecimalSeparator(field("leMinAttenuationImp").toString());
182 <    impactVelocityImp=Util::normalizeDecimalSeparator(field("leImpactVelocityImp").toString());
183 <    minOcclusionImp=Util::normalizeDecimalSeparator(field("leMinOcclusionImp").toString());
177 >    minVolumeDistanceImp=Util::String::normalizeDecimalSeparator(field("leMinVolumeDistanceImp").toString());
178 >    maxVolumeDistanceImp=Util::String::normalizeDecimalSeparator(field("leMaxVolumeDistanceImp").toString());
179 >    minAngleImp=Util::String::normalizeDecimalSeparator(field("leMinAngleImp").toString());
180 >    maxAngleImp=Util::String::normalizeDecimalSeparator(field("leMaxAngleImp").toString());
181 >    minAttenuationImp=Util::String::normalizeDecimalSeparator(field("leMinAttenuationImp").toString());
182 >    impactVelocityImp=Util::String::normalizeDecimalSeparator(field("leImpactVelocityImp").toString());
183 >    minOcclusionImp=Util::String::normalizeDecimalSeparator(field("leMinOcclusionImp").toString());
184  
185      //######################################################### Starting xml processing
186  
187      // Clean tmp dir
188 <    if(!Util::rmDir(GlobalVars::VagoTemporaryDir)){        
189 <        UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't clean vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir);
188 >    if(!Util::FileSystem::rmDir(GlobalVars::VagoTemporaryDir)){
189 >        UtilVago::showAndLogErrorPopUpLogButton("Couldn't clean vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir);
190          return;
191      }
192  
193      if(!QDir(QDir::tempPath()).mkpath("VagoTemp")){
194 <        UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't reconstruct vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir);
194 >        UtilVago::showAndLogErrorPopUpLogButton("Couldn't reconstruct vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir);
195      }
196  
197      // Copy sample xml files to tmp dir
# Line 204 | Line 203 | void SoundPageFinal::startProcessing(){
203      QFile::setPermissions(impFileLocation, QFile::ReadOwner | QFile::WriteOwner);
204  
205      (*this->xmlCommands)
206 <     << "--replace-all-values -e Priority -n "+Util::insertQuotes(priority)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
207 <     << "--replace-all-values -e Flags -n "+(flags.join(" ").isEmpty() ? Util::insertQuotes("") : Util::insertQuotes(flags.join(" ")))+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
208 <     << "--replace-all-values -e SphereRadius -n "+Util::insertQuotes(sphereRadious)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
209 <     << "--replace-all-values -e Treshold -n "+Util::insertQuotes(treshold)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
210 <     << "--replace-all-values -e MinOcclusion -n "+Util::insertQuotes(minOcclusion)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
211 <     << "--replace-all-values --parent-element-name ElapsedTime -e  Max -n "+Util::insertQuotes(maxElapsedTime)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
212 <     << "--replace-all-values --parent-element-name ElapsedTime -e  Min -n "+Util::insertQuotes(minElapsedTime)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
213 <     << "--replace-all-values --parent-element-name Distance -e  Max -n "+Util::insertQuotes(maxVolumeDistance)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
214 <     << "--replace-all-values --parent-element-name Distance -e  Min -n "+Util::insertQuotes(minVolumeDistance)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
215 <     << "--replace-all-values --parent-element-name SoundGroup -e  Volume -n "+Util::insertQuotes(volume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
216 <     << "--replace-all-values --parent-element-name SoundGroup -e  Pitch -n "+Util::insertQuotes(pitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
217 <     << "--replace-all-values --parent-element-name SoundGroup -e  NumberOfChannels -n "+Util::insertQuotes(numberChannels)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
218 <     << "--replace-all-values --parent-element-name Volume -e  Min -n "+Util::insertQuotes(minVolume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
219 <     << "--replace-all-values --parent-element-name Volume -e  Max -n "+Util::insertQuotes(maxVolume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
220 <     << "--replace-all-values --parent-element-name Pitch -e  Min -n "+Util::insertQuotes(minPitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
221 <     << "--replace-all-values --parent-element-name Pitch -e  Max -n "+Util::insertQuotes(maxPitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
222 <     << "--replace-all-values -e  Weight -n "+Util::insertQuotes(weight)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
223 <     << "--replace-all-values -e  Priority -n "+Util::insertQuotes(priorityImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
224 <     << "--replace-all-values --parent-element-name Distance -e  Min -n "+Util::insertQuotes(minVolumeDistanceImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
225 <     << "--replace-all-values --parent-element-name Distance -e  Max -n "+Util::insertQuotes(maxVolumeDistanceImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
226 <     << "--replace-all-values --parent-element-name Angle -e  Min -n "+Util::insertQuotes(minAngleImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
227 <     << "--replace-all-values --parent-element-name Angle -e  Max -n "+Util::insertQuotes(maxAngleImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
228 <     << "--replace-all-values -e  MinAttenuation -n "+Util::insertQuotes(minAttenuationImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
229 <     << "--replace-all-values -e  ImpactVelocity -n "+Util::insertQuotes(impactVelocityImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
230 <     << "--replace-all-values -e  MinOcclusion -n "+Util::insertQuotes(minOcclusionImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose";
206 >     << "--replace-all-values -e Priority -n "+Util::String::insertQuotes(priority)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
207 >     << "--replace-all-values -e Flags -n "+(flags.join(" ").isEmpty() ? Util::String::insertQuotes("") : Util::String::insertQuotes(flags.join(" ")))+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
208 >     << "--replace-all-values -e SphereRadius -n "+Util::String::insertQuotes(sphereRadious)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
209 >     << "--replace-all-values -e Treshold -n "+Util::String::insertQuotes(treshold)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
210 >     << "--replace-all-values -e MinOcclusion -n "+Util::String::insertQuotes(minOcclusion)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
211 >     << "--replace-all-values --parent-element-name ElapsedTime -e  Max -n "+Util::String::insertQuotes(maxElapsedTime)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
212 >     << "--replace-all-values --parent-element-name ElapsedTime -e  Min -n "+Util::String::insertQuotes(minElapsedTime)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
213 >     << "--replace-all-values --parent-element-name Distance -e  Max -n "+Util::String::insertQuotes(maxVolumeDistance)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
214 >     << "--replace-all-values --parent-element-name Distance -e  Min -n "+Util::String::insertQuotes(minVolumeDistance)+" -f "+Util::String::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
215 >     << "--replace-all-values --parent-element-name SoundGroup -e  Volume -n "+Util::String::insertQuotes(volume)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
216 >     << "--replace-all-values --parent-element-name SoundGroup -e  Pitch -n "+Util::String::insertQuotes(pitch)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
217 >     << "--replace-all-values --parent-element-name SoundGroup -e  NumberOfChannels -n "+Util::String::insertQuotes(numberChannels)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
218 >     << "--replace-all-values --parent-element-name Volume -e  Min -n "+Util::String::insertQuotes(minVolume)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
219 >     << "--replace-all-values --parent-element-name Volume -e  Max -n "+Util::String::insertQuotes(maxVolume)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
220 >     << "--replace-all-values --parent-element-name Pitch -e  Min -n "+Util::String::insertQuotes(minPitch)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
221 >     << "--replace-all-values --parent-element-name Pitch -e  Max -n "+Util::String::insertQuotes(maxPitch)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
222 >     << "--replace-all-values -e  Weight -n "+Util::String::insertQuotes(weight)+" -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
223 >     << "--replace-all-values -e  Priority -n "+Util::String::insertQuotes(priorityImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
224 >     << "--replace-all-values --parent-element-name Distance -e  Min -n "+Util::String::insertQuotes(minVolumeDistanceImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
225 >     << "--replace-all-values --parent-element-name Distance -e  Max -n "+Util::String::insertQuotes(maxVolumeDistanceImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
226 >     << "--replace-all-values --parent-element-name Angle -e  Min -n "+Util::String::insertQuotes(minAngleImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
227 >     << "--replace-all-values --parent-element-name Angle -e  Max -n "+Util::String::insertQuotes(maxAngleImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
228 >     << "--replace-all-values -e  MinAttenuation -n "+Util::String::insertQuotes(minAttenuationImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
229 >     << "--replace-all-values -e  ImpactVelocity -n "+Util::String::insertQuotes(impactVelocityImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
230 >     << "--replace-all-values -e  MinOcclusion -n "+Util::String::insertQuotes(minOcclusionImp)+" -f "+Util::String::insertQuotes(impFileLocation)+" --no-backups --no-verbose";
231  
232      if(preventRepeat){
233 <        (*this->xmlCommands) << "--replace-all-values --parent-element-name SoundGroup -e Flags -n PreventRepeat -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose";
233 >        (*this->xmlCommands) << "--replace-all-values --parent-element-name SoundGroup -e Flags -n PreventRepeat -f "+Util::String::insertQuotes(grpFileLocation)+" --no-backups --no-verbose";
234      }
235  
236      myXmlProcessor->start();
# Line 244 | Line 243 | void SoundPageFinal::startProcessing(){
243  
244      for(int i=0; i<this->page2Table->rowCount(); i++){
245  
246 <        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::insertQuotes(outputFolder)+" "+Util::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert
246 >        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::String::insertQuotes(outputFolder)+" "+Util::String::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert
247  
248          currFileName=this->page2Table->item(i,0)->text(); // get current file name
249          currAmbFileLocation = outputFolder + "/" + QString(ambFile).replace("sample_file",currFileName); // get the new files, filenames
# Line 255 | Line 254 | void SoundPageFinal::startProcessing(){
254          QFile::copy(grpFileLocation, currGrpFileLocation);
255          QFile::copy(impFileLocation, currImpFileLocation);
256  
257 <        (*this->xmlCommands) << "--replace-all-values -e BaseTrack1 -n "+Util::insertQuotes(currFileName)+" -f "+Util::insertQuotes(currAmbFileLocation)+" --no-backups --no-verbose" // process the xml
258 <                             << "--replace-all-values -e Sound -n "+Util::insertQuotes(currFileName)+" -f "+Util::insertQuotes(currGrpFileLocation)+" --no-backups --no-verbose"
259 <                             << "--replace-all-values -e Group -n "+Util::insertQuotes(currFileName)+" -f "+Util::insertQuotes(currImpFileLocation)+" --no-backups --no-verbose";
257 >        (*this->xmlCommands) << "--replace-all-values -e BaseTrack1 -n "+Util::String::insertQuotes(currFileName)+" -f "+Util::String::insertQuotes(currAmbFileLocation)+" --no-backups --no-verbose" // process the xml
258 >                             << "--replace-all-values -e Sound -n "+Util::String::insertQuotes(currFileName)+" -f "+Util::String::insertQuotes(currGrpFileLocation)+" --no-backups --no-verbose"
259 >                             << "--replace-all-values -e Group -n "+Util::String::insertQuotes(currFileName)+" -f "+Util::String::insertQuotes(currImpFileLocation)+" --no-backups --no-verbose";
260  
261          myXmlProcessor->start();
262          myXmlProcessor->wait(); // Wait until all xml is edited
263  
264 <        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::insertQuotes(outputFolder)+" "+Util::insertQuotes(currAmbFileLocation);
265 <        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::insertQuotes(outputFolder)+" "+Util::insertQuotes(currGrpFileLocation);
266 <        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::insertQuotes(outputFolder)+" "+Util::insertQuotes(currImpFileLocation);
264 >        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::String::insertQuotes(outputFolder)+" "+Util::String::insertQuotes(currAmbFileLocation);
265 >        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::String::insertQuotes(outputFolder)+" "+Util::String::insertQuotes(currGrpFileLocation);
266 >        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::String::insertQuotes(outputFolder)+" "+Util::String::insertQuotes(currImpFileLocation);
267      }
268  
269      this->myConverter->start(); // finally process the onisplit commands

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)