Results 1 to 7 of 7

Thread: Lower level sound playing.

  1. #1

    Thread Starter
    Fanatic Member Nove's Avatar
    Join Date
    Jul 2004
    Posts
    736

    Lower level sound playing.

    I was wondering if it would be possible in Visual Basic to play sounds at lower levels, rather than just using API's and controls to play sound files. I really have no idea how sound on windows actually works, but is there a place I could learn? I'd like to just be able to get some solid notes out of my speaker for starters. Thanks.

  2. #2
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Re: Lower level sound playing.

    Best way that I use to lower and increase volume.


    form

    VB Code:
    1. Private Sub cmdLow_Click()
    2.  
    3.        modMusicStuff.subSetVolume ("Decrease")
    4.  
    5. End Sub
    6.  
    7. Private Sub cmdHigh_Click()
    8.  
    9.        modMusicStuff.subSetVolume ("Increase")
    10.  
    11. End Sub

    modMusiStuff

    VB Code:
    1. 'Increase or Decrease the volume, update volume indicator controls.
    2. Public Sub subSetVolume(sVolumeSet As String)
    3.  
    4.     Select Case sVolumeSet$
    5.                
    6.         Case "Increase"
    7.            
    8.             If modMusicVariables.iVolumeSetting < 995 Then
    9.                
    10.                 modMusicVariables.iVolumeSetting = modMusicVariables.iVolumeSetting + 166
    11.    
    12.                 'Set the playing volume.--------------------------------------------------------
    13.                 mciSendString "setaudio mp3 volume to " & modMusicVariables.iVolumeSetting, 0, 0, 0
    14.                 '-------------------------------------------------------------------------------
    15.  
    16.             End If
    17.        
    18.         Case "Decrease"
    19.        
    20.             If modMusicVariables.iVolumeSetting > 331 Then
    21.                
    22.                 modMusicVariables.iVolumeSetting = modMusicVariables.iVolumeSetting - 166
    23.                                
    24.                 'Set the playing volume.--------------------------------------------------------
    25.                 mciSendString "setaudio mp3 volume to " & modMusicVariables.iVolumeSetting, 0, 0, 0
    26.                 '-------------------------------------------------------------------------------
    27.            
    28.             End If
    29.  
    30.     End Select
    31.  
    32.     Call subVolumeInd(modMusicVariables.iVolumeSetting)

    modMusicVariables

    VB Code:
    1. Private m_iVolumeSetting As Integer
    2. 'Holds the current value of the volume.
    3.  
    4. 'm_iVolumeSetting.
    5. Property Get iVolumeSetting() As Integer
    6.     iVolumeSetting = m_iVolumeSetting
    7. End Property
    8. Property Let iVolumeSetting(newValue As Integer)
    9.     m_iVolumeSetting = newValue
    10. End Property
    Hey... If you found this post helpful please rate it.

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

    Re: Lower level sound playing.

    Quote Originally Posted by Nove
    I was wondering if it would be possible in Visual Basic to play sounds at lower levels, rather than just using API's and controls to play sound files. I really have no idea how sound on windows actually works, but is there a place I could learn? I'd like to just be able to get some solid notes out of my speaker for starters. Thanks.
    Take a look at this, it might help.
    http://www.vbforums.com/showthread.php?t=388562

    Don't forget that it is work under construction, and it's not finished yet.

  4. #4

    Thread Starter
    Fanatic Member Nove's Avatar
    Join Date
    Jul 2004
    Posts
    736

    Re: Lower level sound playing.

    Thanks, looks like I'll be waiting for how to dynamically create tones/beeps with custom frequencies.

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

    Re: Lower level sound playing.

    Quote Originally Posted by Nove
    Thanks, looks like I'll be waiting...
    Well, I did stuff like this in the past:
    http://www.vbforums.com/showthread.php?t=358329
    http://www.vbforums.com/showthread.php?t=333806

  6. #6
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Re: Lower level sound playing.

    Uh sry for spamming, but did the code I provide work?
    Hey... If you found this post helpful please rate it.

  7. #7

    Thread Starter
    Fanatic Member Nove's Avatar
    Join Date
    Jul 2004
    Posts
    736

    Re: Lower level sound playing.

    I'm sure your code works fine, I don't really have a use for it yet though, I'll have to get the whole wav thing working first. Thanks both.

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