Version 0.5 as marked by the folder name.

This commit is contained in:
2021-01-21 13:51:12 -06:00
parent f7de3650a3
commit d418457d4e
10 changed files with 39258 additions and 59 deletions
+101 -25
View File
@@ -5,7 +5,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Windows.Forms;
using System.IO;
using System.Media;
@@ -18,29 +18,46 @@ namespace SoundBoard
public SoundPlayer player = new SoundPlayer();
public Random randomNum = new Random();
bool willLoopSound = false;
public formMain()
{
InitializeComponent();
//create event handlers for onClick events in the ListBoxes
gamerPoopListBox.MouseClick += new MouseEventHandler(gamerPoopListBox_Click);
asdfMovieListBox.MouseClick += new MouseEventHandler(asdfMovieListBox_Click);
gamerPoopListBox.MouseClick += new MouseEventHandler(soundListBox_OnLeftClick);
asdfMovieListBox.MouseClick += new MouseEventHandler(soundListBox_OnLeftClick);
}
private void gamerPoopListBox_Click(object sender, MouseEventArgs e)
private void soundListBox_OnLeftClick(object sender, MouseEventArgs e)
{
string fullPath = Path.GetFullPath("gamer_poop/") + gamerPoopListBox.SelectedItem + ".wav";
player.SoundLocation = fullPath;
player.Load();
player.Play();
}
private void asdfMovieListBox_Click(object sender, MouseEventArgs e)
{
string fullPath = Path.GetFullPath("asdfmovie/") + asdfMovieListBox.SelectedItem + ".wav";
player.SoundLocation = fullPath;
player.Load();
player.Play();
if (soundboardTabControl.SelectedIndex == 0)
{
string fullPath = Path.GetFullPath("gamer_poop/") + gamerPoopListBox.SelectedItem + ".wav";
player.SoundLocation = fullPath;
player.Load();
if (willLoopSound)
{
player.PlayLooping();
}
else
{
player.Play();
}
}
else if (soundboardTabControl.SelectedIndex == 1)
{
string fullPath = Path.GetFullPath("asdfmovie/") + asdfMovieListBox.SelectedItem + ".wav";
player.SoundLocation = fullPath;
player.Load();
if (willLoopSound)
{
player.PlayLooping();
}
else
{
player.Play();
}
}
}
private void formMain_Load(object sender, EventArgs e)
@@ -60,18 +77,27 @@ namespace SoundBoard
private void btnRandom_Click(object sender, EventArgs e)
{
int iterations = (int)randomIterationNumericUpDown.Value;
string fullPath;
//disable the Random Button and the NumericUpDown box
btnRandom.Enabled = false;
randomIterationNumericUpDown.Enabled = false;
loopSelectedSoundCheckBox.Enabled = false;
if (mainMenuPlayAll.Checked == true)
{
playRandomSoundBothColumns(iterations);
btnRandom.Enabled = true;
randomIterationNumericUpDown.Enabled = true;
loopSelectedSoundCheckBox.Enabled = true;
return;
}
for (int i = 0; i < iterations; i++)
{
int tempRandomNumber;
if (this.soundboardTabControl.SelectedIndex == 0)
if (soundboardTabControl.SelectedIndex == 0)
{
tempRandomNumber = randomNum.Next(gamerPoopListBox.Items.Count - 1);
gamerPoopListBox.SelectedIndex = tempRandomNumber;
@@ -80,7 +106,7 @@ namespace SoundBoard
player.Load();
player.PlaySync();
}
else if (this.soundboardTabControl.SelectedIndex == 1)
else if (soundboardTabControl.SelectedIndex == 1)
{
tempRandomNumber = randomNum.Next(asdfMovieListBox.Items.Count - 1);
asdfMovieListBox.SelectedIndex = tempRandomNumber;
@@ -91,24 +117,68 @@ namespace SoundBoard
}
else
{
MessageBox.Show("The " + soundboardTabControl.SelectedTab.Text + " tab has no sounds to play.", "No Sounds to Play");
MessageBox.Show("The " + soundboardTabControl.SelectedTab.Text + " tab has no sounds to play.", "No Waves Here");
return;
}
}
//re-enable the controls
//renable the controls
btnRandom.Enabled = true;
randomIterationNumericUpDown.Enabled = true;
loopSelectedSoundCheckBox.Enabled = true;
}
private void mainMenuFileExit_Click(object sender, EventArgs e)
private void loopSelectedSoundCheckBox_CheckedChanged(object sender, EventArgs e)
{
Close();
if (loopSelectedSoundCheckBox.Checked == true)
{
willLoopSound = true;
}
else
{
willLoopSound = false;
player.Stop();
}
}
private void playRandomSoundBothColumns(int iterations)
{
int tempRandomNumber = 0;
int incrementor = 0;
string soundPath;
while (incrementor < iterations)
{
Random rand = new Random();
tempRandomNumber = rand.Next(0, 200);
if (tempRandomNumber <= 100)
{
soundboardTabControl.SelectedIndex = 0;
tempRandomNumber = randomNum.Next(gamerPoopListBox.Items.Count - 1);
gamerPoopListBox.SelectedIndex = tempRandomNumber;
soundPath = Path.GetFullPath("gamer_poop/") + gamerPoopListBox.SelectedItem + ".wav";
player.SoundLocation = soundPath;
player.Load();
player.PlaySync();
}
else
{
soundboardTabControl.SelectedIndex = 1;
tempRandomNumber = randomNum.Next(asdfMovieListBox.Items.Count - 1);
asdfMovieListBox.SelectedIndex = tempRandomNumber;
soundPath = Path.GetFullPath("asdfmovie/") + asdfMovieListBox.SelectedItem + ".wav";
player.SoundLocation = soundPath;
player.Load();
player.PlaySync();
}
incrementor++;
}
}
private void mainMenuFileShowOnDisk_Click(object sender, EventArgs e)
{
string filePath;
string arg;
if (soundboardTabControl.SelectedIndex == 0)
{
filePath = Path.GetFullPath("gamer_poop/") + gamerPoopListBox.SelectedItem + ".wav";
@@ -129,7 +199,13 @@ namespace SoundBoard
private void mainMenuHelpAbout_Click(object sender, EventArgs e)
{
MessageBox.Show("YouTube Soundboard\nVersion: 0.2.5.0\nBuilt in .NET 4.5\nAnd way to lazy to create a pretty About Form.", "YouTube Soundboard");
aboutForm aboutDialogForm = new aboutForm();
aboutDialogForm.ShowDialog();
}
private void mainMenuFileExit_Click(object sender, EventArgs e)
{
Close();
}
}
}