locked
My programs aren't playing background audio

    Question

  • Right now I'm trying to make an alarm clock program.  I know my coding is correct and I'm not geting errors.  Also my sound is a .Wav and was properly inserted into the resources folder.  I was wondering if there is just some dumb setting that needs to be changed or if I'm forgeting something in the code.

    Here's my code

    Private

     

     

    Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    TextBox1.Text = TimeOfDay

     

     

    If TextBox2.Text = TextBox1.Text Then

     

     

    My.Computer.Audio.Play(My.Resources.BUZZY, AudioPlayMode.BackgroundLoop)

     

     

    End If

     

     

    End Sub

    Friday, November 12, 2010 1:31 AM

Answers

  • Not likely if you are getting sound from other sources.

    Have you tested playing the wav file in question through media player? Are you sure the sound file is working right?


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com
    Sunday, November 14, 2010 12:30 AM
    Moderator

All replies

  • Do you know how to set breakpoints and step through your code? That should be the first thing you do, because it will let you know if that code is even being hit.

    We aren't seeing all your code, so my only thoughts on why this isn't working how you expect it to is either:

    1) you never set the timers enabled property to true (or call its .start() method which does the same thing) so the timer tick event never fires

    2) Textbox2.text doesn't equal textbox1.text when the tick even does fire.


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com
    Friday, November 12, 2010 2:33 PM
    Moderator
  • I've also tryed hooking it up to a button press and have tried it in VB2008 and VB2010 the timer is ticking and the boxes do match.  I've stepped threw it and the code is hitting.  Could the sound not playing be because of my sound driver?
    Friday, November 12, 2010 9:59 PM
  • Not likely if you are getting sound from other sources.

    Have you tested playing the wav file in question through media player? Are you sure the sound file is working right?


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com
    Sunday, November 14, 2010 12:30 AM
    Moderator
  • Yeah, the file is working right.  I guess I'll have to keep playing with it till I figure it out, it's probably something dumb I'm doing wrong.
    Thursday, November 25, 2010 8:24 PM