|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Play wavs in VB2005.I'm struggle with playing a wav in Visual Basic. First I wanted to use My.Computer.Audio.Play() method but I realized it's not working if I want to have music in background. I found in internet SoundPlayer Class but unfortunately I can't find it in my Visual Studio Application. Whenever I try to use it Dim Player New SoundPlayer ... VS 2005 doesn't find it. What's wrong ? Please help me. Thnaks Regards. -- ZikO GG 5557876 If you search for SoundPlayer in the Object Browser (View / ObjectBrowser),
you'll find that it lives in the System.Media.Soundplayer namespace. The ObjectBrowser is handy for figuring out what you need references to. Robin S. Show quoteHide quote "ZikO" <ze***@op.pl> wrote in message news:ej7dq4$t1m$1@news.onet.pl... > Hi. > > I'm struggle with playing a wav in Visual Basic. First I wanted to use > My.Computer.Audio.Play() method but I realized it's not working if I want > to > have music in background. > > I found in internet SoundPlayer Class but unfortunately I can't find it in > my Visual Studio Application. Whenever I try to use it > > Dim Player New SoundPlayer ... > > VS 2005 doesn't find it. > > What's wrong ? Please help me. Thnaks > > Regards. > > > -- > ZikO > GG 5557876 "RobinS" <RobinS@NoSpam.yah.none> wrote in message What would be the reason I don't see it in Object Browser? I can't See news:68Kdnb04r9dzxsrYnZ2dnUVZ_oWdnZ2d@comcast.com... > If you search for SoundPlayer in the Object Browser (View / > ObjectBrowser), you'll find that it lives in the > System.Media.Soundplayer namespace. The ObjectBrowser is handy for > figuring out what you need references to. Robin S. > "ZikO" <ze***@op.pl> wrote in message news:ej7dq4$t1m$1@news.onet.pl... System.Media.SoundPlayer, I can't even see System.Media ?! Was it something wrong during instalation? Regards. -- ZikO GG 5557876 "ZikO" <ze***@op.pl> schrieb: Maybe your project is lacking references to the library containing the > What would be the reason I don't see it in Object Browser? I can't See > System.Media.SoundPlayer, I can't even see System.Media ?! > > Was it something wrong during instalation? class. Look up the DLL name in the documentation on the 'SoundPlayer' class and add a reference via "Project" -> "Add reference...". -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message I found it in Add reference ... window, I've added as System reference but news:efIj1QpBHHA.3604@TK2MSFTNGP03.phx.gbl... > "ZikO" <ze***@op.pl> schrieb: >> What would be the reason I don't see it in Object Browser? I can't See >> System.Media.SoundPlayer, I can't even see System.Media ?! >> Was it something wrong during instalation? > Maybe your project is lacking references to the library containing the > class. Look up the DLL name in the documentation on the 'SoundPlayer' > class and add a reference via "Project" -> "Add reference...". it still can't recognize that it exist, I still can't use it. This is a very new area for me and probably Im doing something wrong. Can someone explain it to me by step by step, please? Thanks so much. -- ZikO GG 5557876 Try adding
Imports System.Media.Soundplayer to the top of your class, before the Class definition. Or go back to the References for your project (double-click on My Project in Solution Explorer and choose the References tab). In the bottom of the window, you see "Imported namespaces". Find System.Media.Soundplay and check the checkbox. (You have to click on it twice; there's a bug in VS2005). This will import it into your entire project. Robin S ----------------- Show quoteHide quote "ZikO" <ze***@op.pl> wrote in message news:ej8dd5$tmk$1@news.onet.pl... > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message > news:efIj1QpBHHA.3604@TK2MSFTNGP03.phx.gbl... >> "ZikO" <ze***@op.pl> schrieb: >>> What would be the reason I don't see it in Object Browser? I can't See >>> System.Media.SoundPlayer, I can't even see System.Media ?! >>> Was it something wrong during instalation? >> Maybe your project is lacking references to the library containing the >> class. Look up the DLL name in the documentation on the 'SoundPlayer' >> class and add a reference via "Project" -> "Add reference...". > > I found it in Add reference ... window, I've added as System reference but > it still can't recognize that it exist, I still can't use it. This is a > very new area for me and probably Im doing something wrong. Can someone > explain it to me by step by step, please? Thanks so much. > > > -- > ZikO > GG 5557876 > Try adding In Imported namespaces I can see only System.Media, I can't see > Imports System.Media.Soundplayer > to the top of your class, before the Class definition. > Or go back to the References for your project (double-click > on My Project in Solution Explorer and choose the References > tab). In the bottom of the window, you see "Imported namespaces". > Find System.Media.Soundplay and check the checkbox. > (You have to click on it twice; there's a bug in VS2005). > This will import it into your entire project. > Robin S > ----------------- SoundPlay!Maybe it's because System.Media are namespaces whilst SoundPlay is a class. Anyway, even when I import System.Media by double-click I can't see difference. The tick has appeared besides System.Media but in code window, editor still can't see SoundPlay class. It's really odd. -- ZikO GG 5557876 You're right, it's the System.Media namespace.
If you type in Dim Player as System.Media.Soundplayer does the Intellisense kick in after Media. and show Soundplayer? Open the object browser (View / ObjectBrowser). Search for "soundplayer". Do you see it? Here's a link to an article on msdn about how to use it; this has an example in VB. Is there something about how you're using it that is incorrect? http://msdn2.microsoft.com/en-us/library/system.media.soundplayer.aspx What did you mean about not being able to use My.Computer.Audio.Play() because it doesn't play music in the background? Do you mean you want to have it playing while you're doing other stuff, and if you click off of the program, it stops playing? Robin S. --------------------------------------- Show quoteHide quote "ZikO" <ze***@op.pl> wrote in message news:ejfopd$ubu$1@news.onet.pl... >> Try adding >> Imports System.Media.Soundplayer >> to the top of your class, before the Class definition. >> Or go back to the References for your project (double-click >> on My Project in Solution Explorer and choose the References >> tab). In the bottom of the window, you see "Imported namespaces". >> Find System.Media.Soundplay and check the checkbox. >> (You have to click on it twice; there's a bug in VS2005). >> This will import it into your entire project. >> Robin S >> ----------------- > > In Imported namespaces I can see only System.Media, I can't see > SoundPlay!Maybe it's because System.Media are namespaces whilst SoundPlay > is a class. Anyway, even when I import System.Media by double-click I > can't see difference. The tick has appeared besides System.Media but in > code window, editor still can't see SoundPlay class. It's really odd. > > > -- > ZikO > GG 5557876 I found it in Video Tutorials about VB.NET 2005 SoundPlayer class
http://msdn.microsoft.com/vstudio/express/media/en/visualcsharp/AudioPart1CS.wvx There was one missing line: ' Friend WithEvents MyPlayer As New System.Media.SoundPlayer (of course I could use Imports System.Media ...) After this I could work with SoundPlayer class e.g. ' myPlayer.SoundLocation = "/..." ' myPlayer.Play() Without this line SoundPlayer couldn't be recognized by VB. > Open the object browser (View / ObjectBrowser). Yes.> Search for "soundplayer". Do you see it? > Here's a link to an article on msdn about how to use it; I just couldn't use it anyhow because VB didn't recognized it but now it > this has an example in VB. Is there something about how > you're using it that is incorrect? > http://msdn2.microsoft.com/en-us/library/system.media.soundplayer.aspx works but that line above is not clear for me :/. Anyway it works now. > What did you mean about not being able to use I mean that I want to play a few sounds at the same time, say song in the > My.Computer.Audio.Play() because it doesn't play music background and some short sounds during clicking e.g. When I used My.Computer.Audio.Play() and I use sound for clicking, the song stops playing, as sound for clicking is supposed to play. Anyway SoundPlayer work very similarly. I think I need to use Windows Media Player, although I wanted to avoid that. Thanks so much for giving me a hand :). I have done it with your help :). Regards. -- ZikO GG 5557876 You're welcome. Good luck.
Robin S. --------------------------------------- Show quoteHide quote "ZikO" <ze***@op.pl> wrote in message news:ejiuom$i5g$1@news.onet.pl... >I found it in Video Tutorials about VB.NET 2005 SoundPlayer class > http://msdn.microsoft.com/vstudio/express/media/en/visualcsharp/AudioPart1CS.wvx > > There was one missing line: > > ' Friend WithEvents MyPlayer As New System.Media.SoundPlayer > > (of course I could use Imports System.Media ...) After this I could work > with SoundPlayer class e.g. > > ' myPlayer.SoundLocation = "/..." > ' myPlayer.Play() > > Without this line SoundPlayer couldn't be recognized by VB. > >> Open the object browser (View / ObjectBrowser). >> Search for "soundplayer". Do you see it? > > Yes. > >> Here's a link to an article on msdn about how to use it; >> this has an example in VB. Is there something about how >> you're using it that is incorrect? >> http://msdn2.microsoft.com/en-us/library/system.media.soundplayer.aspx > > I just couldn't use it anyhow because VB didn't recognized it but now it > works but that line above is not clear for me :/. Anyway it works now. > >> What did you mean about not being able to use >> My.Computer.Audio.Play() because it doesn't play music > > I mean that I want to play a few sounds at the same time, say song in the > background and some short sounds during clicking e.g. When I used > My.Computer.Audio.Play() and I use sound for clicking, the song stops > playing, as sound for clicking is supposed to play. Anyway SoundPlayer > work very similarly. I think I need to use Windows Media Player, although > I wanted to avoid that. > > Thanks so much for giving me a hand :). I have done it with your help :). > Regards. > > > -- > ZikO > GG 5557876
"how to split a string in a random way"
Extract Single Record from Dataset filled from SP Output Creating text boxes on the fly? Compression namespace for Array Able .NET ? for each step order reverse direction ? single line string maninuplation substring, trim, indexof ? Installing .net assemblies windows installer About Access Windows Service information Shared database without network tech required |
|||||||||||||||||||||||