//Find current song's beats and how it matches the target public bool MatchSong(TrackArtifacts target) { bool temp = false; Debug.Log ("Finding Beat Match"); for (int j=0; j<beatDifferenceOneStep.Count-1; j=j+2) { for (int i=0; i<target.beatDifferenceOneStep.Count-1; i=i+2) { if(beatDifferenceOneStep[j] == target.beatDifferenceOneStep[i]){ if(beatDifferenceOneStep[j+1] == target.beatDifferenceOneStep[i+1]){ // if(beatDifferenceOneStep[j+2] == target.beatDifferenceOneStep[i+2]){ Debug.Log ("Found a match at source[" + j + "] and target[" + i + "]: \n" ); if(MatchUpNotes(target, j, i)){ Debug.Log ("Found a TRUE match at source[" + j + "] and target[" + i + "]: \n" ); match=j; targetMatch=i; temp = true; // j=beatDifferenceOneStep.Count-1;//terminate loop // i=target.beatDifferenceOneStep.Count-1;//terminate loop } // } } } } } return temp; }
bool MatchUpNotes(TrackArtifacts other, int pseudoMatch, int pseudoTargetMatch) { Debug.Log ("MatchUpNotes(): noteSetCount: " + noteSetCount + "(" +pseudoMatch +"," +pseudoTargetMatch+")"); int matched=0; for (int i=0; i<noteStorage[pseudoMatch].Length; i++) { for(int j=0; j<other.noteStorage[pseudoTargetMatch].Length; j++){ if(noteStorage[pseudoMatch][i] == other.noteStorage[pseudoTargetMatch][j]){ matched++; } } } if (matched > 3) { return true; } else { return false; } }