#include #include #include void main() { // What I can do today is (using the SND_MEMORY flag) : winstl::memory_mapped_file myWAVFile("beep.wav"); ::PlaySound((LPCSTR)myWAVFile.memory(), 0, SND_MEMORY | SND_SYNC); // This is essentially identical to doing this (note using the SND_FILENAME flag): ::PlaySound("beep.wav", 0, SND_FILENAME | SND_SYNC); // this is unfortunate since the file needs to be read from the HDD for every call. // I'd like to hold the file in memory // To do this, I want to do it this way: // 1. this would be my member // ... // winstl::memory_mapped_file myWAVFile_; // !!! I can't do this now. No empty ctor!! winstl::memory_mapped_file myWAVFile_("dummy_file.txt"); // !!! I must use a dummy file! // 2. somewhere else in an initialization/configuration part I would do this: std::string myWAVFileName = "beep.wav"; // I know this at this stage winstl::memory_mapped_file tmp(myWAVFileName.c_str()); // if we got here all is well... tmp.swap(myWAVFile_); // 3. then... every time I want to play the file I do this: ::PlaySound((LPCSTR)myWAVFile_.memory(), 0, SND_MEMORY | SND_SYNC); }