locked
Sounds are more noise than anything else RRS feed

  • Question

  • The Sound.PlayClick() sound like a buzz saw.

    Sound.PlayClickAndWait() sounds like a click ought to sound.

    Same with the other non-"AndWait" sounds, as far as I can tell.

     


    RussPC
    Tuesday, November 29, 2011 12:28 PM

Answers

  • Hard to say what really is wrong because FindSquare() & DrawMarker() are missing but Sound.PlayClick() probably cuts off previous Sound.PlayClick() which causes your buzz saw sound.

    Can't you do FindSquare() inside OnMouseDown and play click inside it?

    And if you want better performance I recommend you to replace "True" with 1 and "False" with 0.

    Tuesday, November 29, 2011 9:31 PM

All replies

  • If you re-start the PlayClick before the last has finished then you get the problem, hence the PlayClickAndWait.
    Tuesday, November 29, 2011 3:13 PM
  • Sounds are regular mp3 sounds. Those sounds are not in best quality available but work well with those who just need some sounds to their programs.

    Did you use only Sound.PlayClick() as your code? On slow machines that could produce some funny noise before program shuts down. On my computer it play anything because program ends so much faster.

    TextWindow.Show()
    Sound.PlayChime()
    

    Should work well because TextWindow is visible, which prevents ending of program and sound can play normally.
    Sound.PlayClickAndWait()


    PlayAndWait has same effect to SmallBasicApplication than TextWindow being visible.

     

    One explanation could be cheap and ****** sound card + speakers.

    Tuesday, November 29, 2011 3:32 PM
  • Here's the code in question:

    While (NotEnd = "True")
      If (MouseClicked = "True") Then
        FindSquare()
       
        If (SquareFound <> 0) And (SquareTaken[SquareFound] = 0) then 
          Sound.PlayClick()
      
          If WhoPlayed = "C" then
            WhoPlayed = "P"
            DMc = PlayerColor
          Else
            WhoPlayed = "C"
            DMc = ComputerColor
          EndIf   '  Who played?
         
          DMs = SquareFound     
          DrawMarker()
          SquareTaken[SquareFound] = 1     
        EndIf   '  Square not taken
       
        MouseClicked = "False"
      EndIf   ' Mouse Clicked
    EndWhile

    '  Catch the Mouse Down event and signal the main program
    Sub OnMouseDown

      If MouseClicked <> "True" Then
        MouseX = GraphicsWindow.MouseX
        MouseY = GraphicsWindow.MouseY
        MouseClicked = "True"
      EndIf
    EndSub

    This is the gist of the looping.  There is nothing in what I have written that ought to interfere with the Sound.PlayClick() that I can see.

    Using the "AndWait" form works for me, it's good enough for my application.

     


    RussPC
    Tuesday, November 29, 2011 8:59 PM
  • Hard to say what really is wrong because FindSquare() & DrawMarker() are missing but Sound.PlayClick() probably cuts off previous Sound.PlayClick() which causes your buzz saw sound.

    Can't you do FindSquare() inside OnMouseDown and play click inside it?

    And if you want better performance I recommend you to replace "True" with 1 and "False" with 0.

    Tuesday, November 29, 2011 9:31 PM
  • Hard to say what really is wrong because FindSquare() & DrawMarker() are missing but Sound.PlayClick() probably cuts off previous Sound.PlayClick() which causes your buzz saw sound.

    There is only instance of Sound.PlayClick() per mouse click.  This is why there is the If MouseClicked ... EndIf, with MouseClicked = "False" coming before the EndIf.

    Can't you do FindSquare() inside OnMouseDown and play click inside it?

    My coding discipline is to have an interrupt (or "Event" in this case) merely capture appropriate information (MouseX and Mousey in this case) and set a flag which the main code checks periodically.  Besides, the OnMouseClick event may actually come from other places than the expected ones, for other purposes perhaps.  This makes life a lot easier.

    And if you want better performance I recommend you to replace "True" with 1 and "False" with 0.

    I do agree with you.  In the case here, some of the code was lifted from another program which uses the "True" and "False", possibly to keep in mind that it is a Boolean variable.  As for efficiency, I don't think one need worry about that in SB.


    <input id="18337acd-87e9-44fa-804a-ca51d17374f5_attachments" type="hidden" />

    RussPC
    Tuesday, November 29, 2011 10:36 PM