public static void ImportAll() { foreach (KeyValuePair <string, AudioDetail> item in AudioDetailMap) { AudioDetail audioDetail = item.Value; DealAudioPath(item.Key, audioDetail.forceMono, audioDetail.bSensitive, audioDetail.compressSampleRate); } Debug.Log("所有音频设置完成"); }
public ActionResult GetAudioDetailList() { var stream = HttpContext.Request.InputStream; string requestJson = new StreamReader(stream).ReadToEnd(); //json 字符串在此 JObject jo = (JObject)JsonConvert.DeserializeObject(requestJson); int audeoCollectionId = Convert.ToInt32(jo["audioId"].ToString()); AudioCollections audeoCollection = db.AudioCollections.Find(audeoCollectionId); List <Audios> audios = db.Audios.Where(item => item.AudioCollectionId == audeoCollectionId).ToList(); AudioDetailData audioDetailData = new AudioDetailData(); audioDetailData.Id = audeoCollection.Id; audioDetailData.Title = audeoCollection.Title; audioDetailData.CreateTime = audeoCollection.CreateTime.ToString("yyyy-MM-dd"); audioDetailData.Level = audeoCollection.Grade; audioDetailData.Tags = audeoCollection.Tags; audioDetailData.Content = "/admin/audio/preview/" + audeoCollectionId; List <AudioDetail> videoDetails = new List <AudioDetail>(); foreach (Audios audio in audios) { AudioDetail audioDetail = new AudioDetail(); audioDetail.Id = audio.Id; int originalWidth = 0; int originalHeight = 0; if (audio.AudioIndex != null) { audioDetail.PicAD = audio.AudioIndex; System.Drawing.Image imgOriginal = System.Drawing.Image.FromFile(Server.MapPath(HttpUtility.UrlDecode(audio.AudioIndex))); originalWidth = imgOriginal.Width; originalHeight = imgOriginal.Height; } else { audioDetail.PicAD = ""; } audioDetail.PicWidth = originalWidth; audioDetail.PicHeight = originalHeight; audioDetail.Title = audio.Title; if (audio.AudioLink != null) { audioDetail.AudioLink = audio.AudioLink; } else { audioDetail.AudioLink = ""; } videoDetails.Add(audioDetail); } audioDetailData.AudioDetail = videoDetails; return(Json(new { data = audioDetailData })); }
//导入后处理 void OnPostprocessAudio(AudioClip clip) { Debug.Log("[AudioPostProcess]音频后处理!" + assetPath); foreach (KeyValuePair <string, AudioDetail> item in ImporterAudio.AudioDetailMap) { if (this.assetPath.Contains(item.Key)) { AudioImporter importer = (AudioImporter)assetImporter; AudioDetail audioDetail = item.Value; ImporterAudio.DealAudioImporter(clip, importer, audioDetail.forceMono, audioDetail.bSensitive, audioDetail.compressSampleRate); break; } } }
public override void AddObjectDetail(Object obj, Object refObj, Object detailRefObj) { AudioClip clip = obj as AudioClip; if (clip == null) { return; } ObjectDetail detail = null; //先查缓存 foreach (var checker in CheckList) { if (checker.checkObject == obj) { detail = checker; } } if (detail == null) { detail = new AudioDetail(obj, this); } detail.AddObjectReference(refObj, detailRefObj); }