I have a 424 mb wav file, which I want to play, but it takes a lot of time to load, and it uses 425.6 mb of ram. Way too much ram for a dos format program. I want to load only a part of the song, then when it's almost at the final, load the second part, when the second part is played, remove from ram the first part, and etc. For this I should use 50 parts.
Here is the line of code:
PlaySound("../music/main.wav", NULL, SND_FILENAME|SND_LOOP|SND_ASYNC);
I mention that I need to run this in background, while the other commands do their roles.
How do I make PlaySound load only some parts of the song C++
219 Views Asked by TheRealOne78 At
1
There are 1 best solutions below
Related Questions in C++
- C++ using std::vector across boundaries
- Linked list without struct
- Connecting Signal QML to C++ (Qt5)
- how to get the reference of struct soap inherited in C++ Proxy/Service class
- Why we can't assign value to pointer
- Conversion of objects in c++
- shared_ptr: "is not a type" error
- C++ template using pointer and non pointer arguments in a QVector
- C++ SFML 2.2 vectors
- Lifetime of temporary objects
- I want to be able to use 4 different variables in a select statement in c ++
- segmentation fault: 11, extracting data in vector
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- How can I print all the values in this linked list inside a hash table?
- Configured TTL for A record(s) backing CNAME records
Related Questions in RAM
- C# console application - Unhandled exception while finding the Available and free Ram space.Getting exact answer in windows forms application
- Do pictures ever get stored in RAM?
- Find Ram/Memory manufacturer in Linux?
- Android Studio randomly disappears/crashes with 7GB Ram
- Search for file in archive and load it into memory
- Upgrading RAM on a 32-bit system to boost up android studio?
- sort runs out of memory
- Android RAM usage error with broadcast receiver in service
- System.Management, Management Object Searcher, and RAM
- How to calculate RAM usage of a image when decoded
- JavaFX high memory usage
- Could AWE or anything else could help to use more SQL memory
- Whole Oracle database in memory
- Is it possible to sort 3 GB of java on 32 bit system using JAVA
- Get Ram Information OSX
Related Questions in PLAYSOUND
- play .wav file using c language
- applicationDidEnterBackground, playSoundFileNamed Crash
- VC2013 Express unresolved link PlaySound
- PlaySound in C++ using CLion
- How to compile a c++ console application which uses the PlaySound function?
- Problem To Download playsound Module using pip
- playsound package to play sound in python
- Manage sounds on multiple open tabs react
- How to play the same sound every minute?
- How to calculate the dbHL in flutter?
- How do I make PlaySound load only some parts of the song C++
- Using PlaySound() in MASM, need a method to help run this in the background without the code waiting for the entire .wav sound file to finish
- Having a Problem playing .WAV files in java
- i am a beginner in python trying to use playsound module ,when run program ,it shows The specified device is not open or is not recognized by MCI
- Why does invoking the playsound module cause my script to crash?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
PlaySoundis a fairly high-level function, so it's tricky to get behavior like this. In particular, you will likely experience small silent gaps between playing back the different parts. So the best solution would be to go to a lower-level API that allows more sophisticated managing of sound playback buffers. OpenAL is a good library for doing this, the modern Windows native solution is WASAPI, which unfortunately is quite complicated to use.With
PlaySounditself, first adjust your program to load the.wavfile to memory and then useSND_MEMORYfor playing it from memory (example).Now, instead of loading the whole
.wavfile at once, you just load the header and as many soundframes as fill your buffer. You then create your own.wavheader for just those loaded samples and put it all in a contiguous buffer. You basically build your own, smaller.wavfile in memory. Then you callPlaySound(..., SND_MEMORY)on that buffer. Rinse and repeat for the remaining samples from the original file.Note that you will need your own
.wavfile format parser for this, but the file format is not that complicated, so hopefully this should not be too much of an issue.