Results 1 to 33 of 33

Thread: DirectSound Tones

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    DirectSound Tones

    Hi there

    I am making a bass guitar-tabbing program. There is a picture of a guitar neck; when you click on the fret of the guitar you want it will write that part of the tab. I have got this part working, but it would be nice to be able to play the sound that corresponds to the fret that’s click. Eg, if they click String 1 Fret 1 they would get the tone F, the next “string 1 Fret 2” would be F# and so on.

    This is more or less a virtual guitar but I don’t want to have 100 music files and call them all 1 by one in order of whats clicked. It would be handy to keep it small and make the computer do the work.

    Iveattached something that I hope to be my program so far…please don’t laugh, I know I’m not a good programmer, and you may have to bodge the App Paths around a bit for the program to work for you so far but it will give you the gist of where im going! You will also notice that a lot of bits dont work yet.

    Thanks so much for ANY help!!!

    Mathew
    Attached Files Attached Files

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    bump

    Any luck peeps? Ive looked at a lot of posts explaining Direct Sound but i cant really understand very well

  3. #3
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectSound Tones

    CVMichael's our DirectSound expert, and should be here to answer your question. You could try PMing CVMichael. I'm only an expert in graphics and input parts of DirectX.

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: DirectSound Tones

    You might want to use MIDI, as all soundcards can play back MIDI files, and part of the MIDI Instruments is a Bass (or maybe a few basses). You'd still have to have a file for each note, and connecting them together would be more difficult.

  5. #5
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: DirectSound Tones

    @Mathew, I would suggest you read up on Option Explicit and use it. Just try and compile the exe. Do a search on here for Option Explicit.
    VB Code:
    1. Private Sub cmdnewline_Click()
    2.  
    3. Dim ltab1, ltab2, ltab3, ltab4 As String
    4.  
    5. For i = 1 To 10
    6.     ltab1(i) = txttab1.Text
    7.     ltab2(i) = txttab2.Text
    8.     ltab3(i) = txttab3.Text
    9.     ltab4(i) = txttab4.Text
    10. Next
    11.  
    12. End Sub
    Thats the wrong way to Dim a String
    Only ltab4 will be a String, the others will be Variants.
    VB Code:
    1. Dim ltab1 As String, ltab2 As String, ltab3 As String, ltab4 As String
    Plus your trying to pass it to an array.
    Last edited by Keithuk; Dec 12th, 2005 at 05:43 PM.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: DirectSound Tones

    They are declared as Variants (except for the last one). Variants are slower, and their use is bad programming practice, but a variant can be used as an array.

  7. #7
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    First of all I don't know anything about guitars.

    MathewF can you post some wave files with some of the notes of the guitar ?

    Post the lowest notes, then I assume the rest of the notes are the same sound but with higher pitch, right ?

    Also, can you post the picture of the guitar neck ?
    I want to make an app from scratch, the way I like it because your aproach with the labels is not good.

  8. #8
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectSound Tones

    Quote Originally Posted by CVMichael
    First of all I don't know anything about guitars.

    MathewF can you post some wave files with some of the notes of the guitar ?

    Post the lowest notes, then I assume the rest of the notes are the same sound but with higher pitch, right ?

    Also, can you post the picture of the guitar neck ?
    I want to make an app from scratch, the way I like it because your aproach with the labels is not good.
    I could make the guitar neck in 3D. With your DS knowledge, and my D3D skills, we can make an awesome guitar app.

  9. #9
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    Quote Originally Posted by Jacob Roman
    I could make the guitar neck in 3D. With your DS knowledge, and my D3D skills, we can make an awesome guitar app.
    That's a nice idea, but I don't know if I'll have time for all that...
    I'm not sure if I will even have time to do what MathewF wants...
    Latelly I'm very busy

  10. #10
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Re: DirectSound Tones

    What you need to do is get a microphone, and record your own bass guitar for the notes. You may think that this will take forever but it won't because there are many of the same notes on the neck.

    I like your idea a lot though. I tried making a tab writer for guitar. I got a lot done but gave up and started on other stuff. Keep up the good work!

    CVMichael and JR: If you guys come up with a great tab writing program I will be very thankful. You guys can do all the technical parts, and I can supply the guitar knowledge if you want.

  11. #11

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    Hi people!

    Thanks a lot for all the replys! I've tried to another part to the program to save the lines of tab and create a new one (for if the tab goes off the page). You can have a good laugh at the bodge job ive make, ill add as an attachment Project2.

    Jacob Roman: I have tried to understand and implement parts of CVMichael's direct sound out part but I don't find myself experienced enough to understand how it works.

    Making the guitar neck in 3D sounds EXTREMELY advanced for me, i take it, it would be something you would pursue on your own, as i wouldnt be much help. But it does sound very sleek!

    dglienna: I did make 100 midi files with a program called Midi-maker, it was only a trial period but i couldnt get any vb code to play the midi files made...Apparenly through a little research there are several types of midi files, midi1 midi2 midi3 and midi4 (I don't know if you know any more about this) but apparently midi1 is the only type that can work.

    If anyone knows of a program i could use to make these sounds i would happily make all the midi files.


    Keithuk: Thanks for the suggestions, I know i'm not an experienced programmer, i didnt know that declaring ???, ???, ???, as string only did the end one! thanks for that!

    VB is such a steep learning curve, I love learning how to do it, and making mistakes is all part of learning!

    CVMichael: Thanks for the reply. Ive been reading a lot of your posts regarding the playing of midi files/directsound but to no avail, i'm guessing i'm jumping in at the deep end with trying to make something this advanced!

    I will happily send you some midi files if you want, ill attach them at the bottom of this post. They were made in midi maker and i'm not sure if VB will play them. Maybe you, with more experience will have more success.

    Ill also add some pictures of guitar necks although you could probably make one better than me, I used MS Paint...(i know i should really use something more advanced). I could maybe take a picture with a camera of my bass and upload it if you wanted something that looks real.

    Thanks in advance!


    paralinx: That would be a nice to have a real guitar sound, but would 100 recording of all these notes be very large and make the program a bit sluggish? Would the program have to load all these up at the start.

    Cheers!

    Thanks aging so much for all the help!!!!

    (hope the attachments actually attach)

    Mathew
    Attached Files Attached Files
    Last edited by MathewF; Dec 13th, 2005 at 07:39 AM.

  12. #12
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    I was able to play the midis in WinAmp... but I was not able to convert them to wave from winamp using the disk writer.

    Can anyone convert those midis to wav please ?

    I think I'll end up recording the first note like A-0, then just change the pitch when playing it to ge the other notes.

    Anyways... I'll do that later, I don't have time right now...

  13. #13

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    Hey Again

    Thanks for the reply CVMichael.

    Ive changed the A-0 to a wav file, attached at the bottom. I can notice a little clicking noise at the end of the wav, but it could just be my speakers.

    Hope this helps! And thanks so much for any assistance!

    Mathew

  14. #14

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    Evening people.

    Just about finished the main parts of my program now and i would like to implement the sound part of the guitar.

    CVMichael, you mentioned being able to just take the A-0.wav file and be able to use this for all the notes by changing the pitch when its played. Do you think you can give me a little example please? Also how should i go about playing the wav file as there are several components in visual basic 6 that i think will be able to play the wav file.

    Thanks a lot for the help!

    Mathew

  15. #15
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectSound Tones

    Quote Originally Posted by CVMichael
    That's a nice idea, but I don't know if I'll have time for all that...
    I'm not sure if I will even have time to do what MathewF wants...
    Latelly I'm very busy
    It's kool. But you are the one that knows how to do the 3D mouse selection, which I cannot do on my own yet, and know DS more than I do.

    MathewF, doing 3D in DirectX is not that hard at all. Matter of fact it's so easy, a child can do it. It's the other stuff that can get difficult, and require a good math background.

  16. #16
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    MathewF, I just discovered that I don't know how to change the pitch in DirectSound
    So I'll need you to convert ALL the MIDIs to WAV files...

    I tried by changing the frequency, but it's just not the same...

    PS, when you convert, convert to a lower quality so the files are smaller.
    First of all, you don't need it to be stereo. And set the frequency to 22050 Hz (or something like that). Just by changing those 2, you will have files 4 times smaller.
    Last edited by CVMichael; Dec 14th, 2005 at 04:20 PM.

  17. #17
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    I found this program on the net: MID Converter 3.2
    That can convert the midi files to wav. But it's not so good. I records clicks & ticks, and broken sounds (sometimes).

    But it's good enough for my testing when making the program.
    I'll do more coding as soon as I get more free time. I'm pretty close, I figured out how to play single wave files in secondary buffers.
    I plan to load ALL the wave files in separate buffers. This way you can play more than one wave at the same time, wich will make the guitar sound realistic.
    I also managed to save your guitar neck picture from your project. So I can put the picture in my app/code (without those labels on top of it).

    Hopefully I find more free time today, or in the next few days.
    Last edited by CVMichael; Dec 14th, 2005 at 06:49 PM.

  18. #18
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    Quote Originally Posted by Jacob Roman
    It's kool. But you are the one that knows how to do the 3D mouse selection, which I cannot do on my own yet, and know DS more than I do.
    Well, if you want you can start on it.
    The DS part it will be easy, you will just copy and paste the code from the app i'll make for MathewF.

    The 3D selection.... well even last time, I did not know how to implement the 3D selection in your application.
    From what I remember (if you can find that thread), I need the camera coordinates, the Eye coordinate.... hmm... don't remember what else...

    I basically have to convert the 2D mouse coordinates to 3D, and then find the intersection between the eye and 3D mouse to the object. If intersection is successfull, then you have the object the mouse is on top of...

    By the way, it would be nice if you can make the guitar string visually vibrate like in real life when you touch the string.

  19. #19

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    Hello!

    Thanks again for the replys, i managed to convert them MIDI files all to wav files at 22050hz using the Mid Converter program. Even then the files add up to 11mb unzipped. I cant try at a lower frequency yet because the program is having a paddy saying ive converted too many files in 60 seconds and wont let me do anymore.

    Ive attempted to upload the WAV files in a website below because it was too large to upload to the forum.

    Thanks a lot!

    Mathew

    http://www.freefileupload.net/file.p...AV-22050hz.rar

  20. #20
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectSound Tones

    Quote Originally Posted by CVMichael
    Well, if you want you can start on it.
    The DS part it will be easy, you will just copy and paste the code from the app i'll make for MathewF.

    The 3D selection.... well even last time, I did not know how to implement the 3D selection in your application.
    From what I remember (if you can find that thread), I need the camera coordinates, the Eye coordinate.... hmm... don't remember what else...

    I basically have to convert the 2D mouse coordinates to 3D, and then find the intersection between the eye and 3D mouse to the object. If intersection is successfull, then you have the object the mouse is on top of...

    By the way, it would be nice if you can make the guitar string visually vibrate like in real life when you touch the string.
    I now know how to obtain transformed vertices, so you should be all good now. I'm gonna need a wood texture, and the neck w/frets texture as well, then I'll work on it.

    Spring physics should help with the vibrating strings.

  21. #21
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    I attached the guitar neck from MathewF application. I managed to save it as BMP, then converted it to JPG, wich in the process of converting it rounded the strings

    MathewF, your upload is RAR, and I DON'T HAVE RAR
    And I don't want to install it just for this...
    Next time use ZIP.
    Actually, now I don't require the wav files anymore (unless you really insist that I should have them), because I used the program I mentioned before, and converted the MIDIs to wav, except some of the MIDIs did not convert properly.

    I still did not have time to work on the project... maybe i'll have more time later today.
    Attached Images Attached Images  

  22. #22
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    OK, MathewF, here is what you've been waiting for

    Before you run the application, make sure you have ALL the wave files in the Wav directory.
    When the program starts, it loads ALL the wave files.

    Enjoy...
    Attached Files Attached Files

  23. #23
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectSound Tones

    I thought it was guitar, not a bass. Oh well, I guess I can eliminate the green lines.

  24. #24
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    Quote Originally Posted by Jacob Roman
    I thought it was guitar, not a bass. Oh well, I guess I can eliminate the green lines.
    It's a bass-guitar (whatever that is... I suck at music instruments)

  25. #25

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    Oh wow!!

    Thanks fantastic CVMichael!!! More or less exactly what i was expecting!!! I like the feature where if you hold the mouse down and scroll over it plays them all!

    I'll see if i can build this into my program.

    Very impressive! Thanks so much for going out of your way to do that, how can i repay you?

    What lines of code would i be changing to change the order of the strings? At the moment they go G, E, D, A (from the bottom up) and they should really go E, A, D, G. Still fantastic work thoguh!! well done!

    Edit:

    Nevermind that question, found it (obviously didnt look hard enough!)


    A very happy mathew
    Last edited by MathewF; Dec 15th, 2005 at 01:50 PM.

  26. #26
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    In the picGuitarNeck_MouseMove sub, change to this code:
    You basically have to reverse the order for the "Select Case" statements
    VB Code:
    1. Private Sub picGuitarNeck_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     Dim Ret As String, NoteX As Long, NoteY As Long, DS As DSCURSORS
    3.    
    4.     lnX.X1 = X
    5.     lnX.X2 = X
    6.    
    7.     lnY.Y1 = Y
    8.     lnY.Y2 = Y
    9.    
    10.     Ret = GetNote(X, Y)
    11.     NoteX = Val(Mid(Ret, 3))
    12.     NoteY = Val(Left(Ret, 1))
    13.    
    14.     Select Case NoteY
    15.     Case 3
    16.         Me.Caption = "A-" & NoteX
    17.     Case 2
    18.         Me.Caption = "D-" & NoteX
    19.     Case 1
    20.         Me.Caption = "E-" & NoteX
    21.     Case 0
    22.         Me.Caption = "G-" & NoteX
    23.     End Select
    24.    
    25.     If Button = 1 Then
    26.         Select Case NoteY
    27.         Case 3
    28.             ABuff(NoteX).GetCurrentPosition DS
    29.             If DS.lPlay = 0 Then ABuff(NoteX).Play DSBPLAY_DEFAULT
    30.         Case 2
    31.             DBuff(NoteX).GetCurrentPosition DS
    32.             If DS.lPlay = 0 Then DBuff(NoteX).Play DSBPLAY_DEFAULT
    33.         Case 1
    34.             EBuff(NoteX).GetCurrentPosition DS
    35.             If DS.lPlay = 0 Then EBuff(NoteX).Play DSBPLAY_DEFAULT
    36.         Case 0
    37.             GBuff(NoteX).GetCurrentPosition DS
    38.             If DS.lPlay = 0 Then GBuff(NoteX).Play DSBPLAY_DEFAULT
    39.         End Select
    40.     End If
    41. End Sub

  27. #27
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    Quote Originally Posted by MathewF
    Oh wow!!

    how can i repay you?
    You could rep me...

  28. #28

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    Quote Originally Posted by CVMichael
    In the picGuitarNeck_MouseMove sub, change to this code:
    You basically have to reverse the order for the "Select Case" statements
    VB Code:
    1. Private Sub picGuitarNeck_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     Dim Ret As String, NoteX As Long, NoteY As Long, DS As DSCURSORS
    3.    
    4.     lnX.X1 = X
    5.     lnX.X2 = X
    6.    
    7.     lnY.Y1 = Y
    8.     lnY.Y2 = Y
    9.    
    10.     Ret = GetNote(X, Y)
    11.     NoteX = Val(Mid(Ret, 3))
    12.     NoteY = Val(Left(Ret, 1))
    13.    
    14.     Select Case NoteY
    15.     Case 3
    16.         Me.Caption = "A-" & NoteX
    17.     Case 2
    18.         Me.Caption = "D-" & NoteX
    19.     Case 1
    20.         Me.Caption = "E-" & NoteX
    21.     Case 0
    22.         Me.Caption = "G-" & NoteX
    23.     End Select
    24.    
    25.     If Button = 1 Then
    26.         Select Case NoteY
    27.         Case 3
    28.             ABuff(NoteX).GetCurrentPosition DS
    29.             If DS.lPlay = 0 Then ABuff(NoteX).Play DSBPLAY_DEFAULT
    30.         Case 2
    31.             DBuff(NoteX).GetCurrentPosition DS
    32.             If DS.lPlay = 0 Then DBuff(NoteX).Play DSBPLAY_DEFAULT
    33.         Case 1
    34.             EBuff(NoteX).GetCurrentPosition DS
    35.             If DS.lPlay = 0 Then EBuff(NoteX).Play DSBPLAY_DEFAULT
    36.         Case 0
    37.             GBuff(NoteX).GetCurrentPosition DS
    38.             If DS.lPlay = 0 Then GBuff(NoteX).Play DSBPLAY_DEFAULT
    39.         End Select
    40.     End If
    41. End Sub

    Wow, you replied faster than i could edit my post!! cheers man! I like it a lot!

  29. #29
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    I forgot to mention it earlier...

    If you notice, it goes up to 24, the 25'th note is not playing because you don't have enough vertical lines in the guitar neck...

    So the 25'th note is loaded, but it's never actually played...

  30. #30

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    Ahhh right, yes i didnt notice that!

    That was a major design flaw in my guitar neck...it doesnt counter for playing the string with no finger on a fret (therefore open string) E-0 A-0 D-0 and G-0 would be the open string and e-1 a-1 d-1 and g-1 would take their place. I guess this needs more thinking on how the play the string open....well spotted

    Mathew

  31. #31

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    Hi CVMichael

    Sorry to bother you again! But i'm having trouble thinking of a way to stop by tab getting spammed with text when using the program you made.

    Please see attatched if you have time! If you still have the WAV files you'll need to put them in that folder you made again .

    Again sorry for more bother. You'll see what i mean.

    Mathew
    Attached Files Attached Files

  32. #32
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: DirectSound Tones

    Replace the function with this:
    Is it better ?
    I simply made it exit the function when the index is the same as the previous and the time is less than 200 milliseconds and the sound position is 0.
    This way, it basically does nothing until the entire sound is played, and only then the sound is played again.
    VB Code:
    1. Private Sub picGuitarNeck_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     Dim Ret As String, NoteX As Long, NoteY As Long, DS As DSCURSORS
    3.    
    4.     Static PGIndex As Long, PGTime As Single
    5.     Static PDIndex As Long, PDTime As Single
    6.     Static PAIndex As Long, PATime As Single
    7.     Static PEIndex As Long, PETime As Single
    8.    
    9.     lnX.X1 = X
    10.     lnX.X2 = X
    11.    
    12.     lnY.Y1 = Y
    13.     lnY.Y2 = Y
    14.    
    15.     Ret = GetNote(X, Y)
    16.     NoteX = Val(Mid(Ret, 3))
    17.     NoteY = Val(Left(Ret, 1))
    18.    
    19.     Select Case NoteY
    20.     Case 0
    21.         Me.Caption = "G-" & NoteX
    22.     Case 1
    23.         Me.Caption = "D-" & NoteX
    24.     Case 2
    25.         Me.Caption = "A-" & NoteX
    26.     Case 3
    27.         Me.Caption = "E-" & NoteX
    28.     End Select
    29.    
    30.     If Button = 1 Then
    31.         Select Case NoteY
    32.         Case 0
    33.             GBuff(NoteX).GetCurrentPosition DS
    34.             If DS.lPlay = 0 Then
    35.                 If PGIndex = NoteX And PGTime + 0.2 >= Timer Then Exit Sub
    36.                
    37.                 PGIndex = NoteX
    38.                 PGTime = Timer
    39.                
    40.                 GBuff(NoteX).Play DSBPLAY_DEFAULT
    41.                 Text1.Text = Text1.Text + (Val(NoteX) & "-")
    42.                
    43.                 If NoteX >= 10 Then
    44.                     Text2.Text = Text2.Text + "---"
    45.                     Text3.Text = Text3.Text + "---"
    46.                     Text4.Text = Text4.Text + "---"
    47.                 Else
    48.                     Text2.Text = Text2.Text + "--"
    49.                     Text3.Text = Text3.Text + "--"
    50.                     Text4.Text = Text4.Text + "--"
    51.                 End If
    52.             End If
    53.         Case 1
    54.             DBuff(NoteX).GetCurrentPosition DS
    55.             If DS.lPlay = 0 Then
    56.                 If PDIndex = NoteX And PDTime + 0.2 >= Timer Then Exit Sub
    57.                
    58.                 PDIndex = NoteX
    59.                 PDTime = Timer
    60.                
    61.                 DBuff(NoteX).Play DSBPLAY_DEFAULT
    62.                 Text2.Text = Text2.Text + (Val(NoteX) & "-")
    63.                
    64.                 If NoteX >= 10 Then
    65.                     Text1.Text = Text1.Text + "---"
    66.                     Text3.Text = Text3.Text + "---"
    67.                     Text4.Text = Text4.Text + "---"
    68.                 Else
    69.                     Text1.Text = Text1.Text + "--"
    70.                     Text3.Text = Text3.Text + "--"
    71.                     Text4.Text = Text4.Text + "--"
    72.                 End If
    73.             End If
    74.         Case 2
    75.             ABuff(NoteX).GetCurrentPosition DS
    76.             If DS.lPlay = 0 Then
    77.                 If PAIndex = NoteX And PATime + 0.2 >= Timer Then Exit Sub
    78.                
    79.                 PAIndex = NoteX
    80.                 PATime = Timer
    81.                
    82.                 ABuff(NoteX).Play DSBPLAY_DEFAULT
    83.                 Text3.Text = Text3.Text + (Val(NoteX) & "-")
    84.                
    85.                 If NoteX >= 10 Then
    86.                     Text1.Text = Text1.Text + "---"
    87.                     Text2.Text = Text2.Text + "---"
    88.                     Text4.Text = Text4.Text + "---"
    89.                 Else
    90.                     Text1.Text = Text1.Text + "--"
    91.                     Text2.Text = Text2.Text + "--"
    92.                     Text4.Text = Text4.Text + "--"
    93.                 End If
    94.             End If
    95.         Case 3
    96.             EBuff(NoteX).GetCurrentPosition DS
    97.             If DS.lPlay = 0 Then
    98.                 If PEIndex = NoteX And PETime + 0.2 >= Timer Then Exit Sub
    99.                
    100.                 PEIndex = NoteX
    101.                 PETime = Timer
    102.                
    103.                 EBuff(NoteX).Play DSBPLAY_DEFAULT
    104.                 Text4.Text = Text4.Text + (Val(NoteX) & "-")
    105.                
    106.                 If NoteX >= 10 Then
    107.                     Text1.Text = Text1.Text + "---"
    108.                     Text2.Text = Text2.Text + "---"
    109.                     Text3.Text = Text3.Text + "---"
    110.                 Else
    111.                     Text1.Text = Text1.Text + "--"
    112.                     Text2.Text = Text2.Text + "--"
    113.                     Text3.Text = Text3.Text + "--"
    114.                 End If
    115.             End If
    116.         End Select
    117.     End If
    118. End Sub

  33. #33

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    33

    Re: DirectSound Tones

    fantastic!!

    nice one CVMichael!! And what a quick reply!!

    Very helpful!

    Mathew

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