/// <summary> Make the request to refresh the list of voices. </summary>
        public static void RefreshVoices()
        {
            //Clean old error if there are any.
            connectionError = Error.None;

            //Check connection
            if (!connected)
            {
                Debug.LogError("You needs to be connected to the Resemble API before loading the voices list.");
                return;
            }

            //Make the request
            APIBridge.GetVoices((Voice[] voices, Error error) =>
            {
                if (error)
                {
                    connectionError = error;
                }
                else
                {
                    instance._voices = voices;
                    if (OnRefreshVoices != null)
                    {
                        OnRefreshVoices.Invoke();
                    }
                }
            });
        }
        /// <summary> Make the request to refresh the list of projects. </summary>
        public static void RefreshProjects()
        {
            //Clean old error if there are any.
            connectionError = Error.None;

            //Make the request
            APIBridge.GetProjects((Project[] projects, Error error) =>
            {
                tryToConnect = false;
                if (error)
                {
                    connected       = false;
                    connectionError = error;
                }
                else
                {
                    connected         = true;
                    Settings.projects = projects;

                    if (OnRefreshProjects != null)
                    {
                        OnRefreshProjects.Invoke();
                    }
                }
            });
        }
 /// <summary> Request a delete on a Resemble project. (Show a confirmation dialog before) </summary>
 public static void DeleteProject(Project value)
 {
     if (EditorUtility.DisplayDialog("Delete Resemble project",
                                     string.Format("Are you sure you want to delete the project \"{0}\" ?\n\nThis action will delete " +
                                                   "the resemble project (not only in Unity) and is irreversible !", value.name), "Suppress it anyway", "Cancel"))
     {
         APIBridge.DeleteProject(value);
         projects = projects.ToList().Where(x => x.uuid != value.uuid).ToArray();
     }
 }
 /// <summary> Import all wav files from current project. </summary>
 public static void ImportProjectWavfiles(string path)
 {
     APIBridge.GetClips((ResembleClip[] result, Error error) =>
     {
         if (error)
         {
             error.Log();
         }
         else
         {
             ImportPopup.ImpAsset[] assets = result.Select(x => new ImportPopup.ImpAsset()
             {
                 content = new GUIContent(x.title + ".wav"), import = true, obj = x
             }).ToArray();
             ImportPopup.Show(assets, path, (ImportPopup.ImpAsset[] selecteds) => { DownloadWavFiles(path, selecteds.Where(y => y.import).Select(x => x.obj as ResembleClip).ToArray()); });
         }
     });
 }