User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 391,706 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,293 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser:
Views: 195 | Replies: 1
Reply
Join Date: Apr 2008
Posts: 26
Reputation: FreezeBlink is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
FreezeBlink FreezeBlink is offline Offline
Light Poster

winsound SND_PURGE not working.

  #1  
Jun 30th, 2008
Sorry to have to post two consecutive questions for other people to help me with, but I'm having a problem with winsound that I simply can't figure out. I've checked all the documentation I could, but there's no answer.

The problem is with SND_PURGE.
Originally Posted by Python Library Reference
SND_PURGE
Stop playing all instances of the specified sound.

This is used in conjunction with PlaySound, which has the following entry:

PlaySound( sound, flags)

Call the underlying PlaySound() function from the Platform API. The sound parameter may be a filename, audio data as a string, or None. Its interpretation depends on the value of flags, which can be a bit-wise ORed combination of the constants described below. If the system indicates an error, RuntimeError is raised.

Also, SND_FILENAME is needed, I believe, since I'm playing from a file.
SND_FILENAME
The sound parameter is the name of a WAV file. Do not use with SND_ALIAS.

--------------------

Alright, so here's a problem. Put simply, SND_PURGE appears to do nothing.

Yes, absolutely nothing, no matter how I present it.

Take the following code. It shouldn't do anything, right?

  1. from winsound import *
  2.  
  3. PlaySound("testSound.wav",SND_FILENAME) # Play testSound.wav
  4. PlaySound("testSound.wav",SND_FILENAME|SND_PURGE) # Stop playing testSound.wav

Well, that doesn't work. Take out the SND_FILENAME from the fourth line? Still doesn't work. Am I using this wrong? And if so, can someone propose an alternative? Thanks in advance.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 1,004
Reputation: Ene Uran is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 64
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Veteran Poster

Re: winsound SND_PURGE not working.

  #2  
Jul 1st, 2008
I don't think the SND_PURGE flag is meant to work the way you interpreted it.
drink her pretty
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Python Marketplace
Thread Tools Display Modes

Other Threads in the Python Forum

All times are GMT -4. The time now is 2:54 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC