Results 1 to 7 of 7

Thread: Vb program problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    9

    Vb program problem

    hey guyz....

    listen, am trying to create a metronome. So basicly what i have is a .wav file that plays the beat. My problem is i have got to adapt that beat to the bpm out of the scroll list. Here's what i have done till now. OH n remember try not to laugh so hard when u see the code cause im pretty new to vb myself so....

    anything helps...thx a bunch
    Attached Files Attached Files

  2. #2
    you have to put this code:
    VB Code:
    1. Private Sub Timer1_Timer()
    2. a = sndPlaySound("C:\Documents and Settings\lalis.jiménez.000\desktop\david\programacion\visual basic\descargas\metronome\beat.wav", SND_LOOP + SND_ASYNC)
    3. End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    9
    sigo sin entender...sorry

  4. #4
    mira hice unos movimientos como kitar el boton de stop a ver si entiendes el cambio asi kedo e codigo a mi me funciona pero no trabaje mucho en la formula para el beat esa tu ponsela

    VB Code:
    1. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
    2. Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    3. Private Const SND_ASYNC = &H1
    4. Private Const SND_MEMORY = &H4
    5. Private Const SND_LOOP = &H8
    6. Private Sub Command1_Click()
    7. If Command1.Caption = "Go" Then
    8. Command1.Caption = "Stop"
    9. Timer1.Interval = Text1.Text
    10. Label3.Caption = Timer1.Interval
    11. Else
    12. Command1.Caption = "Go"
    13. sndPlaySound 0, 0
    14. End If
    15. End Sub
    16. Private Sub Command2_Click()
    17. End
    18. End Sub
    19. Private Sub HScroll1_Change()
    20. Text1.Text = Str(HScroll1.Value)
    21. End Sub
    22. Private Sub hscroll1_scroll()
    23. HScroll1_Change
    24. End Sub
    25.  
    26. Private Sub Timer1_Timer()
    27. If Command1.Caption = "Stop" Then
    28. a = sndPlaySound("C:\Documents and Settings\lalis.jiménez.000\desktop\david\programacion\visual basic\descargas\metronome\beat.wav", SND_LOOP + SND_ASYNC)
    29. End If
    30. End Sub
    me dices si t funciono...

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    9
    entiendo lo q hiciste pero no estoy muy seguro q sabes como funciona un metronomo....BPM significa beats per minute. Si sale 50 en text1.text tonces el interval del timer es tambien 50 lo que quiere decir que va a haber mucho mas de 50 beats en un minuto.

  6. #6
    si se pero me daba flojera deducir la formula....pero como no podia estar agusto sin deducirla ya la sake cambia esto en la formula:

    Timer1.Interval = 60000 / Text1.Text

    asi debe funcionar bien...me avisas k tal

  7. #7
    ok habia otro error en la linea del timer y no sonaba bien el beat

    cambia la linea del timer por esta:

    a = sndPlaySound("C:\Documents and Settings\lalis.jiménez.000\desktop\david\programacion\visual basic\descargas\metronome\beat.wav", SND_LOOP)

    asi debe funcionar

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