/// <summary> /// Play Audio Clip on AudioSource. /// </summary> public void Play(AudioSource audioSource, SoundTypeEnum soundTypeEnum) { var clipData = _soundClipDataDict[soundTypeEnum]; audioSource.volume = clipData.volume; audioSource.clip = clipData.clip; }
/// <summary> /// play bgm sound. /// </summary> public static void PlayBgm(SoundTypeEnum soundTypeEnum) { SoundPlayManager.Instance.Play(SoundType.Bgm, soundTypeEnum); }
/// <summary> /// play Sfx sound. /// </summary> public static void PlaySfx(SoundTypeEnum soundTypeEnum) { SoundPlayManager.Instance.PlayOneShot(SoundType.Sfx, soundTypeEnum); }
/// <summary> /// Play One Shot Audio Clip on AudioSource. /// </summary> public void PlayOneShot(AudioSource audioSource, SoundTypeEnum soundTypeEnum) { var clipData = _soundClipDataDict[soundTypeEnum]; audioSource.PlayOneShot(clipData.clip, clipData.volume); }
/// <summary> /// Play One Shot Audio Clip. /// </summary> public void PlayOneShot(SoundType soundType, SoundTypeEnum soundTypeEnum) { PlayOneShot(_soundPlayComponent.AudioSource(soundType), soundTypeEnum); }
public static async Task GenerateAudioAsync(this VideoInfo video, System.IO.FileInfo audiofile, AudioEncodingEnum audioEncoding = AudioEncodingEnum.mp3, SoundTypeEnum channels = SoundTypeEnum.Stereo, int audioBitRate = 128, int audioFrequency = 44100) { var ffmpeg = new FFMpeg(Logger); await ffmpeg.GenerateAudioAsync(video, audiofile, audioEncoding, channels, audioBitRate, audioFrequency); }
public async Task GenerateAudioAsync(VideoInfo video, System.IO.FileInfo Audiofile, AudioEncodingEnum AudioEncoding = AudioEncodingEnum.mp3, SoundTypeEnum Channels = SoundTypeEnum.Stereo, int AudioBitRate = 128, int AudioFrequency = 44100) { if (Audiofile.Exists) { Audiofile.Delete(); } var FNWE = video.File.FileNameWithoutExtension() + "_Audio"; var TempDirectory = new System.IO.DirectoryInfo(video.File.Directory.FullName + @"\.Temp\" + DateTime.Now.Year + DateTime.Now.Month.ToString("00") + DateTime.Now.Day.ToString("00")); if (!TempDirectory.Exists) { TempDirectory.Create(); } System.IO.FileInfo TempLogFile = new System.IO.FileInfo(TempDirectory.FullName + @"\" + FNWE + ".log"); if (TempLogFile.Exists) { TempLogFile.Delete(); } _logger.LogDebug("Grabbing Audio"); var LogData = await RunFFMpegAsync("-i \"" + video.File.FullName + "\" -vn -acodec " + AudioEncoding.AudioFormat() + " -ab " + AudioBitRate + "k -ac " + System.Convert.ToInt32(Channels) + " -ar " + AudioFrequency + " -y \"" + Audiofile.FullName + "\""); var SW = new System.IO.StreamWriter(TempLogFile.OpenWrite()); SW.Write(LogData); SW.Close(); if (EncodingState == EncodingStateEnum.Not_Encoding) { throw new Exception("No audio was encoded.\n\r" + LogData); } _logger.LogDebug("Audio Grabbed"); Audiofile.Refresh(); }