public void GenerateAudioTestWithROI() { String testString = "fEwS21"; var stream = AudioFactory.GenerateAudio(testString, -7); Assert.IsNotNull(stream); }
public void Construct_FileDoesNotExist_DoesNotCreateFile() { var path = Path.GetRandomFileName(); var x = AudioFactory.AudioSession(path); Assert.IsFalse(File.Exists(path)); }
public void CanStop_NonExistantFile_False() { using (var x = AudioFactory.CreateAudioSession(Path.GetRandomFileName())) { Assert.IsFalse(x.CanStop); } }
public void Construct_FileDoesExistButEmpty_OK() { using (var f = new TempFile()) { var x = AudioFactory.AudioSession(f.Path); } }
public void Play_GiveThaiFileName_ShouldHearTwoSounds() { using (var d = new TemporaryFolder("palaso media test")) { var soundPath = d.Combine("ก.wav"); File.Create(soundPath).Close(); using (var f = TempFile.TrackExisting(soundPath)) { var w = new BackgroundWorker(); // ReSharper disable once RedundantDelegateCreation w.DoWork += new DoWorkEventHandler((o, args) => SystemSounds.Exclamation.Play()); using (var x = AudioFactory.CreateAudioSession(f.Path)) { x.StartRecording(); w.RunWorkerAsync(); Thread.Sleep(2000); x.StopRecordingAndSaveAsWav(); } using (var y = AudioFactory.CreateAudioSession(f.Path)) { y.Play(); Thread.Sleep(1000); y.StopPlaying(); } } } }
public void Play_FileDoesNotExist_Throws() { using (var x = AudioFactory.CreateAudioSession(Path.GetRandomFileName())) { Assert.Throws <FileNotFoundException>(() => x.Play()); } }
public RecordingSession() { _tempFile = new TempFile(); _recorder = AudioFactory.CreateAudioSession(_tempFile.Path); _recorder.StartRecording(); Thread.Sleep(100); }
public void StopRecording_NotRecording_Throws() { using (var x = AudioFactory.CreateAudioSession(Path.GetRandomFileName())) { Assert.Throws <ApplicationException>(() => x.StopRecordingAndSaveAsWav()); } }
private void Awake() { _instance = this; mUIManager = new UIManager(); mAudioFactory = new AudioFactory(); mAudioManager = new AudioManager(); }
public void RecordThenPlay_SmokeTest() { using (var f = new TempFile()) { var w = new BackgroundWorker(); // ReSharper disable once RedundantDelegateCreation w.DoWork += new DoWorkEventHandler((o, args) => SystemSounds.Exclamation.Play()); using (var x = AudioFactory.CreateAudioSession(f.Path)) { x.StartRecording(); w.RunWorkerAsync(); Thread.Sleep(1000); x.StopRecordingAndSaveAsWav(); bool stopped = false; (x as ISimpleAudioWithEvents).PlaybackStopped += (o, args) => { stopped = true; }; var watch = Stopwatch.StartNew(); x.Play(); while (!stopped) { Thread.Sleep(20); Application.DoEvents(); if (watch.ElapsedMilliseconds > 2000) { x.StopPlaying(); Assert.Fail("stop event not received"); } } } } }
public void CanRecord_FileDoesNotExist_True() { using (var x = AudioFactory.CreateAudioSession(Path.GetRandomFileName())) { Assert.IsTrue(x.CanRecord); } }
public void CanRecord_ConstructWithEmptyFile_True() { using (var f = new TempFile()) { var x = AudioFactory.AudioSession(f.Path); Assert.IsTrue(x.CanRecord); } }
public void Play_DoesPlay() { using (var file = TempFile.FromResource(Resources.finished, ".wav")) { var x = AudioFactory.AudioSession(file.Path); Assert.DoesNotThrow(() => x.Play()); Assert.DoesNotThrow(() => x.StopPlaying()); } }
public void Construct_FileDoesNotExist_DoesNotCreateFile() { var path = Path.GetRandomFileName(); // ReSharper disable once UnusedVariable using (var x = AudioFactory.CreateAudioSession(path)) { } Assert.IsFalse(File.Exists(path)); // File doesn't exist after disposal }
public void Construct_FileDoesExistButEmpty_OK() { using (var f = new TempFile()) { // ReSharper disable once UnusedVariable using (var x = AudioFactory.CreateAudioSession(f.Path)) { } } }
private ISimpleAudioSession RecordSomething(TempFile f) { var x = AudioFactory.CreateAudioSession(f.Path); x.StartRecording(); Thread.Sleep(100); x.StopRecordingAndSaveAsWav(); return(x); }
public void Play_FileEmpty_Throws() { using (var f = new TempFile()) { var x = AudioFactory.AudioSession(f.Path); Assert.Throws <Exception>(() => x.Play()); } }
public void Play_FileEmpty_Throws() { using (var f = new TempFile()) { using (var x = AudioFactory.CreateAudioSession(f.Path)) { Assert.Throws <FileLoadException>(() => x.Play()); } } }
public void Record_DoesRecord() { string fpath = "/tmp/dump.ogg"; var x = AudioFactory.AudioSession(fpath); Assert.DoesNotThrow(() => x.StartRecording()); Assert.IsTrue(x.IsRecording); Thread.Sleep(1000); Assert.DoesNotThrow(() => x.StopRecordingAndSaveAsWav()); }
public void IsRecording_WhileRecording_True() { using (var f = new TempFile()) { var x = AudioFactory.AudioSession(f.Path); x.StartRecording(); Thread.Sleep(100); Assert.IsTrue(x.IsRecording); x.StopRecordingAndSaveAsWav(); } }
private List <AMedia> Initialize() { var audioFactory = new AudioFactory(); var videoFactory = new VideoFactory(); if (_mediaLibrary == null) { _mediaLibrary = new List <AMedia>(); _mediaLibrary.AddRange(new FileSystemConnector().ReadXml()); } return(_mediaLibrary); }
public AudioApplicationContext() { m_audio = AudioFactory.Create(); m_menu = new ContextMenuStrip(); // Initialize Tray Icon m_trayIcon = new NotifyIcon() { Icon = Resources.Speaker, Visible = true, ContextMenuStrip = m_menu }; m_trayIcon.MouseDown += TrayIcon_MouseDown; }
public void Record_DoesRecord() { using (var folder = new TemporaryFolder("Record_DoesRecord")) { string fpath = Path.Combine(folder.Path, "dump.ogg"); using (var x = AudioFactory.CreateAudioSession(fpath)) { Assert.DoesNotThrow(() => x.StartRecording()); Assert.IsTrue(x.IsRecording); Thread.Sleep(1000); Assert.DoesNotThrow(() => x.StopRecordingAndSaveAsWav()); } } }
//----------------------------------------------------------------------------- // Game::LoadContent() // Allows you to load all content needed for your engine, // such as objects, graphics, etc. //----------------------------------------------------------------------------- public override void LoadContent() { // Moving this line into Initialize() causes // stupid AccessViolationExceptions SpriteCollisionManager.Self.Preallocate(2, 4); // The NULL one is for resizable sprites SpriteCollisionManager.Self.Create(Sprite.Name.NULL); // Create all the AudioSources AudioFactory audioFactory = new AudioFactory(); audioFactory.LoadAllAudio(); // Initilize the texture system TextureManager.Self.Create(Texture.Name.InvadersFromSpace, "invaders-from-space.tga"); // Create all the Images ever needed ImageFactory imageFactory = new ImageFactory(); imageFactory.Create(); // Create all the SpriteEntites and SpriteCollisions ever needed SpriteEntityFactory spriteFactory = new SpriteEntityFactory(); spriteFactory.Create(); Console.WriteLine(" "); Console.WriteLine("//////////////////////////////////////////////////"); Console.WriteLine("// INSTRUCTIONS //"); Console.WriteLine("// //"); Console.WriteLine("// Left Arrow = Go Left //"); Console.WriteLine("// Right Arrow = Go Right //"); Console.WriteLine("// Space = Fire Missile //"); Console.WriteLine("// D = Toggle Collider Rendering //"); Console.WriteLine("//////////////////////////////////////////////////"); Console.WriteLine(" "); /////////////////// // Begin Scene Setup /////////////////// // Create first scene StartScene firstScene = new StartScene(); SceneManager.Self.LoadScene(firstScene); }
public void RecordThenPlay_SmokeTest() { using (var f = new TempFile()) { var w = new BackgroundWorker(); w.DoWork += new DoWorkEventHandler((o, args) => SystemSounds.Exclamation.Play()); var x = AudioFactory.AudioSession(f.Path); x.StartRecording(); w.RunWorkerAsync(); Thread.Sleep(1000); x.StopRecordingAndSaveAsWav(); x.Play(); Thread.Sleep(1000); x.StopPlaying(); } }
public void RecordAndStop_FileAlreadyExists_FileReplaced() { using (var f = new TempFile()) { var old = File.GetLastWriteTimeUtc(f.Path); var oldInfo = new FileInfo(f.Path); var oldLength = oldInfo.Length; Assert.AreEqual(0, oldLength); var oldTimestamp = oldInfo.LastWriteTimeUtc; var x = AudioFactory.AudioSession(f.Path); x.StartRecording(); Thread.Sleep(1000); x.StopRecordingAndSaveAsWav(); var newInfo = new FileInfo(f.Path); Assert.Greater(newInfo.LastWriteTimeUtc, oldTimestamp); Assert.Greater(newInfo.Length, oldLength); } }
/// <summary> /// Returns a response message with audio as content /// </summary> /// <param name="id">Captcha string for which the audio is to be generated</param> /// <returns>HttpResponseMessage with "audio/wav" header</returns> public HttpResponseMessage Get(string id) { try { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); var audioStream = AudioFactory.GenerateAudio(id); audioStream.Position = 0; response.Content = new StreamContent(audioStream); response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("audio/wav"); return(response); } catch (Exception ex) { var res = new HttpResponseMessage(); res.StatusCode = HttpStatusCode.BadRequest; return(res); } }
private List <AMedia> Initialize() { var audioFactory = new AudioFactory(); var videoFactory = new VideoFactory(); if (_mediaLibrary == null) { _mediaLibrary = new List <AMedia>(); _mediaLibrary.AddRange(new AMedia[] { audioFactory.Create <Book>(), audioFactory.Create <Song>(), videoFactory.Create <Movie>(), videoFactory.Create <Photo>() }); } return(_mediaLibrary); }
private List <AMedia> Initialize() { var audioFactory = new AudioFactory(); var videoFactory = new VideoFactory(); if (_mediaLibrary == null) { _mediaLibrary = new List <AMedia>(); // _mediaLibrary.AddRange(new AMedia[] // { // audioFactory.Create<Book>(), // audioFactory.Create<Song>(), // videoFactory.Create<Movie>(), // videoFactory.Create<Photo>() // }); _mediaLibrary.AddRange(new FileSystemConnector().ReadXml()); } return(_mediaLibrary); }
public void Play_DoesPlayMp3_SmokeTest() { // file disposed after playback stopped var file = TempFile.FromResource(Resources.ShortMp3, ".mp3"); using (var x = AudioFactory.CreateAudioSession(file.Path)) { (x as ISimpleAudioWithEvents).PlaybackStopped += (e, f) => { Debug.WriteLine(f); Thread.Sleep(100); file.Dispose(); }; Assert.That(x.IsPlaying, Is.False); Assert.DoesNotThrow(() => x.Play()); Assert.That(x.IsPlaying, Is.True); Assert.DoesNotThrow(() => x.StopPlaying()); Assert.That(x.IsPlaying, Is.False); } }