Questions tagged [playsound]

The PlaySound function plays a sound specified by the given file name, resource, or system event. (A system event may be associated with a sound in the registry or in the WIN.INI file.)

The PlaySound function plays a sound specified by the given file name, resource, or system event. (A system event may be associated with a sound in the registry or in the WIN.INI file.)

Parameters

pszSound: A string that specifies the sound to play. The maximum length, including the null terminator, is 256 characters. If this parameter is NULL, any currently playing waveform sound is stopped. To stop a non-waveform sound, specify SND_PURGE in the fdwSound parameter.

Three flags in fdwSound (SND_ALIAS, SND_FILENAME, and SND_RESOURCE) determine whether the name is interpreted as an alias for a system event, a file name, or a resource identifier. If none of these flags are specified, PlaySound searches the registry or the WIN.INI file for an association with the specified sound name. If an association is found, the sound event is played. If no association is found in the registry, the name is interpreted as a file name.

hmod: Handle to the executable file that contains the resource to be loaded. This parameter must be NULL unless SND_RESOURCE is specified in fdwSound.

fdwSound: Flags for playing the sound. The following values are defined.

209 questions
20
votes
6 answers

Immediate play sound on button click in HTML page

In my HTML page I have 9 images for dialing numbers and one text box that shows the pressed numbers. I want each of those images to immediately play beep sound when users click on them. I tried to use embed with hidden property and navigate it's…
firefalcon
  • 500
  • 2
  • 8
  • 21
11
votes
9 answers

How to PlaySound in C++ using Windows API?

I try to play a music file in my coding, but failed. I have my music file in the same folder which save .cpp file. Can someone help me? My code is: #include #include int main() { PlaySound("kenny g.WAV", NULL,…
user189748
8
votes
1 answer

How can I play a single tone or custom wave with Delphi?

I looked up some code, seems like everything is creating some math function waves, but I want to a single tone, or a custom wave made with custom single tones. I read this How can I generate continuous tones of varying frequencies? Which is close to…
MitziMeow
  • 635
  • 4
  • 13
6
votes
2 answers

Play multiple .wav files simultaniously with Naudio or Win API

Hi All I have an application which receives simultaneously wav data through multiple threads from different UDP ports: Is it possible to play all received wav data at same time, simultaneously, using Wave Out API? Is it possible to play all…
T M
  • 3,195
  • 2
  • 31
  • 52
4
votes
2 answers

How to use the playsound function multiple times?

PlaySound works perfectly fine if i need a single beep. The following illustrates my code snippet: PlaySound(TEXT("C:\\Test1.wav"), NULL, SND_ASYNC); My question is, how to use this function twice or more than twice, since it plays only once…
user133442
  • 55
  • 1
  • 5
3
votes
1 answer

#pragma comment( lib, "Winmm.lib" ) Not working

I am trying to use PlaySound and I put #include #include #pragma comment( lib, "Winmm.lib" ) using namespace std; int main() { PlaySound(L"C:\\Users\\iD Student\\Downloads\\HarryPotter.mp3", 0, SND_FILENAME); } and…
Doctor Pickle
  • 63
  • 1
  • 8
3
votes
0 answers

Playing mutiple files simultaneously with the PlaySound() API

I've recently discovered how easy it is to play a wav file using the Win32 API PlaySound() function. I'm currently implementing it in my game for my background music. I also plan to use it every time my score increases by one. Unfortunately when I…
Reanimation
  • 3,151
  • 10
  • 50
  • 88
3
votes
3 answers

PlaySound in C beeps but does not play wav file

In C, my PlaySound is not throwing any errors... but instead of playing the file I want, it just beeps. Any suggestions? I tried : PlaySound("song1.wav", NULL, SND_ALIAS | SND_APPLICATION); And: PlaySound("song1.wav", NULL, SND_FILENAME); But I…
Sam
  • 321
  • 5
  • 13
2
votes
0 answers

C# SoundPlayer macOS?

I'm new to programming and I'm trying to use the the class SoundPlayer in a C# project on Visual Studio for Mac where I want to play a sine wave but this message occurred when I typed in "SoundPlayer": The type name 'SoundPlayer' could not be found…
2
votes
0 answers

Problem with View.playSoundEffect?

I'm trying to play a soundEffect (using View.playSoundEffec() method) when a button is focused. The problem is the effects will never be played unless the target phone's Audible Selection is enabled ( It can be enabled from: Settings => Sounds &…
iTurki
  • 16,292
  • 20
  • 87
  • 132
2
votes
0 answers

C++ PlaySound with resource

I'm trying to make a specific .wav file play that I have added as a resource in my project. And when I run the program no sound is played. I've tried doing: PlaySound(TEXT("SystemStart"), NULL, SND_ALIAS); Which works and plays correctly. Then I…
MRav4
  • 21
  • 2
2
votes
1 answer

Play sound using javascript in safari

I want to play sound onclick event. I have code in which i can play sound in Firefox and other browser but not in safari. Below is the code. Safari gives me the error like "thissound.Play" [undefined ] is not a function. function EvalSound(soundobj)…
satishdas
  • 65
  • 3
  • 10
1
vote
1 answer

How to get the filepath of files added to Windows Mobile app?

I added a wav file to my Windows Mobile app and I want to use MobilePlaySound in CoreDll.dll to play it. The fileName is one of its parameters: MobilePlaySound(fileName, IntPtr.Zero, (int)(Flags.SND_ASYNC | Flags.SND_FILENAME)); I create a new…
Chilly Zhong
  • 16,763
  • 23
  • 77
  • 103
1
vote
1 answer

tkinter audio button plays sound as many times as it was clicked

i have a tkinter button setup for my program. it plays a sound file. however, if i press the button while the audio is playing, the sound file will be queued and play again once its over. i want the button to be unresponsive (so it doesnt queue the…
Cqrbon
  • 11
  • 3
1
vote
1 answer

How can I make my python UI executable play sounds

I have a script, that when running it in vsc, plays sounds in mp3 with the library playsound, but when passing it to exe with autopytoexe, I added the foldier with all the music to the exe, but the music for some reason doesn't sound. What occurs…
Habi
  • 45
  • 6
1
2 3
13 14