public void MakeSound(BeepSound sound) { switch (sound) { case BeepSound.ShortLowtone: _connection.SerialPortAgent.Command(Constants.BeepShortLowTone); break; case BeepSound.ShortHightone: _connection.SerialPortAgent.Command(Constants.BeepShortHighTone); break; case BeepSound.LongLowtone: _connection.SerialPortAgent.Command(Constants.BeepLongLowTone); break; case BeepSound.GoodReadtone: _connection.SerialPortAgent.Command(Constants.BeepGoodReadTone); break; case BeepSound.BadReadtone: _connection.SerialPortAgent.Command(Constants.BeepBadReadTone); break; default: throw new ArgumentOutOfRangeException($"The sound {sound} is not supported."); } }
//VM Initialization public CHIP_8(MainWindow parent) { this.parent = parent; Console.WriteLine("Powering CHIP-8..."); Console.WriteLine($"System Memory: {memory.Length} bytes"); Console.WriteLine($"Stack Size: {stack.Length}"); LoadFonts(); TimerClock.Tick += UpdateTimers; BeepSound.LoadAsync(); BeepClock.Start(); }
/// <summary> /// /// </summary> /// <param name="note"></param> public override SoundBase[] SoundOn(TaggedNoteOnEvent note) { List <SoundBase> rv = new List <SoundBase>(); int tindex = 0; foreach (BeepTimbre timbre in parentModule.GetBaseTimbres(note)) { tindex++; var emptySlot = searchEmptySlot(note); if (emptySlot.slot < 0) { continue; } BeepSound snd = new BeepSound(emptySlot.inst, this, timbre, tindex - 1, note, emptySlot.slot); psgOnSounds.Add(snd); FormMain.OutputDebugLog(parentModule, "KeyOn PSG ch" + emptySlot + " " + note.ToString()); rv.Add(snd); } for (int i = 0; i < rv.Count; i++) { var snd = rv[i]; if (!snd.IsDisposed) { ProcessKeyOn(snd); } else { rv.Remove(snd); i--; } } return(rv.ToArray()); }
protected override void DisplayImages(Bitmap left_image, Bitmap right_image) { if (display_image[0] != null) { if (display_image[0].Image == null) { display_image[0].Image = (Bitmap)left_image.Clone(); } if ((show_left_image) && (calibration_pattern != null)) { display_image[0].Image = calibration_pattern; if (calibration_survey != null) { CalibrationSurvey survey = calibration_survey[1]; if (survey != null) { if ((survey.minimum_rms_error < 3) && ((prev_minimum_rms_error >= 3) || (prev_minimum_rms_error == 0))) { BeepSound.Play("beep.wav"); } prev_minimum_rms_error = survey.minimum_rms_error; } } } else { DisplayImage((Bitmap)display_image[0].Image, left_image, true); } if (window != null) { //window.UpdateLeftImage(display_image[0]); try { window.Invoke((MethodInvoker) delegate { bool success = false; DateTime start_time = DateTime.Now; int time_elapsed_mS = 0; while ((!success) && (time_elapsed_mS < 500)) { try { display_image[0].Refresh(); success = true; } catch { System.Threading.Thread.Sleep(5); TimeSpan diff = DateTime.Now.Subtract(start_time); time_elapsed_mS = (int)diff.TotalMilliseconds; } } }); } catch { } } } if (display_image[1] != null) { if (display_image[1].Image == null) { display_image[1].Image = (Bitmap)right_image.Clone(); } if ((!show_left_image) && (calibration_pattern != null)) { display_image[1].Image = calibration_pattern; if (calibration_survey != null) { CalibrationSurvey survey = calibration_survey[0]; if (survey != null) { if ((survey.minimum_rms_error < 3) && ((prev_minimum_rms_error >= 3) || (prev_minimum_rms_error == 0))) { BeepSound.Play("beep.wav"); } prev_minimum_rms_error = survey.minimum_rms_error; } } } else { DisplayImage((Bitmap)display_image[1].Image, right_image, false); } if (window != null) { //window.UpdateRightImage(display_image[1]); try { window.Invoke((MethodInvoker) delegate { bool success = false; DateTime start_time = DateTime.Now; int time_elapsed_mS = 0; while ((!success) && (time_elapsed_mS < 500)) { try { display_image[1].Refresh(); success = true; } catch { System.Threading.Thread.Sleep(5); TimeSpan diff = DateTime.Now.Subtract(start_time); time_elapsed_mS = (int)diff.TotalMilliseconds; } } }); } catch { } } } }
public Hero3Camera BeepSound(out BeepSound beepSound) { beepSound = base.ExtendedSettings().BeepSound; return(this); }
public async Task <Hero3Camera> BeepSoundAsync(BeepSound beepSound) { return(await base.PrepareCommand <CommandCameraBeepSound>().Select(beepSound).ExecuteAsync() as Hero3Camera); }
public Hero3Camera BeepSound(BeepSound beepSound, bool nonBlocking = false) { return(ExecuteMultiChoiceCommand <CommandCameraBeepSound, BeepSound>(beepSound, nonBlocking)); }
/// <summary> /// ビープ音を鳴らす /// </summary> /// <param name="type">再生するビープの種類を表すBeepSound列挙体</param> /// <returns>再生に成功したらtrue、失敗したらfalse</returns> public static bool Beep(BeepSound type) { return(WinApi.MessageBeep((uint)type) != 0 ? true : false); }