riscutiavlad
November 15th, 2006, 08:08 AM
I want to play multiple files using MCI with a custom IOProc.
All examples i saw are like the following:
LRESULT CALLBACK IOProc(LPMMIOINFO lpMMIOInfo, UINT uMessage, LPARAM lParam1, LPARAM lParam2)
{
static BOOL alreadyOpened = FALSE;
switch (uMessage) {
case MMIOM_OPEN:
if (alreadyOpened)
return 0;
alreadyOpened = TRUE;
lpMMIOInfo->lDiskOffset = 0;
return 0;
case MMIOM_CLOSE:
return 0;
case MMIOM_READ:
memcpy((void *)lParam1, lpData+lpMMIOInfo->lDiskOffset, lParam2);
lpMMIOInfo->lDiskOffset += lParam2;
return (lParam2);
case MMIOM_SEEK:
switch (lParam2) {
case SEEK_SET:
lpMMIOInfo->lDiskOffset = lParam1;
break;
case SEEK_CUR:
lpMMIOInfo->lDiskOffset += lParam1;
case SEEK_END:
lpMMIOInfo->lDiskOffset = fileSize - 1 - lParam1;
break;
}
return lpMMIOInfo->lDiskOffset;
default:
return -1;
}
}
Now the problem is the above method uses an external lpData (MMIOM_READ case) which is the buffer in which a file is loaded. If I want to play multiple files, say I have an array of buffers, how can I determine in the IOProc which file is being played?
I see that in the MMIOM_READ case lParam1 is the destination buffer to be played by the system and lParam2 is the length to be copied into lParam1.
Thank you.
All examples i saw are like the following:
LRESULT CALLBACK IOProc(LPMMIOINFO lpMMIOInfo, UINT uMessage, LPARAM lParam1, LPARAM lParam2)
{
static BOOL alreadyOpened = FALSE;
switch (uMessage) {
case MMIOM_OPEN:
if (alreadyOpened)
return 0;
alreadyOpened = TRUE;
lpMMIOInfo->lDiskOffset = 0;
return 0;
case MMIOM_CLOSE:
return 0;
case MMIOM_READ:
memcpy((void *)lParam1, lpData+lpMMIOInfo->lDiskOffset, lParam2);
lpMMIOInfo->lDiskOffset += lParam2;
return (lParam2);
case MMIOM_SEEK:
switch (lParam2) {
case SEEK_SET:
lpMMIOInfo->lDiskOffset = lParam1;
break;
case SEEK_CUR:
lpMMIOInfo->lDiskOffset += lParam1;
case SEEK_END:
lpMMIOInfo->lDiskOffset = fileSize - 1 - lParam1;
break;
}
return lpMMIOInfo->lDiskOffset;
default:
return -1;
}
}
Now the problem is the above method uses an external lpData (MMIOM_READ case) which is the buffer in which a file is loaded. If I want to play multiple files, say I have an array of buffers, how can I determine in the IOProc which file is being played?
I see that in the MMIOM_READ case lParam1 is the destination buffer to be played by the system and lParam2 is the length to be copied into lParam1.
Thank you.