private void InstanceOnAudioRequestReceived(object sender, AudioArgs args) { var audioFile = fileInputs[soundMappings[args.Sound]]; audioFile.Stop(); audioFile.Reset(); if (args.Sound == Sound.BackgroundMusic1 || args.Sound == Sound.BackgroundMusic2) { StopAllBackgroundMusic(); audioFile.LoopCount = int.MaxValue; if (BackgroundMusic) { audioFile.Start(); } } else { if (SoundEffects) { audioFile.Start(); } } }
static void Main(string[] args) { var ffmpeg = new EncodingEngine(@"C:\ffmpeg\ffmpeg.exe"); //var arguments = new EncodingArgs(); var job = new EncodingJob(); var videoArgs = new VideoArgs(); var audioArgs = new AudioArgs(); var inputFile = @"C:\input\test File.wtv"; //var outputFile = @"C:\videos\test Convert1.mkv"; //var outputFile = @"C:\videos\testConvert1 thumb.jpg"; //var audioOutputFile = @"C:\videos\testMp3.mp3"; //var outputFile = @"C:\videos\test_ExtractedAudioAc3.ac3"; var outputFile = @"C:\videos\test_ExtractedVideoStream1.ts"; //video convert //job.Arguments = videoArgs.Convert(inputFile,VideoEncoder.Libx264, VideoResize.TV720p, // VideoPreset.VeryFast, ConstantRateFactor.CrfNormal, AudioCodec.Ac3, outputFile); //get video frame //job.Arguments = vargs.GetFrame(inputFile, 20, FrameSize.SizeThumbnail, outputFile); //convert audio from video //job.Arguments = audioArgs.Convert(inputFile,AudioEncoder.Libmp3lame,Bitrate.BitrateNormal, audioOutputFile); //var streamInput = "http://148.163.81.10:8006/"; //var streamInput = "http://stream3.polskieradio.pl:8900/;stream"; //var streamOutput = @"C:\videos\streamRadioAacToMp3.mp3"; //audio stream capture //job.Arguments = audioArgs.Capture(streamInput,60, AudioEncoder.Libmp3lame, Bitrate.BitrateNormal,streamOutput); //extract audio stream from video //job.Arguments = videoArgs.ExtractStream(inputFile, Streams.AudioStream, outputFile); //videoArgs.ShowInfo(inputFile); job.Arguments = videoArgs.ExtractStream(inputFile, Streams.VideoStream1, outputFile); //Console.WriteLine(videoArgs.ShowInfo(inputFile)); string title = "My conversion test file"; job.Metadata = title; ffmpeg.VideoEncoding += DisplayProgress; ffmpeg.VideoEncoded += DisplayCompleted; ffmpeg.Exited += DisplayExitCode; ffmpeg.DoWork(job); Console.WriteLine("Completed"); Console.ReadLine(); }
public void OnVolumeSliderUp() { m_audio.GetAudioSource(AudioType.SFX).loop = false; AudioArgs args = new AudioArgs { FadeTime = 1, AudioType = m_playingSampleType }; m_audio.Stop(args); }
private void StopSoundPreview() { //Debug.LogError("Stop Preview"); AudioResource audioResource = (AudioResource)Item.Data; AudioType audioType; if (audioResource.ResourceType == ResourceType.AUDIO) { audioType = AudioType.VO; } else { audioType = AudioType.MUSIC; } var audioSource = m_audio.GetAudioSource(audioType); if (audioSource.isPlaying) { AudioArgs audioArgs = new AudioArgs { FadeTime = .5f, AudioType = audioType, Done = () => { if ((audioType == AudioType.VO && !m_vrMenu.IsOpen && m_lastVo != null) || (audioType == AudioType.MUSIC && m_lastVo != null)) { //Debug.LogError("LastVO: " + m_lastVo.Clip.name); AudioArgs args = new AudioArgs(m_lastVo.Clip, audioType) { FadeTime = .5f, ResumeTime = m_lastVo.Time }; m_audio.Resume(args); } } }; m_audio.Stop(audioArgs); } else if (m_lastVo != null) { AudioArgs args = new AudioArgs(m_lastVo.Clip, audioType) { FadeTime = 1f, ResumeTime = m_lastVo.Time, }; m_audio.Resume(args); } }
private void PreviewSound(float volume, AudioType audioType) { if (Pair == null && m_uiEngine.ActiveModule != InputModule.STANDALONE) { return; } if (Pair != null && m_uiEngine.ActiveModule != InputModule.OCULUS) { return; } var audioSource = m_audio.GetAudioSource(audioType); if (audioSource.isPlaying) { audioSource.volume = volume; return; } var sampleSounds = m_commonResource.GetResource(GetResourceType(audioType), SampleSound); if (sampleSounds == null || sampleSounds.Length == 0) { return; } AudioClip sampleClip = ((AudioResource)sampleSounds[0]).Clip; AudioArgs args = new AudioArgs(sampleClip, audioType) { FadeTime = 0 }; m_audio.Play(args); if (audioType == AudioType.SFX) { audioSource.loop = true; } m_playingSampleType = audioType; }
public void OnMenuClose() { if (Selection.ExperienceType == ExperienceType.MANDALA && m_experienceMachine.CurrentExperience == ExperienceType.MANDALA && Selection.VoiceOver == null) { m_experienceMachine.GetExperience(ExperienceType.MANDALA).ResumeGuide(); return; } if (!Experience.AudioSelectionFlag && m_lastVo != null) { AudioSource audioSource = m_audio.GetAudioSource(AudioType.VO); if (audioSource.isPlaying) { float lastTime = m_lastVo.Time; AudioArgs args = new AudioArgs(null, AudioType.VO) { FadeTime = .5f, Done = () => { AudioArgs voArgs = new AudioArgs(Selection.VoiceOver, AudioType.VO); voArgs.FadeTime = 2; voArgs.ResumeTime = lastTime; m_audio.Resume(voArgs); } }; m_audio.Stop(args); m_lastVo = null; } else { AudioArgs voArgs = new AudioArgs(Selection.VoiceOver, AudioType.VO); voArgs.FadeTime = 2; voArgs.ResumeTime = m_lastVo.Time; m_audio.Resume(voArgs); m_lastVo = null; } } }
protected void PreviewSound() { AudioResource audioResource = (AudioResource)Item.Data; AudioType audioType; if (audioResource.ResourceType == ResourceType.AUDIO) { audioType = AudioType.VO; } else { audioType = AudioType.MUSIC; } var audioSource = m_audio.GetAudioSource(audioType); if (audioType == AudioType.VO && audioSource.clip == Selection.VoiceOver && audioSource.isPlaying) { if (m_lastVo == null || m_lastVo.Clip != Selection.VoiceOver) { m_lastVo = new Sound(audioSource.time, Selection.VoiceOver); } } else if (audioType == AudioType.VO && audioSource.clip == Selection.VoiceOver) { m_lastVo = null; } if (audioType == AudioType.MUSIC && audioSource.clip == Selection.Music && audioSource.isPlaying) { m_lastVo = new Sound(audioSource.time, Selection.Music); } else if (audioType == AudioType.MUSIC && audioSource.clip == Selection.Music) { m_lastVo = null; } if (audioSource.isPlaying) { AudioArgs audioArgs = new AudioArgs { FadeTime = .5f, AudioType = audioType, Done = () => { audioSource.time = 0; AudioClip clip = audioResource.Clip; AudioArgs args = new AudioArgs(clip, audioType) { FadeTime = .5f }; m_audio.Play(args); } }; m_audio.Stop(audioArgs); } else { audioSource.time = 0; AudioClip clip = audioResource.Clip; AudioArgs args = new AudioArgs(clip, audioType) { FadeTime = 1 }; m_audio.Play(args); } }
void TestSave() { //Создать сцену //СОздать эпизод и сохранить его List <Scene> scenes = new List <Scene>(); //Scene 1 SceneType st = SceneType.Text; string[] text = new string[] { "Приветик." }; AnimationSettings settings = new AnimationSettings(new DoublePoint(0.0, 0.0, 0.0), new DoublePoint(-300.0, 0.0, 0.0), AnimationTiming.AtBegin, 1000); AnimationSettings settings2 = new AnimationSettings(new DoublePoint(0.0, 0.0, 0.0), new DoublePoint(300.0, 0.0, 0.0), AnimationTiming.AtBegin, 2000); var settings3 = new AnimationSettings(new DoublePoint(0.0, 0.0, 0.0), new DoublePoint(600.0, 0.0, 0.0), AnimationTiming.AtBegin, 3000); var chars = new CharacterArgs[] { new CharacterArgs("Monika", new string[] { "Default.png", null, null }, settings), new CharacterArgs("lilly", new string[] { "lilly_basic_concerned_cas.png", null, null }, settings2), new CharacterArgs("PMonika", new string[] { "j.png", "1l.png", "1r.png" }, settings3) }; var backConfig = new BackgroundArgs("Class1.png"); var audioConfig = new AudioArgs("TestSound.wav", true); scenes.Add(new Scene(st, text, chars, backConfig, audioConfig)); //Scene 2 st = SceneType.Text; text = new string[] { "Это я" }; settings = new AnimationSettings(new DoublePoint(0.0, 0.0, 0.0), new DoublePoint(300.0, 0.0, 0.0), AnimationTiming.AtBegin, 1000); settings2 = new AnimationSettings(new DoublePoint(0.0, 0.0, 0.0), new DoublePoint(-300.0, 0.0, 0.0), AnimationTiming.AtBegin, 1000); settings3 = new AnimationSettings(new DoublePoint(0.0, 0.0, 0.0), new DoublePoint(-600.0, 0.0, 0.0), AnimationTiming.AtBegin, 1000); chars = new CharacterArgs[] { new CharacterArgs("Monika", new string[] { "Default_confusion.png", null, null }, settings), new CharacterArgs("lilly", new string[] { "lilly_back_sad_cas.png", null, null }, settings2), new CharacterArgs("PMonika", new string[] { "m.png", "1l.png", "1r.png" }, settings3) }; backConfig = new BackgroundArgs("Class1.png"); scenes.Add(new Scene(st, text, chars, backConfig, audioConfig)); //Finall Episode config string episode_name = "First Episode"; Dictionary <string, string[]> usedSprites = new Dictionary <string, string[]> { ["Monika"] = new string[] { "Default.png", "Default_confusion.png", "Flirty_angry.png" }, ["lilly"] = new string[] { "lilly_back_devious.png", "lilly_back_sad_cas.png", "lilly_back_smile_cas.png", "lilly_basic_concerned_cas.png" }, ["PMonika"] = new string[] { "j.png", "1l.png", "1r.png", "m.png" } }; var usedBackgrounds = new string[] { "Class1.png", "Class2.png" }; var usedAudio = new string[] { "TestSound.wav" }; var episodeToSave = new Episode(episode_name, usedBackgrounds, usedSprites, usedAudio, scenes.ToArray()); SaveEpisode(@"S:\Users\Игорь\source\repos\NovelCore\test.json", episodeToSave); }