Skip to content

Commit

Permalink
Add AuditoryFeedback()
Browse files Browse the repository at this point in the history
  • Loading branch information
publicdomain committed Mar 3, 2024
1 parent 229b67d commit f2bbc5b
Showing 1 changed file with 61 additions and 5 deletions.
66 changes: 61 additions & 5 deletions TIMP/TimpForm.cs
Expand Up @@ -233,17 +233,26 @@ private void DisposeSoundPlayer()
}

/// <summary>
/// Processes the client message.
/// Auditories the feedback.
/// </summary>
/// <param name="timpArguments">Timp arguments.</param>
public void ProcessClientMessage(string[] timpArguments)
private void AuditoryFeedback()
{
// Auditory feedback
// Check if must trigger auditory feedback
if (this.auditoryFeedbackToolStripMenuItem.Checked && File.Exists(this.auditoryFeedbackFilePath))
{
// Play the file
this.PlaySoundFile(this.auditoryFeedbackFilePath);
}
}

/// <summary>
/// Processes the client message.
/// </summary>
/// <param name="timpArguments">Timp arguments.</param>
public void ProcessClientMessage(string[] timpArguments)
{
// Auditory feedback
this.AuditoryFeedback();

// Switch the passed TIMP arguments
switch (timpArguments[0].ToLowerInvariant())
Expand Down Expand Up @@ -570,8 +579,12 @@ private void OnTimpFormLoad(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
public void OnMainNotifyIconClick(object sender, MouseEventArgs e)
{
// Check button
if (e.Button == MouseButtons.Left)
{
// Auditory feedback
this.AuditoryFeedback();

// Relocate and show
this.RelocateAndShow();
}
Expand Down Expand Up @@ -1350,6 +1363,9 @@ private void OnExitToolStripMenuItemClick(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnActionsToolStripMenuItemDropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Set tool strip menu item
ToolStripMenuItem toolStripMenuItem = (ToolStripMenuItem)e.ClickedItem;

Expand Down Expand Up @@ -1451,6 +1467,9 @@ private void SetAudioFileCurrentTime()
/// <param name="e">E.</param>
private void OnHideButtonClick(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Hide form
this.Hide();
}
Expand All @@ -1462,6 +1481,9 @@ private void OnHideButtonClick(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnSortShuffleCheckBoxCheckedChanged(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Act on current check state
if (this.sortShuffleCheckBox.Checked)
{
Expand Down Expand Up @@ -1503,6 +1525,9 @@ private void OnSortShuffleCheckBoxCheckedChanged(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnFirstButtonClick(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Play the first track
this.PlayFirst();
}
Expand All @@ -1514,6 +1539,9 @@ private void OnFirstButtonClick(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnPreviousButtonClick(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Play the previous track
this.PlayPrev();
}
Expand All @@ -1525,7 +1553,8 @@ private void OnPreviousButtonClick(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnPlayPauseButtonClick(object sender, EventArgs e)
{
// TODO Can refactor to stop on right-click
// Auditory feedback
this.AuditoryFeedback();

// Trigger PlayPause
this.PlayPause(false);
Expand All @@ -1545,6 +1574,9 @@ private void OnPlayPauseButtonClick(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnNextButtonClick(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Play the next track
this.PlayNext();
}
Expand All @@ -1556,6 +1588,9 @@ private void OnNextButtonClick(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnLastButtonClick(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Play the last track
this.PlayLast();
}
Expand All @@ -1567,6 +1602,9 @@ private void OnLastButtonClick(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnExitButtonClick(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Hide tray icon and exit
this.ExitTimp();
}
Expand Down Expand Up @@ -1613,6 +1651,9 @@ private void OnPlayTimeTrackBarValueChanged(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnButtonMouseEnter(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Set update tip flag
this.updateTip = true;

Expand Down Expand Up @@ -1681,6 +1722,9 @@ private void OnButtonMouseEnter(object sender, EventArgs e)
/// <param name="e">Event arguments.</param>
private void OnButtonMouseLeave(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Reset update tip flag
this.updateTip = false;

Expand Down Expand Up @@ -1725,6 +1769,9 @@ private void OnPlayerDataGridViewDataBindingComplete(object sender, DataGridView
/// <param name="e">Event arguments.</param>
private void OnPlayerDataGridViewCellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Check for left click and if item is the same as currently slected
if (e.Button == MouseButtons.Left && this.playerDataGridView.SelectedRows[0].Index == e.RowIndex)
{
Expand All @@ -1740,6 +1787,9 @@ private void OnPlayerDataGridViewCellMouseClick(object sender, DataGridViewCellM
/// <param name="e">Event arguments.</param>
private void OnLoopModeCheckBoxCheckStateChanged(object sender, EventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Act on current check state
switch (this.loopModeCheckBox.CheckState)
{
Expand Down Expand Up @@ -1848,6 +1898,9 @@ private void OnPlayPauseButtonMouseClick(object sender, MouseEventArgs e)
/// <param name="e">E.</param>
private void OnPlayTimeTrackBarMouseDown(object sender, MouseEventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Stop the timer
this.actionTimer.Stop();

Expand All @@ -1868,6 +1921,9 @@ private void OnPlayTimeTrackBarMouseDown(object sender, MouseEventArgs e)
/// <param name="e">E.</param>
private void OnPlayPauseButtonMouseDown(object sender, MouseEventArgs e)
{
// Auditory feedback
this.AuditoryFeedback();

// Check for right cilck
if (e.Button == MouseButtons.Right)
{
Expand Down

0 comments on commit f2bbc5b

Please sign in to comment.