Results 1 to 10 of 10

Thread: Wav Player

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Wav Player

    Hi,
    Can someone tell me why when I open a wav file thru dialog it works fine, but when I substitute a filename it will not play it???...thank you in advance.....

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Wav Player

    Welcome to VBForums

    With the information you have given us, all we can say is "you've done something wrong".

    To be able to help, we need more details - such as the code you are using, and a clarification of "will not play it" (eg: is there an error?).

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Re: Wav Player

    Sorry, here is the code......
    No error just does not play the file, like it does when you go thru commondialog....confused????
    Code:
    Dim x, wv
    
    x = File1.ListIndex
    cdOpenFile.FileName = Trim$(File1.List(x))
    Stop
    
        ' Play a music file
        On Error Resume Next
        cdOpenFile.CancelError = True
      '  cdOpenFile.ShowOpen
     'cdOpenFile.FileName = "0homercrap.wav"
      
        If Err.Number <> 0 Then
            Exit Sub
        End If
        Music.FileName = cdOpenFile.FileName
        tmrTimer.Enabled = True
        Position.Min = 0
        Position.Max = Music.Duration
        Position.TickFrequency = Position.Max / 10
        Position.SmallChange = Position.TickFrequency / 2
        Position.LargeChange = Position.Max / 10
        Position = 0
        Music.Volume = 0 - Volume.value
        Music.Balance = Balance.value
        Music.Speed = Speed.value / 50
        Music.Position = Position.value
        If Music.HasVideo = False Then
            picTarget.Cls
            picTarget.Print LastPart(cdOpenFile.FileName)
        End If
        Music.Play
    End Sub

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Wav Player

    You are probably getting an error that you could fix if you knew what the error was.

    However, you don't because you are using "On Error Resume Next" which ignores errors thus depriving you of the opportunity to fix them.

    Remove that statement from your code (and throw it out the nearest window) then run your code and see what happens.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Wav Player

    You cannot tell if there is an error or not, because you have explicitly told VB to pretend to you that there aren't any.

    For more information, see the article What is wrong with using "On Error Resume Next"? from our Classic VB FAQs (in the FAQ forum)

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Re: Wav Player

    Thanks, Guys........

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Re: Wav Player

    It is giving me an error on this line.... (Invalid property value)
    Position.Max = Music.Duration.....

    any help?......

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Wav Player

    What is the value of Music.Duration when the error occurs?

    What kind of object is Position? I suspect it is a scrollbar, in which case the highest value you can have is 32k.

  9. #9

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Re: Wav Player

    thank you again...

  10. #10
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Re: Wav Player

    Instead of doing that, try the MCI32.OCX control, you can play all types of media through it, and then it works fine. Just check the volume settings, in the control bar. They are changed when you use it, so then when you run it, change it to up to loud or not muted in fact.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

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