Diablicolic Posted September 22, 2003 Posted September 22, 2003 Ok! Now when I play my sound, it doesn't loop even though I added the loop stuff: Const SND_LOOP As Integer = &H8 And here is the code that makes the sound Alarm.wav: Sound.PlaySound("Data/Sounds/Alarm.wav", 0, SND_LOOP Or SND_SYNC) The sound doesn't seem to loop even though it did with the previous version of PlaySound. I'm pretty sure I didn't add any code to stop it, or have any sounds that would destroy that current sound. It plays once and then just stops! Somebody help me! Quote "Reality is fake, Dreams are for real"
Leaders Squirm Posted September 22, 2003 Leaders Posted September 22, 2003 You're passing SND_SYNC which means the method would not return until the sound has finished playing. If the sound were being looped it would never finish and so the method would never return. The application would hang indefinitely at this point. Try using SND_ASYNC instead. Quote Search the forums | Still IRCing | Be nice
Diablicolic Posted September 22, 2003 Author Posted September 22, 2003 (edited) I tried that but it still doesn't loop, something tells me I'm doing something bad on form load. Because the music plays when the form is opening, and then when the form is fully opened and all of the images are there it stops. I have another question about PlaySound: PlaySound(Nothing, 0, SND_PURGE) What is the 0 for? I just put 0 there all of the time ------------- hahaha, whenever I put: Sound.PlaySound("Data/Sounds/Alarm.wav", 0, SND_LOOP) ANYWHERE, it freezes everything! What is goin' on?! Edited September 22, 2003 by Diablicolic Quote "Reality is fake, Dreams are for real"
Diablicolic Posted September 22, 2003 Author Posted September 22, 2003 (edited) These are my tags at the top of the class! Private Const SND_SYNC = &H0 '// Play sound at the same time together Private Const SND_ASYNC = &H1 '// Play sound once at a time Private Const SND_NODEFAULT = &H2 '// Silence if the sound sound is not found Private Const SND_MEMORY = &H4 '// Points to a sound in memory Private Const SND_LOOP = &H8 '// Loop the sound Private Const SND_NOSTOP = &H10 '// DonAs Integer 't stop the current sound Private Const SND_NOWAIT = &H2000 '// DonAs Integer 't wait if the driver is busy ?? Private Const SND_ALIAS = &H10000 '// Name is a Registry alias Private Const SND_ALIAS_ID = &H110000 '// Alias is a predefined ID Private Const SND_FILENAME = &H20000 '// Name is a file name Private Const SND_RESOURCE = &H40004 '// Name is resource name or atom Private Const SND_PURGE = &H40 '// Purge non-static events for task ?? Private Const SND_APPLICATION = &H80 '// Look for application-specific association Edited September 22, 2003 by Diablicolic Quote "Reality is fake, Dreams are for real"
aewarnick Posted September 22, 2003 Posted September 22, 2003 In the WinApi 0 usually just means that parameter is not used or null. You have to be careful when using the WinApi. I have had the computer totally reboot without warning when using BitBlt. Quote C#
*Experts* Volte Posted September 22, 2003 *Experts* Posted September 22, 2003 Obviously you didn't even read Squirm's post:Sound.PlaySound("Data/Sounds/Alarm.wav", 0, SND_LOOP Or SND_ASYNC)You need the ASYNC flag. Quote
Leaders Squirm Posted September 23, 2003 Leaders Posted September 23, 2003 What is the 0 for? I just put 0 there all of the time If you read MSDN, you'll see that the second parameter for PlaySound is a handle to the module which contains the sound resource, if playing from resource. Since you aren't playing from resource, this should be zero. Quote Search the forums | Still IRCing | Be nice
Diablicolic Posted September 23, 2003 Author Posted September 23, 2003 Obviously you didn't even read Squirm's post:Sound.PlaySound("Data/Sounds/Alarm.wav", 0, SND_LOOP Or SND_ASYNC)You need the ASYNC flag. No no I did, I tried ASYNC, SYNC, Just Loop, etc etc. I did read Squirm's post but I guess I didn't tell you guys that I tried a whole bunch of other ways including ASYNC. But since I already had a MySound Class on my other C# Project (because I had two projects), I used that class instead at which is the same thing except just in C#. Thank yall for your help! :) Quote "Reality is fake, Dreams are for real"
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.