static void DropRemainingReferences(ref AudioEncoderConfig config, ref AODLoadSheet loadSheet, ref AudioEncoderController controller) { //Release the rest of used memory config = null; loadSheet = null; controller = null; GC.Collect(); }
public AudioEncoderController(AODLoadSheet loadsheet) { _LoadSheet = loadsheet; _Config = loadsheet.Config; _ActiveSearches = new List <AODLoadSheetRow>(); _ActiveEncodings = new List <AudioFileEncoding>(); _FinishedEncodings = new List <AudioFileEncoding>(); _WaitingEncodings = new List <AudioFileEncoding>(); _IsQueueBuilt = false; }
static void Main() { AudioEncoderConfig config = new AudioEncoderConfig(); AudioLibrary audioLibrary = new AudioLibrary(config); audioLibrary.ScanAudioLibrary(); //DEBUG Methods------------------------------------------ //audioLibrary.PrintAudioLibraryFileInfo_DEBUG(); //audioLibrary.PrintUniqueTrackNumberPatterns_DEBUG(); //audioLibrary.PrintUniqueFileExtensions_DEBUG(); //------------------------------------------------------- AODLoadSheet loadSheet = new AODLoadSheet(config); loadSheet.ReadLoadSheet(); //DEBUG Methods------------------------------------------ //loadSheet.PrintAODLoadSheetPretty_DEBUG(); //loadSheet.PrintCharactersFoundList_DEBUG(); //loadSheet.PrintTokensPerRowAllRows_DEBUG(); //loadSheet.SortAODLoadSheetByLSRCharCount_DEBUG(); //------------------------------------------------------- AudioEncoderController controller = new AudioEncoderController(loadSheet); controller.SearchForSourceAudioFiles(audioLibrary); //DEBUG Methods------------------------------------------ //controller.PrintApprovedLoadSheetRows_DEBUG(); //controller.PrintAlreadyEncodedFiles_DEBUG(); //controller.PrintEncodingQueue_DEBUG(); //------------------------------------------------------- DropAudioLibrary(ref audioLibrary); controller.EncodeAudioFiles(); DropRemainingReferences(ref config, ref loadSheet, ref controller); ConsolePrintHelpers.PressAnyKeyToExit(); }
public void QuickSearchForSuggestedAudioFile(AudioLibrary audioLibrary, AODLoadSheetRow previousLSR, AODLoadSheet parentLoadsheet) { //quick search 1st attempt (lookup if any prior row had identical qualities (aka hash) and shortcut to past results) foreach (AODLoadSheetRow pastLSR in parentLoadsheet.GetAODLoadSheetRows) { if (pastLSR.LoadSheetRowNumber >= _LoadSheetRowNumber) { if (_QuickSearchNotePastLSR == "None") { _QuickSearchNotePastLSR = "No Hash Matches"; } break; } if (_LoadSheetRowHash == pastLSR.LoadSheetRowHash) //identical past loadsheet row (exact replica repeat row) { if (pastLSR.IsSuggestedAudioFileAssigned) { _IsQuickSearchActive = true; _QuickSearchNotePastLSR = "Replica Match"; _Tokens = pastLSR.Tokens; _SearchCollection = pastLSR.SearchCollection; AssignSuggestedAudioFile(); return; } else { _QuickSearchNotePastLSR = "Past Suggested File Not Assigned"; } } } //quick search 2nd attempt (scan previous row's parent directory) if (!previousLSR.IsSuggestedAudioFileAssigned) { AODLoadSheetRow mostRecentAssignedRow = parentLoadsheet.GetMostRecentAssignedRow(this); if (mostRecentAssignedRow != null) { previousLSR = mostRecentAssignedRow; } } if (previousLSR.IsSuggestedAudioFileAssigned) { string previousLSRSubDirPath = previousLSR.SuggestedAudioFile.SubDirectoriesPath; AudioLibrary quickSearchLibrary = audioLibrary.GetQuickAudioLibrarySubset(previousLSRSubDirPath); _SearchCollection = AudioFileSearch.GetBestSearchCollection(quickSearchLibrary, this); if (_SearchCollection.IsOptionQuickSearchElligible(_SearchCollection.BestOption, SearchMethodType.Both, Globals.HighAccuracyThreshold)) //high scoring and not too many options in final pool { _IsQuickSearchActive = true; _QuickSearchNotePreviousLSR = "Met HighAccuracyThreshold"; AssignSuggestedAudioFile(); return; } else { if (_SearchCollection.BestOption.AccuracyScore < Globals.HighAccuracyThreshold) { _QuickSearchNotePreviousLSR = "Missed HighAccuracyThreshold"; } else if (_SearchCollection.ChosenFinalPassCount > 1) { _QuickSearchNotePreviousLSR = "Missed TooManyFinalOptionsThreshold"; } _SearchCollection = null; return; } } else { _QuickSearchNotePreviousLSR = "Previous Suggested File Not Assigned"; } }