Home > Back-end >  Under Windows 7 why playsound is so slow.
Under Windows 7 why playsound is so slow.

Time:09-20

I am making a small tool start input keyboard and playsound asynchronous broadcasting digital wav files, use under xp system is normal, voice broadcast under Windows 7 is slow, often the second number is showed the first wav files did not play, play the second wav files directly,

This exactly is what problem, what's the solution?

CodePudding user response:

Asynchronous broadcasting range is finished playing and then execute the next step, to broadcast, remove SND_ASYNC asynchronous tag can, voice should be fixed length, is slow, test the length of each step is ok,

CodePudding user response:

The wav are loaded into memory, again from memory buffer (pointed out SND_MEMORY logo, so that the first parameter to memory address),

CodePudding user response:

This is Windows 7 the characteristics of the buffer, sometimes go that constantly turn, my,
Especially with the disk file, reading is out of sync,

CodePudding user response:

Will play the file cache first, loaded into memory, read directly from memory,

CodePudding user response:

All loaded into memory, and then go directly from memory

CodePudding user response:

reference 1st floor santiaodahan response:
asynchronous broadcasting range is finished playing and then execute the next step, to broadcast, remove SND_ASYNC asynchronous tag can, voice should be fixed length, is slow, test the length of each step is ok,
synchronization will will be blocked, input speed is more slow,

CodePudding user response:

Recommend the audio file read into memory, can realize synchronous playback,

CodePudding user response:

refer to 6th floor towoo2001 response:
Quote: refer to 1st floor santiaodahan response:

Asynchronous broadcasting range is finished playing and then execute the next step, to broadcast, remove SND_ASYNC asynchronous tag can, voice should be fixed length, is slow, test the length of each step is ok,
synchronization will will be blocked, input speed is more slow,

File playback time is fixed, the there is no fast, could have read latency, if don't play full synchronous how do you control? Or you don't need to play the full? How to measure the length or in environmental test, or post code,

CodePudding user response:

refer to 7th floor lyhoo163 response:
will be advised to audio file read into memory, can realize synchronous playback,

Thank you for your advice, I tried to load the memory, at the root of the problems found in all of the machines are Intel platform, I only this one is amd platforms, that sounds like the amd on thread processing slow half,

CodePudding user response:

refer to the eighth floor santiaodahan response:
Quote: refer to the sixth floor towoo2001 response:

Quote: refer to 1st floor santiaodahan response:

Asynchronous broadcasting range is finished playing and then execute the next step, to broadcast, remove SND_ASYNC asynchronous tag can, voice should be fixed length, is slow, test the length of each step is ok,
synchronization will will be blocked, input speed is more slow,

File playback time is fixed, the there is no fast, could have read latency, if don't play full synchronous how do you control? Or you don't need to play the full? How to measure the length or in environmental test, or post code,

Problems appeared in the AMD platforms, Intel platform 7 slow down a little, but could not perceive, AMD platform just slow death,
  • Related