简体   繁体   中英

C# winform - playing wav files from embedded resource

I have 15 1-second wav files, that need to play one every second, for 2 minutes. Is it better to read the wav files into memory at application load and play from there, or load on the fly from Properties.Resources each second?

would this be something that potentially keep adding additional WAV files down the line? If not, i would strongly recommend loading them up into a memory container that you can spin off new threads for each execution.

Maybe doing it hybrid. Take a look, if it is in memory and if not (first time needed) load it into it (maybe with a Dictionary<string, Stream> ) and use it from there. So you don't have a big load issue at the beginning and you only take these files into memory that really needed and not the maybe existing but not needed ones.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM