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
1
vote
0 answers

C++ - Play Audio from buffer asynchronous

I come from a .net background and fairly new to developing in C++. I have a buffer like this: short* pBuffer = &pGraph->m_pDataBuf[0]; How can I play this buffer from sound card? Note: This buffer is filled in loop and in every cycle, I want to…
1
vote
1 answer

How to handle fcm when app in in background and play sound on notification arrival in flutter

I want to play a sound when a notification arrives, but I am not able to play. If the app is opened the sound is played and is working fine. But when the app is killed I see the notification but the sound is not played. Please help how to do…
1
vote
0 answers

Application (sometimes) crashes on PlaySound()

I'm writing a game where player picks coins. Picking a coin there is supposed to be a sound, I use PlaySound to play *.wav file. It works. But sometimes (7/10 attempts) app just crushes. I have no idea why sometimes is works and sometimes it…
1
vote
0 answers

Can an audio session cause app delegate to crash during an interruption?

I am seeing a crash in AppDelegate. I believe it is related to a song ending just as I go to make an in-app purchase or possibly the sound effect that I play when an in-app purchase completes (sort of a coin sound), as it happens occasionally but…
1
vote
2 answers

using winsound, plays error sound instead of chosen sound

I am using winsound to play a swoosh sound: winsound.PlaySound("D:\GamesImade\pythonpong\bounce.wav", winsound.SND_ASYNC) When I run it with my IDE it works. But if I run the exe file by itself it doesn't work, it plays the windows error sound.
1
vote
2 answers

No sound is generated when using PlaySound()

Basically I want to use the PlaySound() function in ctypes. Yes I know winsound module is built on it and I could use that, but I have a reason to not do so :) In C I would call the function like this: PlaySound("sound.wav", NULL,…
Xantium
  • 11,201
  • 10
  • 62
  • 89
1
vote
1 answer

C - PlaySound() not finding file when passing location as char[]

I'm trying to play certain .wav files based on an int value. Currently my program makes .wav files fine, and I can play them manually. I'm storing the location of the .wav files in a char[] member under a structure called sInt: extern struct sInt…
Kevin9
  • 31
  • 5
1
vote
1 answer

How lost phone finding Apps ring the iphone even in Silent mode and App Killed stated

There are many 'Apple Device Finder' Apps in the store. Many of them help the user to ring the iphone even when the phone is in silent mode. I am trying to find out how this is achieved. How can we play sound on the iPhone which is the silent mode.…
MouzmiSadiq
  • 2,069
  • 3
  • 18
  • 21
1
vote
1 answer

C++ PlaySound(); returning Undefined reference to PlaySoundW@12

I've been trying to play a .M4A file with PlaySound(); in code::blocks (C++). I looked on several websites and found nothing that really helped me. I probably made a REALLY small mistake, but if anybody can help, that would be great. #include…
1
vote
1 answer

Make audio 'resume' after being stopped?

I'm building a Text-Based RPG, and I've managed to add some .wav files to my program with no issue, I'm also able to play them properly with no issue either. What happens currently? I have 2 .wav files, 1 for general background music…
toadflax
  • 375
  • 4
  • 17
1
vote
1 answer

Visual C++ or C play sounds

I'm developping an easy game written in C (Visual C++) and I want to know if there is a way to play sounds, thanks (I'm using Visual Studio)
ohhConti
  • 23
  • 1
  • 6
1
vote
1 answer

It said there's something wrong with the header file, mmsystem.h, i can't use PlaySound()

#include #include #include #include #include #pragma comment (lib, "winmm.lib") using namespace std; int main() { PlaySound(TEXT("Happy Birthday To You.wav"), NULL, SND_SYNC); …
Gavin.G
  • 13
  • 9
1
vote
1 answer

How to play the audio of a SoundCloud song via URL input

I am coding a Minecraft plugin, (Just a modification to the game Minecraft but used on a Minecraft server, not a client modification) and I want to create something that when a player inputs "/playsong" along with a SoundCloud URL, it will find that…
Matthew274
  • 19
  • 2
1
vote
1 answer

How to deactivate playing a sound

I have been trying to figure out how to deactivate playing a sound. I tried to attached a removeAtionWithKey with a sound action, and it seems to be working fine, but the sound does not stop to play. Is this because I am using action in…
Ryohei
  • 713
  • 2
  • 9
  • 20
1
vote
1 answer

AudioServicesCreateSystemSoundID only once in application and play sound from anywhere

I am doing following stuff to play a sound on button tap. But here, I guess it loads sound file every time I tap on button. if let soundURL = NSBundle.mainBundle().URLForResource("notification", withExtension: "mp3") { var mySound: SystemSoundID =…
Sumit Jain
  • 146
  • 1
  • 9
1 2
3
13 14