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

Comparing Vago/trunk/Vago/soundWizard/soundpagefinal.cpp (file contents):
Revision 1047 by s10k, Fri Sep 16 22:51:26 2016 UTC vs.
Revision 1059 by s10k, Sun Oct 30 16:01:17 2016 UTC

# Line 45 | Line 45 | void SoundPageFinal::startProcessing(){
45      // Sample files names
46      QString ambFile="OSBDsample_file.amb.xml";
47      QString grpFile="OSBDsample_file.grp.xml";
48 +    QString impFile="OSBDsample_file.imp.xml";
49      QString ambFileLocation=GlobalVars::VagoTemporaryDir+"/"+ambFile;
50      QString grpFileLocation=GlobalVars::VagoTemporaryDir+"/"+grpFile;
51 +    QString impFileLocation=GlobalVars::VagoTemporaryDir+"/"+impFile;
52  
53      // Page 2 variables
54      QString outputFolder;
# Line 68 | Line 70 | void SoundPageFinal::startProcessing(){
70      bool preventRepeat=false;
71      bool stereo22=false, mono22=false, mono44Pc=false;
72  
73 +    // Page 5 variables
74 +    QString minVolumeDistanceImp, maxVolumeDistanceImp, minAngleImp,
75 +            maxAngleImp, minAttenuationImp, impactVelocityImp,
76 +            minOcclusionImp, priorityImp;
77 +    bool priorityLowImp = false, priorityNormalImp = false,
78 +            priorityHighImp = false, priorityHighestImp = false;
79 +
80 +    // Create temp folder if it doesn't exist
81 +    if(!QDir(GlobalVars::VagoTemporaryDir).exists()){
82 +        QDir().mkdir(GlobalVars::VagoTemporaryDir);
83 +    }
84 +
85      // Get data page 2
86      if(field("rbOther").toBool()){
87          outputFolder=field("leOtherLocation").toString();
# Line 76 | Line 90 | void SoundPageFinal::startProcessing(){
90          outputFolder=this->soundsLocation;
91      }
92  
79    outputFolder = Util::insertQuotes(outputFolder); // for onisplit work correctly
80
93      // Get data page 3
94  
95      priorityLow=field("rbPriorityLow").toBool();
# Line 144 | Line 156 | void SoundPageFinal::startProcessing(){
156      else if(mono22){
157          numberChannels="1";
158      }
159 +
160 +    // Get data page 5
161 +    priorityLowImp=field("rbPriorityLowImp").toBool();
162 +    priorityNormalImp=field("rbPriorityNormalImp").toBool();
163 +    priorityHighImp=field("rbPriorityHighImp").toBool();
164 +    priorityHighestImp=field("rbPriorityHighestImp").toBool();
165 +
166 +    if(priorityNormalImp){
167 +        priorityImp="Normal";
168 +    }
169 +    else if(priorityLowImp){
170 +        priorityImp="Low";
171 +    }
172 +    else if(priorityHighImp){
173 +        priorityImp="High";
174 +    }
175 +    else if(priorityHighestImp){
176 +        priorityImp="Highest";
177 +    }
178 +
179 +    minVolumeDistanceImp=Util::normalizeDecimalSeparator(field("leMinVolumeDistanceImp").toString());
180 +    maxVolumeDistanceImp=Util::normalizeDecimalSeparator(field("leMaxVolumeDistanceImp").toString());
181 +    minAngleImp=Util::normalizeDecimalSeparator(field("leMinAngleImp").toString());
182 +    maxAngleImp=Util::normalizeDecimalSeparator(field("leMaxAngleImp").toString());
183 +    minAttenuationImp=Util::normalizeDecimalSeparator(field("leMinAttenuationImp").toString());
184 +    impactVelocityImp=Util::normalizeDecimalSeparator(field("leImpactVelocityImp").toString());
185 +    minOcclusionImp=Util::normalizeDecimalSeparator(field("leMinOcclusionImp").toString());
186 +
187      //######################################################### Starting xml processing
188  
189      // Clean tmp dir
# Line 159 | Line 199 | void SoundPageFinal::startProcessing(){
199      // Copy sample xml files to tmp dir
200      QFile::copy(":/new/sampleFiles/"+ambFile , ambFileLocation);
201      QFile::copy(":/new/sampleFiles/"+grpFile , grpFileLocation);
202 +    QFile::copy(":/new/sampleFiles/"+impFile , impFileLocation);
203      QFile::setPermissions(ambFileLocation, QFile::ReadOwner | QFile::WriteOwner); //remove read only attribute that come from resources
204      QFile::setPermissions(grpFileLocation, QFile::ReadOwner | QFile::WriteOwner);
205 +    QFile::setPermissions(impFileLocation, QFile::ReadOwner | QFile::WriteOwner);
206  
207      (*this->xmlCommands)
208       << "--replace-all-values -e Priority -n "+Util::insertQuotes(priority)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
# Line 168 | Line 210 | void SoundPageFinal::startProcessing(){
210       << "--replace-all-values -e SphereRadius -n "+Util::insertQuotes(sphereRadious)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
211       << "--replace-all-values -e Treshold -n "+Util::insertQuotes(treshold)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
212       << "--replace-all-values -e MinOcclusion -n "+Util::insertQuotes(minOcclusion)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
213 +     << "--replace-all-values --parent-element-name ElapsedTime -e  Max -n "+Util::insertQuotes(maxElapsedTime)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
214       << "--replace-all-values --parent-element-name ElapsedTime -e  Min -n "+Util::insertQuotes(minElapsedTime)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
215       << "--replace-all-values --parent-element-name Distance -e  Max -n "+Util::insertQuotes(maxVolumeDistance)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
216       << "--replace-all-values --parent-element-name Distance -e  Min -n "+Util::insertQuotes(minVolumeDistance)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose"
# Line 178 | Line 221 | void SoundPageFinal::startProcessing(){
221       << "--replace-all-values --parent-element-name Volume -e  Max -n "+Util::insertQuotes(maxVolume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
222       << "--replace-all-values --parent-element-name Pitch -e  Min -n "+Util::insertQuotes(minPitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
223       << "--replace-all-values --parent-element-name Pitch -e  Max -n "+Util::insertQuotes(maxPitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
224 <     << "--replace-all-values -e  Weight -n "+Util::insertQuotes(weight)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose";
224 >     << "--replace-all-values -e  Weight -n "+Util::insertQuotes(weight)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"
225 >     << "--replace-all-values -e  Priority -n "+Util::insertQuotes(priorityImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
226 >     << "--replace-all-values --parent-element-name Distance -e  Min -n "+Util::insertQuotes(minVolumeDistanceImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
227 >     << "--replace-all-values --parent-element-name Distance -e  Max -n "+Util::insertQuotes(maxVolumeDistanceImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
228 >     << "--replace-all-values --parent-element-name Angle -e  Min -n "+Util::insertQuotes(minAngleImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
229 >     << "--replace-all-values --parent-element-name Angle -e  Max -n "+Util::insertQuotes(maxAngleImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
230 >     << "--replace-all-values -e  MinAttenuation -n "+Util::insertQuotes(minAttenuationImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
231 >     << "--replace-all-values -e  ImpactVelocity -n "+Util::insertQuotes(impactVelocityImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose"
232 >     << "--replace-all-values -e  MinOcclusion -n "+Util::insertQuotes(minOcclusionImp)+" -f "+Util::insertQuotes(impFileLocation)+" --no-backups --no-verbose";
233  
234      if(preventRepeat){
235          (*this->xmlCommands) << "--replace-all-values --parent-element-name SoundGroup -e Flags -n PreventRepeat -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose";
# Line 190 | Line 241 | void SoundPageFinal::startProcessing(){
241      QString currFileName;
242      QString currGrpFileLocation;
243      QString currAmbFileLocation;
244 +    QString currImpFileLocation;
245  
246      for(int i=0; i<this->page2Table->rowCount(); i++){
247  
248 <        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert
248 >        (*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
249  
250          currFileName=this->page2Table->item(i,0)->text(); // get current file name
251 <        currAmbFileLocation = QString(ambFileLocation).replace("sample_file",currFileName); // get the new files, filenames
252 <        currGrpFileLocation = QString(grpFileLocation).replace("sample_file",currFileName);
251 >        currAmbFileLocation = outputFolder + "/" + QString(ambFile).replace("sample_file",currFileName); // get the new files, filenames
252 >        currGrpFileLocation = outputFolder + "/" + QString(grpFile).replace("sample_file",currFileName);
253 >        currImpFileLocation = outputFolder + "/" + QString(impFile).replace("sample_file",currFileName);
254  
255          QFile::copy(ambFileLocation, currAmbFileLocation); // make a copy of the sample files that will be the real files
256          QFile::copy(grpFileLocation, currGrpFileLocation);
257 +        QFile::copy(impFileLocation, currImpFileLocation);
258  
259          (*this->xmlCommands) << "--replace-all-values -e BaseTrack1 -n "+Util::insertQuotes(currFileName)+" -f "+Util::insertQuotes(currAmbFileLocation)+" --no-backups --no-verbose" // process the xml
260 <                             << "--replace-all-values -e Sound -n "+Util::insertQuotes(currFileName)+" -f "+Util::insertQuotes(currGrpFileLocation)+" --no-backups --no-verbose";
260 >                             << "--replace-all-values -e Sound -n "+Util::insertQuotes(currFileName)+" -f "+Util::insertQuotes(currGrpFileLocation)+" --no-backups --no-verbose"
261 >                             << "--replace-all-values -e Group -n "+Util::insertQuotes(currFileName)+" -f "+Util::insertQuotes(currImpFileLocation)+" --no-backups --no-verbose";
262  
263          myXmlProcessor->start();
264          myXmlProcessor->wait(); // Wait until all xml is edited
210    }
265  
266 <    (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(GlobalVars::VagoTemporaryDir+"/*.xml");
266 >        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::insertQuotes(outputFolder)+" "+Util::insertQuotes(currAmbFileLocation);
267 >        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::insertQuotes(outputFolder)+" "+Util::insertQuotes(currGrpFileLocation);
268 >        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+Util::insertQuotes(outputFolder)+" "+Util::insertQuotes(currImpFileLocation);
269 >    }
270  
271      this->myConverter->start(); // finally process the onisplit commands
272      this->myConverter->wait(); // wait for it to complete
216
217    // Finally remove the sample files, since not needed anymore
218    QFile(ambFileLocation).remove();
219    QFile(grpFileLocation).remove();
273   }
274  
275   void SoundPageFinal::catchXmlAndOSplitProcessingError(QString result, int numErrors){
# Line 224 | Line 277 | void SoundPageFinal::catchXmlAndOSplitPr
277      if(numErrors!=0){
278          QString sNumErrors=QString::number(numErrors);
279          if(numErrors>1){
280 <            UtilVago::showErrorPopUpLogButton(result+"\n This is the last of " + sNumErrors + " Errors.");
280 >            UtilVago::showErrorPopUpLogButton(result+"\n This is the last of " + sNumErrors + " errors.");
281          }
282          else{
283              UtilVago::showErrorPopUpLogButton(result);

Diff Legend

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