From ed583ae15016947ffc7bfd481d7d58c9d77f4a56 Mon Sep 17 00:00:00 2001 From: Sever Date: Tue, 12 Jul 2022 14:59:45 -0500 Subject: [PATCH] --- --- CMOD/src/Event.cpp | 21 ++++++++++----------- CMOD/src/Matrix.cpp | 13 ++++++++++--- CMOD/src/Random.cpp | 2 +- CMOD/src/Random.h | 6 ++---- CMOD/src/Utilities.cpp | 35 +++++++++++++++++++++++++++++++---- 5 files changed, 54 insertions(+), 23 deletions(-) diff --git a/CMOD/src/Event.cpp b/CMOD/src/Event.cpp index 6695733..025a006 100644 --- a/CMOD/src/Event.cpp +++ b/CMOD/src/Event.cpp @@ -390,6 +390,7 @@ void Event::buildChildren() { case 3: eventclass = "------L : ";break; } //Build the event's children. + //cout << "Event::buildChildren - name: " << name << endl; //Create the event definition iterator. /* @@ -658,10 +659,6 @@ bool Event::buildSweep() { && Utilities::isSieveFunction(childDurationElement) && startType == "1" && durType == "1"); -/* -cout << boolalpha << align << sieveAligned << endl; -int sT; cin >> sT; -*/ // find start time and dur of last child if (currChildNum == 0) { @@ -764,15 +761,16 @@ int sT; cin >> sT; } if(startType == "1" && durType == "1") { -/* -cout << " - previousChildEndTime=" << previousChildEndTime << endl; -cout << " " <(); tsChild.startEDU = Ratio((int)rawChildStartTime, 1); - +//cout << "FIN: tsChild.start=" << tsChild.start << " endTime=" << endTime << endl; +//cin >> sT; + rawChildDuration = endTime - rawChildStartTime; int rawChildDurationInt = (int)rawChildDuration; tsChild.durationEDU = Ratio(rawChildDurationInt, 1); @@ -1189,6 +1187,7 @@ int Event::getAvailableEDU() int myDurationInt = (int)ts.duration; Ratio EDUs; float durationScalar; + if(ts.duration == (float)myDurationInt) { //Since duration is an integer, it may still be possible to have exact EDUs. @@ -1470,6 +1469,6 @@ int Event::verify_valid(int endTime){ } //cout << "endTime: " << eTime << " high_n: " << valid_time[high] << " low_n: " << valid_time[low] << endl; int offset = attackSweep[high] - eTime <= eTime - attackSweep[low] ? attackSweep[high] - eTime : attackSweep[low] - eTime; - //cout << "endTime: " << endTime << " choose: " << endTime + offset << endl; + cout << "endTime: " << endTime << " choose: " << endTime + offset << endl; return endTime + offset; } diff --git a/CMOD/src/Matrix.cpp b/CMOD/src/Matrix.cpp index 3cf1871..96e923d 100644 --- a/CMOD/src/Matrix.cpp +++ b/CMOD/src/Matrix.cpp @@ -179,7 +179,7 @@ void Matrix::setDurations(Sieve* durSieve, int maxVal, vector durEnvs if(type != oldType) { cout << "Matrix::setDurations - envelope for type " << type << endl; durEnvs[type] -> print(); - int sever; cin >> sever; + int sever; cin >> sever; oldType = type; } */ @@ -194,6 +194,7 @@ void Matrix::setDurations(Sieve* durSieve, int maxVal, vector durEnvs << "][" << durNum << "].stime=" << matr[type][attNum][durNum].stime << " matr[" << type << "][" << attNum << "][" << durNum << "].attdurprob=" << matr[type][attNum][durNum].attdurprob << endl; + int sever; cin >> sever; */ if (( sieveAligned && att.count(durEnd % tempo.getEDUPerTempoBeat().Num()) == 0 @@ -247,6 +248,8 @@ MatPoint Matrix::chooseSweep(int remain) { return chosenPt; } + +//---------------------------------------------------------------------------// MatPoint Matrix::chooseContinuum() { return choose(); } @@ -419,9 +422,13 @@ int Matrix::verify_valid(int endTime){ return endTime; } } -//cout << "endTime: " << eTime << " high_n: " << valid_time[high] << " low_n: " << valid_time[low] << endl; +/* +cout << "Matrix:verify_valid - endTime: " << eTime << " high=" << high + << " low=" << low << endl; +//<< " high_n: " << valid_time[high] << " low_n: " << valid_time[low] +*/ int offset = short_attime[high] - eTime <= eTime - short_attime[low] ? short_attime[high] - eTime : short_attime[low] - eTime; - //cout << "endTime: " << endTime << " choose: " << endTime + offset << endl; +//cout << "endTime: " << endTime << " choose: " << endTime + offset << endl; return endTime + offset; } diff --git a/CMOD/src/Random.cpp b/CMOD/src/Random.cpp index 3a60ff2..a7c3ed4 100644 --- a/CMOD/src/Random.cpp +++ b/CMOD/src/Random.cpp @@ -107,7 +107,7 @@ int Random::RandInt(int lowNum, int highNum) { //----------------------------------------------------------------------------// -int Random::RandOrderInt(int low, int high, int numChildren, int id) { +int Random::RandOrderInt(int low, int high, int id) { static map > choicesMap; // Initialize choices if a new random order function is found, or diff --git a/CMOD/src/Random.h b/CMOD/src/Random.h index 2df58fb..1682314 100644 --- a/CMOD/src/Random.h +++ b/CMOD/src/Random.h @@ -89,13 +89,11 @@ class Random { * * Returns a random integer in the range [low, high]. * Avoids repetition, given that - * - number of children is greater than or equal to * range of [low, high] - * - every RandomOrderInt function with range [low, high] and - * numChildren is unique + * - every RandomOrderInt function with range [low, high] is unique * @param id - Distinguishes between unique calls of the randOrderInt function */ - static int RandOrderInt(int low, int high, int numChildren, int id); + static int RandOrderInt(int low, int high, int id); /** * Randomly chooses a value from a list. diff --git a/CMOD/src/Utilities.cpp b/CMOD/src/Utilities.cpp index 41f9f68..d2a2aa0 100644 --- a/CMOD/src/Utilities.cpp +++ b/CMOD/src/Utilities.cpp @@ -704,10 +704,12 @@ Sieve* Utilities::evaluateSieveFunction(string _functionString,void* _object){ // cout << "Sieve* Utilities::evaluateSieveFunction - ValuePick" << endl; resultSieve = sieve_ValuePick(root, _object); } +/* else if (functionName.compare("PREVIOUS_CHILD_DURATION")==0) { // cout << "Sieve* Utilities::evaluateSieveFunction - PREVIOUS " << endl; resultSieve = NULL; } +*/ delete parser; return resultSieve; @@ -1111,6 +1113,30 @@ Sieve* Utilities::sieve_ValuePick(DOMElement* _functionElement, void* _object){ eMethod.c_str(), wMethod.c_str(), eArgs[0], wArgVect, offsetVect); + +/* added by Sever + vector attTimes; + vector attProbs; + + si.FillInVectors(attTimes, attProbs); +cout << " sieve_ValuePick - attTimes.size()=" << attTimes.size() << endl; + int beatEDUs; + beatEDUs = _tempo.getEDUPerTimeSignatureBeat().Num(); +cout << " beatEDUs=" << beatEDUs << endl; + + for(int i = 0; i < attTimes.size(); i++){ + + if(attTimes[i] > eArgs.size()){ + break; + } + + // short_attime.push_back(attTimes[i]); + cout << " attTimes.size=" << attTimes.size() << endl; + cout << attTimes[i] << " , "; + } + cout << endl; +*/ + } else { si.Build(minVal, maxVal, eMethod.c_str(), wMethod.c_str(), eArgVect, wArgVect, offsetVect); } @@ -1222,8 +1248,9 @@ string Utilities::function_Select(DOMElement* _functionElement, void* _object){ char result [50]; /* for(int i=0; i