0

Im using Microsoft Visual C# 2010 Express

Basically I am making a simple slot machine game. The application currently works perfectly using the debugger however the sounds do not work properly after publishing.

Heres an example of the interface:
http://img811.imageshack.us/img811/9304/examplepn.png

Reading the .wav files from the resource file:

namespace YolkRoll3._0
{
    public partial class YolkRollMain : Form
    {
        int bankRoll;
        Random RandNum = new Random();
        SoundPlayer stopWav;
        SoundPlayer payoutWav;
        SoundPlayer screamWav;
        SoundPlayer explosionWav;
        int[] finalResult = new int[4];

        public YolkRollMain()
        {
            InitializeComponent();

            // Loads sound files from YolkRollResource.resx
            stopWav = new SoundPlayer(YolkRoll3._0.YolkRollResource.Stop);
            payoutWav = new SoundPlayer(YolkRoll3._0.YolkRollResource.Payout);
            screamWav = new SoundPlayer(YolkRoll3._0.YolkRollResource.Scream);
            explosionWav = new SoundPlayer(YolkRoll3._0.YolkRollResource.Explosion);
            this.StartPosition = FormStartPosition.CenterScreen;
        }

Playing the .wav:

private void timer1Stop_Tick(object sender, EventArgs e)
        {
            // Stop spinning of first reel
            timer1Stop.Enabled = false;
            finalResult[1] = NewIndex();
            reelSlot1.Image = ilreelImages.Images[finalResult[1]];
            reelSlot1.Refresh();
            stopWav.Play();
        }

Any idea why it runs perfectly during debug but gives an error message "The Wave Header is Corrupt"? stopWav plays once then the stopWav sound for the following reels fail.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Momerath
0

Normally you'd get a resource using myProject.Properties.Resources.<resourcename> . Are you including the resource file in the executable? I'm not sure if the Express edition automatically uses the /resource compile option, you might need to use resgen.exe

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.