MCI?
After doing some searching with Google about the method to play an audio file on Windows, most of the returned result are about the Microsoft’s Multimedia Control Interface, calling the function PlaySound() of that library.
But it’s just playing, and there are still a lot to handle, including volume control, fast forward, fast backward, … So I look a closer look to the MCI and found something interesting about reading a wav file in it. So I’ll try to do something with it, like reverse the file, fasten it,… to get acquainted with the library. The PlaySound() is for later, hehe
A lot of troubles happen when start working with the Visual Studio. Its linker is kind of a mess
Lot of configurations to make it work with the library
Update:
I’ve just written few lines of code, well, it can run but there’s still one thing I still cannot get:
UCHAR * buffer = new UCHAR[child.cksize];
unsigned long n = sizeof(buffer);
mmioRead(handle, (char*)buffer, child.cksize);
n = sizeof(buffer);
The value of child.cksize is really big, greater than 20k, but when I allocate the buffer and check for the value of n, before and after the mmioRead funtion call, it is always 4 ![]()
The things I get confuse is that, after those code, I call a function to write down the buffer to another file, it works perfectly with the buffer I pass on
The write function:
bool song::write(unsigned long size, UCHAR* buffer) {
// Get a new file name
char outwav[MAX_PATH];
ZeroMemory(&outwav[0],sizeof(outwav));
strcpy(&outwav[0],”hieu.wav”);
outwav[strlen(&outwav[0])-3] = ‘p’;
outwav[strlen(&outwav[0])-2] = ‘c’;
outwav[strlen(&outwav[0])-1] = ‘m’;
// Write the data
LPWSTR temp = strToLPWSTR(&outwav[0]);
HANDLE hpcm = CreateFile((LPCWSTR)temp,GENERIC_WRITE,NULL,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
DWORD written;
WriteFile(hpcm,&buffer[0],size,&written,NULL);
CloseHandle(hpcm);return true;
}
Gotta figure out what the heck is this soon
You’re in your way to your dream
But can you be more specific on your post because I don’t understand what is the purpose of those code.
It is very little, so I didn’t post it here, just like you open a file using fstream library and copy the content to an array of characters
I’ll make a detail post when I finish something significant
Hiếu, I think you should modify your CSS file at line blockquote, insert “overflow:auto;” to adjust horizontal scroll-bar for the code.
Ooh, find all you guys here. Hello from Nadan
)