Results 1 to 3 of 3

Thread: Visual basic 2017 Audio issues

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2022

    Question Visual basic 2017 Audio issues

    hi, i'm new to this and i've been programming for some months
    but i have an issue while making a "space invaders" project for my school
    whenever i try to play a background audio on loop with the game's music and i press the shoot button that also makes a sound it completely stops and i can only hear the laser sounds
    is there any way to fix this? i know its probably me being ignorant and new but i'll appreciate some help :b

    'this is the code to the background song
    Public Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Panel1.Visible = True
            My.Computer.Audio.Play(My.Resources.spaceinvaders1, AudioPlayMode.BackgroundLoop)
        End Sub
    'and this is the one for the laser sound
     If e.KeyValue = Keys.X Then
                        laser.Visible = True
                        Movement_Var = True
                        timermain.Enabled = True
                        My.Computer.Audio.Play(My.Resources.shoot, AudioPlayMode.Background)
    Last edited by Shaggy Hiker; Nov 29th, 2022 at 02:03 PM. Reason: Added CODE tags.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Sydney, Australia

    Re: Visual basic 2017 Audio issues

    I'm pretty sure that there's nothing in standard .NET that will do that. You would have to use DirectShow, the mciSendString API or something else like that. I can't provide details but you should be able to find information about each online.

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Chelmsford UK

    Re: Visual basic 2017 Audio issues

    As jmcilhinney told you, the standard .Net wav player can only play one sound at a time. You could probably use mciSendString for the background, and the wav player for the laser sounds...

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