What happened to SoundPlayer from 1.4?

Last post 05-05-2008 9:44 by ChrisDeveloper. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-05-2008 8:30

    What happened to SoundPlayer from 1.4?

    My old Smart Device Framework 1.4 application played sounds using the soundplayer object and:

           SoundPlayer1.SoundLocation = "\Windows\infendo.wav"
           SoundPlayer1.Play()

    This doesn't work in VS2005, I get 'SoundLocation' is not a member of 'OpenNetCF.Multimedia.Audio.Player'.

     The 'Namespace changes in Smart Device Framework 2.x' say that 'OpenNETCF.Multimedia.Audio.Player' changes to 'OpenNETCF.Media.Player' but I can;t get that working either.

    Can anyone tell me an easy way to play a .wav sound in VB .NET using OpenNETCF or otherwise? 

     


     

     

    Wven though  

     

  • 05-05-2008 8:45 In reply to

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

    Re: What happened to SoundPlayer from 1.4?

     Put "Imports OpenNETCF.Media" at the top of the code page.  The OpenNETCF.Media.SoundPlayer is the same one you were using before, just in a different namespace.

  • 05-05-2008 8:53 In reply to

    Re: What happened to SoundPlayer from 1.4?

     Hi, thanks for your reply.

    If I add Imports OpenNETCF.Media I get errors (...doesn't contain any public member or doesn't exist).

    There is  OpenNETCF.Multimedia but that still gives me errors on the following lines:

                SoundPlayer1.SoundLocation = "\Windows\infendo.wav"
                SoundPlayer1.Play()
     

     

     

  • 05-05-2008 9:24 In reply to

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

    Re: What happened to SoundPlayer from 1.4?

    Not sure what errors you're seeing, but I just verified that it works.  Using Studio '08 I did the following:

    1. Created a new WinForm VB Smart Device application targeting CF 2.0
    2. Added a reference to OpenNETCF.dll (version 2.2)
    3. Added a single button to the Form
    4. Double-clicked the button in the designer to get a handler and then made my code look like this:
    Imports OpenNETCF.Media

    Public Class Form1

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            MessageBox.Show("With empty ctor")

            Dim player1 As New SoundPlayer()
            player1.SoundLocation = "\Windows\infendo.wav"
            player1.Play()

            MessageBox.Show("With filename in ctor")

            Dim player2 As New SoundPlayer("\Windows\infendo.wav")
            player2.Play()
        End Sub
    End Class
  • 05-05-2008 9:44 In reply to

    Re: What happened to SoundPlayer from 1.4?

    Sorry! I had left a 1.4 SDF reference in.

    I thought I'd removed them all and added the 2.2's but must have missed one.

    All working fine now. 

    Many thanks for your help. 

Page 1 of 1 (5 items)