Want to see what people are talking about? See the latest forum posts.

Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 17730
Number of posts: 54951

This Forum Only
Post New Thread

Report
Newbie Question Regarding DirectSound Posted by JonBoy37 on 10 Nov 2009 at 4:47 AM
Hi,

I am currently developing a PC game based on the game show Card Sharks, and I am experiencing a dilemma as of recently.

I am hoping to use more than one DSBuffer (I would use, for example, "SoundClipA.wav", "SoundClipB.wav", and "SoundClipC.wav").

If I were to have separate cases using the DSBuffers mentioned above, like this:
    Case PlayIntro
        Dim cur As DSCURSORS
        DSBuffer.GetCurrentPosition cur
        contBkgd(1).Visible = True
        If cur.lPlay > 104861 Then 'bytes
          Label1.Caption = "This is an EDUCATED GUESS question."
          Command1.Enabled = True
        ElseIf cur.lPlay > 82785 Then 'bytes
          If QuesRB(0).Caption = "B" Then
            WhosTurn = BluePlayer
            Label1.Caption = "Blue, this question is for you."
            BBorder(1).Visible = True
            board.Visible = False
          ElseIf QuesRB(0).Caption = "R" Then
            WhosTurn = RedPlayer
            Label1.Caption = "Red, this question is for you."
            RBorder(1).Visible = True
          End If
            Image1(0).Visible = False
            Image1(1).Visible = False
            Image1(2).Visible = False
            Image1(3).Visible = False
            Image1(4).Visible = False
            Image2(0).Visible = False
            Image2(1).Visible = False
            Image2(2).Visible = False
            Image2(3).Visible = False
            Image2(4).Visible = False
    '          Timer1.Enabled = False
        ElseIf cur.lPlay > 75250 Then
          Image2(4).Visible = True
        ElseIf cur.lPlay > 67725 Then
          Image2(3).Visible = True
        ElseIf cur.lPlay > 60200 Then
          Image1(4).Visible = True
        ElseIf cur.lPlay > 52625 Then
          Image2(2).Visible = True
        ElseIf cur.lPlay > 45150 Then
          Image1(3).Visible = True
        ElseIf cur.lPlay > 37625 Then
          Image2(1).Visible = True
        ElseIf cur.lPlay > 30100 Then
          Image1(2).Visible = True
        ElseIf cur.lPlay > 22575 Then
          Image2(0).Visible = True
        ElseIf cur.lPlay > 15050 Then
          Image1(1).Visible = True
        ElseIf cur.lPlay > 7525 Then
          Image1(0).Visible = True
        ElseIf cur.lPlay > 0 Then
          board.Visible = True
        End If


And I was to use the "SoundClipB.wav" in another case, like this:
    Case PlayIntro2
        Dim cur As DSCURSORS
        DSBuffer.GetCurrentPosition cur
        contBkgd(1).Visible = True
        If cur.lPlay > 104861 Then 'bytes
          Label1.Caption = "We surveyed 100 people..."
          Command1.Enabled = True
        ElseIf cur.lPlay > 82785 Then 'bytes
          If QuesRB(0).Caption = "B" Then
            WhosTurn = BluePlayer
            Label1.Caption = "Blue, this question is for you."
            BBorder(1).Visible = True
            board.Visible = False
          ElseIf QuesRB(0).Caption = "R" Then
            WhosTurn = RedPlayer
            Label1.Caption = "Red, this question is for you."
            RBorder(1).Visible = True
          End If
            Image1(0).Visible = False
            Image1(1).Visible = False
            Image1(2).Visible = False
            Image1(3).Visible = False
            Image1(4).Visible = False
            Image2(0).Visible = False
            Image2(1).Visible = False
            Image2(2).Visible = False
            Image2(3).Visible = False
            Image2(4).Visible = False
    '          Timer1.Enabled = False
        ElseIf cur.lPlay > 75250 Then
          Image2(4).Visible = True
        ElseIf cur.lPlay > 67725 Then
          Image2(3).Visible = True
        ElseIf cur.lPlay > 60200 Then
          Image1(4).Visible = True
        ElseIf cur.lPlay > 52625 Then
          Image2(2).Visible = True
        ElseIf cur.lPlay > 45150 Then
          Image1(3).Visible = True
        ElseIf cur.lPlay > 37625 Then
          Image2(1).Visible = True
        ElseIf cur.lPlay > 30100 Then
          Image1(2).Visible = True
        ElseIf cur.lPlay > 22575 Then
          Image2(0).Visible = True
        ElseIf cur.lPlay > 15050 Then
          Image1(1).Visible = True
        ElseIf cur.lPlay > 7525 Then
          Image1(0).Visible = True
        ElseIf cur.lPlay > 0 Then
          board.Visible = True
        End If


...what would I have to do in order to allow those DSBuffers to play in those separate cases? Would I be required to use Private Subs for those separate DSBuffers? Would anybody be able to provide a sample code?



 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.