Solved

VB.NET 2005 - how to play a wav in an app for a windows mobile 5 application

Posted on 2006-10-20
4
856 Views
Last Modified: 2011-10-03
VB.NET 2005 - how to play a wav in an app for a windows mobile 5 application

Really struggling with this - I'm guessing the playsound wrapper isn't available..... anyone any ideas on the most efficient way of playing a wav on an ipaq?

Thanks,

Jc
0
Comment
Question by:misdevelopment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Expert Comment

by:sivic82
ID: 17776137
By playsound wrapper I'm assuming your refering to my.Computer.Audio.Play("c:\my.wav")??
0
 

Author Comment

by:misdevelopment
ID: 17776610
Yes, we don't seem to have this available to us, even though we've looked to reference and import anything that looked like it might do the job.... I guessed that with it being for a mobile device that the classes weren't valid...
0
 
LVL 13

Accepted Solution

by:
newyuppie earned 500 total points
ID: 17778338
i've made a class that plays wav files asynchronously from your resources. you just need to insert the wav file in the sound resources, select Embedded in ResX for both the resource, and the file in the Solution Explorer too, in the resources folder.

Imports System
Imports System.Media
Imports System.Resources
Imports System.Reflection
Imports System.IO

Public Class Sound
    Public Shared Sub PlayWavResource(ByVal wav As String)

        ' get the namespace
        Dim strNameSpace As String = Assembly.GetExecutingAssembly().GetName().Name.ToString()
        Dim tempSpace As String = "CSCM"

        ' get the resource into a stream
        Dim resourceStream As Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(tempSpace + "." + wav)
        If resourceStream Is Nothing Then Exit Sub

        With New SoundPlayer(resourceStream)
            .Play()
        End With
    End Sub

End Class
0
 
LVL 13

Expert Comment

by:newyuppie
ID: 17778342
just replace
Dim tempSpace As String = "CSCM"

with
Dim tempSpace As String = [your root namespace]
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question