Play a NOT-wav File with SoundPlayer

Last post 10-12-2008 16:57 by ctacke. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 10-09-2008 20:03

    • mcx
    • Top 150 Contributor
    • Joined on 10-10-2008
    • Posts 4

    Play a NOT-wav File with SoundPlayer

     Hello,

     I'm working on an alert program which is meant to play sounds... an unfortunately i don't want to play wav-files, so i cannot implement the standard player from .NET.

     As far as i know the OpenNetCF framework is able to play also mp3 and wma, but i don't get it to work... neither wav nor wma or something else..

     I'm developing with VB2008 and the code is here:

            Dim audioStream As Stream
            audioStream = File.OpenRead("chimes.wav")
            Dim player As New OpenNETCF.Media.SoundPlayer
            player.Stream = audioStream
            player.Play()

     

    the other way is

           Dim player As New OpenNETCF.Media.WaveAudio.Player
           player.Play(File.OpenRead("chimes.wav"))

     for wav's only..

     

    i'm getting always an error on the PC as well as on my smartphone, but i don't know why...

     

    do you?

     

    thanks

    MCX

     

  • 10-09-2008 21:19 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,940

    Re: Play a NOT-wav File with SoundPlayer

    "As far as you know" is incorrect.  The Smart Device Framework's SoundPlayer uses the waveOutXxxx APIs (which you can fine in MSDN), which only take WAV files as input.  We don't have support for compressed audio formats.

  • 10-10-2008 9:49 In reply to

    • mcx
    • Top 150 Contributor
    • Joined on 10-10-2008
    • Posts 4

    Re: Play a NOT-wav File with SoundPlayer

     "OpenNETCF's Media Player controls provide managed-code developers robust controls that allow custom applications to include playback of MPEG, AVI, and WMA files along with the ability to control playback without having to shell out to Media Player."

     and what is that? hmm..

     

    anyway, how do i get the framework to play wav.. it doesn't work with my code but i don't know why...

  • 10-10-2008 9:53 In reply to

    • Neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,153

    Re: Play a NOT-wav File with SoundPlayer

    mcx:

     "OpenNETCF's Media Player controls provide managed-code developers robust controls that allow custom applications to include playback of MPEG, AVI, and WMA files along with the ability to control playback without having to shell out to Media Player."

     and what is that? hmm..

    That is a completely different product and has nothing to do with the Smart Device Framework whatsoever.


  • 10-10-2008 12:17 In reply to

    • mcx
    • Top 150 Contributor
    • Joined on 10-10-2008
    • Posts 4

    Re: Play a NOT-wav File with SoundPlayer

    ok... is understood.. but what is wrong now with my code that it doesn't playback wav-files too?
  • 10-10-2008 13:31 In reply to

    • Neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,153

    Re: Play a NOT-wav File with SoundPlayer

    Given the information we have from you, there is nothing wrong with the code. You state that the code does not work for you. How does it not work? Do you get an exception? If so, what is it? What are the actual results when you run code? The more details you provide, the better positioned we will be to help you.


  • 10-12-2008 14:52 In reply to

    • mcx
    • Top 150 Contributor
    • Joined on 10-10-2008
    • Posts 4

    Re: Play a NOT-wav File with SoundPlayer

     alright, i got it to work. it was the path. seems so as if opennetcf doesn't support current paths.. so you have to enter the full path (e.g. "\My Documents\chimes.wav").

  • 10-12-2008 16:57 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,940

    Re: Play a NOT-wav File with SoundPlayer

     Has nothing to do with "OpenNETCF" not supporting them.  The CE OS doesn't support or have any concept of a current path, so all file paths in all applications or environements must be fully qualified.

Page 1 of 1 (8 items)