Inheritance: UnityEngine.MonoBehaviour
示例#1
0
        /// <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 );
        }
示例#2
0
        /// <summary>
        /// Convenience method for loading files asynchronously
        /// to a sample bank. This method instantiates, configures and 
        /// enqueues a AGATLoadingOperation. Use NewOperation if you need 
        /// more control over progress callbacks.
        /// </summary>
        public void LoadFilesToSampleBank( string[] filePaths, PathRelativeType pathType, GATSampleBank targetBank, GATDataAllocationMode allocationMode, OperationCompletedHandler onOperationCompleted, bool forceMono = false )
        {
            AGATLoadingOperation operation = new LoadingOperation( allocationMode, filePaths.Length, targetBank.AddLoadedFile, forceMono );
            int i;
            for( i = 0; i < filePaths.Length; i++ )
            {
                operation.AddFile( filePaths[ i ], pathType );
            }

            operation.OnOperationCompleted = onOperationCompleted;

            EnqueueOperation( operation );
        }
示例#3
0
        /// <summary>
        /// Convenience method for loading files asynchronously
        /// to a sample bank. This method instantiates, configures and
        /// enqueues a AGATLoadingOperation. Use NewOperation if you need
        /// more control over progress callbacks.
        /// </summary>
        public void LoadFilesToSampleBank(string[] filePaths, PathRelativeType pathType, GATSampleBank targetBank, GATDataAllocationMode allocationMode, OperationCompletedHandler onOperationCompleted, bool forceMono = false)
        {
            AGATLoadingOperation operation = new LoadingOperation(allocationMode, filePaths.Length, targetBank.AddLoadedFile, forceMono);
            int i;

            for (i = 0; i < filePaths.Length; i++)
            {
                operation.AddFile(filePaths[i], pathType);
            }

            operation.OnOperationCompleted = onOperationCompleted;

            EnqueueOperation(operation);
        }
示例#4
0
        /// <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);
        }
示例#5
0
 void OnEnable()
 {
     _sampleBank = target as GATSampleBank;
 }