Results 1 to 3 of 3

Thread: What is wrong with this sndPlaysound problem? StopPlay_LOOP and Play_LOOP

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    What is wrong with this sndPlaysound problem? StopPlay_LOOP and Play_LOOP

    Okay. the code i am using is:
    Code:
     Private Sub Form_Load()
        frmMainopen = True 'main form is open
        frmBlack.Show
        Play_LOOP (titlefn)
        tcp = 0 'sets it to the first one
        bgpic = 1 'back ground picture
        tc(0) = &H4000& '1st color
        tc(1) = &H8000& '2nd color
        tc(2) = &HC000& '3rd
        tc(3) = &HFF00& '4th
        tc(4) = &H80FF80 '5th
        tc(5) = &HC0FFC0 '6th
        KeysAllowed = False 'keys arent allowed yet. helps with it not automaticly going to next screen
        frmhighscoresopen = False 'highscores form isnt open
        frmGameopen = False 'game form isnt opened
        kac = 0 'keys allowed count
    End Sub
    That is the main form. It's music plays just fine. Then, i go to the main form. here is its code:

    Code:
    Private Sub Form_Load()
        tmc = 0
        Call NextSong(songnumber)
        pl = (609 / 2) - (frmPics.imgDL.ScaleWidth / 2)
        pt = 481 - frmPics.imgDL.ScaleHeight - 24
        score = 0
        tailsmoving = False
        lives = 3
        facingright = False
        Unload frmMain
        sheild = False
        frmGameopen = True
        tpic = 0
        frmMainopen = False
        goingleft = True
        timestop = False
        timestopcount = 0
        speed = 1
        lapscount = 0
        energypic = 0
        doubleshot = False
        powerup = False
        Randomize
        Dim sweet
        For sweet = 0 To 12
            enemytrs(sweet) = "Alive"
            enemymrs(sweet) = "Alive"
            enemybrs(sweet) = "Alive"
            enemytt(sweet) = "S"
            enemymt(sweet) = "S"
            enemybt(sweet) = "S"
            enemytrl(sweet) = orenemytrl(sweet)
            enemybrl(sweet) = orenemybrl(sweet)
            enemymrl(sweet) = orenemymrl(sweet)
        Next sweet
        Wavenum = 1
        enemytrt = 88
        enemymrt = 136
        enemybrt = 184
        shotpic = 0
        enemyshotnum = 0
        ps = "Alive"
        paused = False
        tailstatus = "Dead"
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        enemyshotnum = 0
        enemypic = 0
        sheildpic = 0
        tpic = 0
        Call StopSong(songnumber)
    End Sub
    Now, when i go to exit the form(unload it), it stops it, but then it PLAYS the thing again! It ignores the main forms loading of playing the song! Here is the code for the Call's:

    Code:
    Public Function NextSong(songnum As Integer)
    If songnum = 10 Then
        songnum = 1
    ElseIf songnum = 0 Then
        songnum = 9
    End If
    
    Play_LOOP bgsongs(songnum - 1)
    End Function
    
    Public Function StopSong(songnum As Integer)
    StopPlay_LOOP bgsongs(songnum - 1)
    End Function
    There has got to be something wrong with stopping the looping of the file.... but then, i hear it stop, but then it like plays it again................. If during the game you hit F1, you go to the highscores. then hit enter, and then the title music plays like it should. doesnt make any sence.... could it be because i use this:
    UM = sndPlaySound(wavFile, SND_NOSTOP)
    the SND_NOSTOP?
    Last edited by Gamemaster1494; Jul 6th, 2010 at 03:07 AM.
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width