/// <summary> /// Sets the path to which to write to. /// If the path contains a non-existent directory, /// it will be created. /// </summary> public string SetPath(string newPath, PathRelativeType newPathType) { path = newPath; pathType = newPathType; _absPath = GATPathsHelper.GetAbsolutePath(newPath, newPathType, true); return(_absPath); }
/// <summary> /// Convenience method for loading files asynchronously /// to a sample bank. All wav and ogg files of the specified folder /// will be loaded. /// This method instantiates, configures and enqueues a AGATLoadingOperation. /// Use the NewOperation method if you need more control over progress callbacks. /// </summary> public void LoadFolderToSampleBank(string folderPath, PathRelativeType pathType, GATSampleBank targetBank, GATDataAllocationMode allocationMode, OperationCompletedHandler onOperationCompleted, bool forceMono = false) { folderPath = GATPathsHelper.GetAbsolutePath(folderPath, pathType, false); if (Directory.Exists(folderPath) == false) { throw new GATException("No such directory!"); } string[] files = Directory.GetFiles(folderPath); if (files.Length == 0) { #if UNITY_EDITOR || GAT_DEBUG Debug.LogError("Directory exists but is empty"); #endif return; } LoadFilesToSampleBank(files, PathRelativeType.Absolute, targetBank, allocationMode, onOperationCompleted, forceMono); }
public override bool AddFile(string relativePath, PathRelativeType pathType) { string extension; if (Status != LoadOperationStatus.Configuring) { #if UNITY_EDITOR || GAT_DEBUG Debug.LogError("Cannot add file to operation in progress!"); #endif return(false); } extension = System.IO.Path.GetExtension(relativePath).ToLower(); if (extension != ".wav" && extension != ".ogg") { #if UNITY_EDITOR || GAT_DEBUG Debug.LogError("Only ogg and wav files supported by GATAsyncAudioLoader, ignoring " + relativePath); #endif return(false); } string path = GATPathsHelper.GetAbsolutePath(relativePath, pathType, false); if (System.IO.File.Exists(path) == false) { #if UNITY_EDITOR || GAT_DEBUG Debug.LogError("File not found, ignoring " + path); #endif return(false); } _paths.Enqueue(path); return(true); }