Solved

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

Posted on 2006-10-20
4
853 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

856 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