diff --git a/reactos/dll/win32/msacm32/driver.c b/reactos/dll/win32/msacm32/driver.c index dab014f4db3..e481d688e2f 100644 --- a/reactos/dll/win32/msacm32/driver.c +++ b/reactos/dll/win32/msacm32/driver.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include "config.h" @@ -29,17 +29,16 @@ #include "windef.h" #include "winbase.h" -#include "winerror.h" #include "wingdi.h" #include "winuser.h" #include "winnls.h" -#include "winreg.h" #include "mmsystem.h" #include "mmreg.h" #include "msacm.h" #include "msacmdrv.h" #include "wineacm.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msacm); @@ -49,7 +48,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(msacm); MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule, LPARAM lParam, DWORD dwPriority, DWORD fdwAdd) { - TRACE("(%p, %p, %08lx, %08lx, %08lx)\n", + MMRESULT resultW; + WCHAR * driverW = NULL; + LPARAM lParamW = lParam; + + TRACE("(%p, %p, %08lx, %08x, %08x)\n", phadid, hinstModule, lParam, dwPriority, fdwAdd); if (!phadid) { @@ -72,30 +75,105 @@ MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule, return MMSYSERR_INVALFLAG; } - /* FIXME: in fact, should GetModuleFileName(hinstModule) and do a - * LoadDriver on it, to be sure we can call SendDriverMessage on the - * hDrvr handle. - */ - *phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, hinstModule); + /* A->W translation of name */ + if ((fdwAdd & ACM_DRIVERADDF_TYPEMASK) == ACM_DRIVERADDF_NAME) { + unsigned long len; + + if (lParam == 0) return MMSYSERR_INVALPARAM; + len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)lParam, -1, NULL, 0); + driverW = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR)); + if (!driverW) return MMSYSERR_NOMEM; + MultiByteToWideChar(CP_ACP, 0, (LPSTR)lParam, -1, driverW, len); + lParamW = (LPARAM)driverW; + } - /* FIXME: lParam, dwPriority and fdwAdd ignored */ - - return MMSYSERR_NOERROR; + resultW = acmDriverAddW(phadid, hinstModule, lParamW, dwPriority, fdwAdd); + HeapFree(MSACM_hHeap, 0, driverW); + return resultW; } /*********************************************************************** * acmDriverAddW (MSACM32.@) - * FIXME - * Not implemented + * */ MMRESULT WINAPI acmDriverAddW(PHACMDRIVERID phadid, HINSTANCE hinstModule, LPARAM lParam, DWORD dwPriority, DWORD fdwAdd) { - FIXME("(%p, %p, %ld, %ld, %ld): stub\n", - phadid, hinstModule, lParam, dwPriority, fdwAdd); + PWINE_ACMLOCALDRIVER pLocalDrv = NULL; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return MMSYSERR_ERROR; + TRACE("(%p, %p, %08lx, %08x, %08x)\n", + phadid, hinstModule, lParam, dwPriority, fdwAdd); + + if (!phadid) { + WARN("invalid parameter\n"); + return MMSYSERR_INVALPARAM; + } + + /* Check if any unknown flags */ + if (fdwAdd & + ~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND| + ACM_DRIVERADDF_GLOBAL)) { + WARN("invalid flag\n"); + return MMSYSERR_INVALFLAG; + } + + /* Check if any incompatible flags */ + if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) && + (fdwAdd & ACM_DRIVERADDF_NOTIFYHWND)) { + WARN("invalid flag\n"); + return MMSYSERR_INVALFLAG; + } + + switch (fdwAdd & ACM_DRIVERADDF_TYPEMASK) { + case ACM_DRIVERADDF_NAME: + /* + hInstModule (unused) + lParam name of value in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32 + dwPriority (unused, set to 0) + */ + *phadid = (HACMDRIVERID) MSACM_RegisterDriverFromRegistry((LPCWSTR)lParam); + if (!*phadid) { + ERR("Unable to register driver via ACM_DRIVERADDF_NAME\n"); + return MMSYSERR_INVALPARAM; + } + break; + case ACM_DRIVERADDF_FUNCTION: + /* + hInstModule Handle of module which contains driver entry proc + lParam Driver function address + dwPriority (unused, set to 0) + */ + fdwAdd &= ~ACM_DRIVERADDF_TYPEMASK; + /* FIXME: fdwAdd ignored */ + /* Application-supplied acmDriverProc's are placed at the top of the priority unless + fdwAdd indicates ACM_DRIVERADDF_GLOBAL + */ + pLocalDrv = MSACM_RegisterLocalDriver(hinstModule, (DRIVERPROC)lParam); + *phadid = pLocalDrv ? (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, pLocalDrv) : NULL; + if (!*phadid) { + ERR("Unable to register driver via ACM_DRIVERADDF_FUNCTION\n"); + return MMSYSERR_INVALPARAM; + } + break; + case ACM_DRIVERADDF_NOTIFYHWND: + /* + hInstModule (unused) + lParam Handle of notification window + dwPriority Window message to send for notification broadcasts + */ + *phadid = (HACMDRIVERID) MSACM_RegisterNotificationWindow((HWND)lParam, dwPriority); + if (!*phadid) { + ERR("Unable to register driver via ACM_DRIVERADDF_NOTIFYHWND\n"); + return MMSYSERR_INVALPARAM; + } + break; + default: + ERR("invalid flag value 0x%08lx for fdwAdd\n", fdwAdd & ACM_DRIVERADDF_TYPEMASK); + return MMSYSERR_INVALFLAG; + } + + MSACM_BroadcastNotification(); + return MMSYSERR_NOERROR; } /*********************************************************************** @@ -107,7 +185,7 @@ MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose) PWINE_ACMDRIVERID padid; PWINE_ACMDRIVER* tpad; - TRACE("(%p, %08lx)\n", had, fdwClose); + TRACE("(%p, %08x)\n", had, fdwClose); if (fdwClose) { WARN("invalid flag\n"); @@ -123,7 +201,7 @@ MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose) padid = pad->obj.pACMDriverID; /* remove driver from list */ - for (tpad = &(padid->pACMDriverList); *tpad; *tpad = (*tpad)->pNextACMDriver) { + for (tpad = &(padid->pACMDriverList); *tpad; tpad = &((*tpad)->pNextACMDriver)) { if (*tpad == pad) { *tpad = (*tpad)->pNextACMDriver; break; @@ -131,8 +209,10 @@ MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose) } /* close driver if it has been opened */ - if (pad->hDrvr && !padid->hInstModule) + if (pad->hDrvr && !pad->pLocalDrvrInst) CloseDriver(pad->hDrvr, 0, 0); + else if (pad->pLocalDrvrInst) + MSACM_CloseLocalDriver(pad->pLocalDrvrInst); HeapFree(MSACM_hHeap, 0, pad); @@ -147,7 +227,7 @@ MMRESULT WINAPI acmDriverDetailsA(HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, D MMRESULT mmr; ACMDRIVERDETAILSW addw; - TRACE("(%p, %p, %08lx)\n", hadid, padd, fdwDetails); + TRACE("(%p, %p, %08x)\n", hadid, padd, fdwDetails); if (!padd) { WARN("invalid parameter\n"); @@ -184,7 +264,8 @@ MMRESULT WINAPI acmDriverDetailsA(HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, D sizeof(padda.szLicensing), NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, addw.szFeatures, -1, padda.szFeatures, sizeof(padda.szFeatures), NULL, NULL ); - memcpy(padd, &padda, min(padd->cbStruct, sizeof(*padd))); + padda.cbStruct = min(padd->cbStruct, sizeof(*padd)); + memcpy(padd, &padda, padda.cbStruct); } return mmr; } @@ -197,7 +278,7 @@ MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, D HACMDRIVER acmDrvr; MMRESULT mmr; - TRACE("(%p, %p, %08lx)\n", hadid, padd, fdwDetails); + TRACE("(%p, %p, %08x)\n", hadid, padd, fdwDetails); if (!padd) { WARN("invalid parameter\n"); @@ -217,10 +298,12 @@ MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, D mmr = acmDriverOpen(&acmDrvr, hadid, 0); if (mmr == MMSYSERR_NOERROR) { ACMDRIVERDETAILSW paddw; - mmr = (MMRESULT)MSACM_Message(acmDrvr, ACMDM_DRIVER_DETAILS, (LPARAM)&paddw, 0); + paddw.cbStruct = sizeof(paddw); + mmr = MSACM_Message(acmDrvr, ACMDM_DRIVER_DETAILS, (LPARAM)&paddw, 0); acmDriverClose(acmDrvr, 0); - memcpy(padd, &paddw, min(padd->cbStruct, sizeof(*padd))); + paddw.cbStruct = min(padd->cbStruct, sizeof(*padd)); + memcpy(padd, &paddw, paddw.cbStruct); } return mmr; @@ -229,12 +312,13 @@ MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, D /*********************************************************************** * acmDriverEnum (MSACM32.@) */ -MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum) +MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD_PTR dwInstance, + DWORD fdwEnum) { PWINE_ACMDRIVERID padid; DWORD fdwSupport; - TRACE("(%p, %08lx, %08lx)\n", fnCallback, dwInstance, fdwEnum); + TRACE("(%p, %08lx, %08x)\n", fnCallback, dwInstance, fdwEnum); if (!fnCallback) { WARN("invalid parameter\n"); @@ -269,7 +353,7 @@ MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID { PWINE_ACMOBJ pao; - TRACE("(%p, %p, %08lx)\n", hao, phadid, fdwDriverID); + TRACE("(%p, %p, %08x)\n", hao, phadid, fdwDriverID); if (fdwDriverID) { WARN("invalid flag\n"); @@ -295,6 +379,15 @@ MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID /*********************************************************************** * acmDriverMessage (MSACM32.@) * + * Note: MSDN documentation (July 2001) is incomplete. This function + * accepts sending messages to an HACMDRIVERID in addition to the + * documented HACMDRIVER. In fact, for DRV_QUERYCONFIGURE and DRV_CONFIGURE, + * this might actually be the required mode of operation. + * + * Note: For DRV_CONFIGURE, msacm supplies its own DRVCONFIGINFO structure + * when the application fails to supply one. Some native drivers depend on + * this and refuse to display unless a valid DRVCONFIGINFO structure is + * built and supplied. */ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2) { @@ -304,8 +397,90 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA uMsg == ACMDM_DRIVER_ABOUT || uMsg == DRV_QUERYCONFIGURE || uMsg == DRV_CONFIGURE) - return MSACM_Message(had, uMsg, lParam1, lParam2); + { + PWINE_ACMDRIVERID padid; + LRESULT lResult; + LPDRVCONFIGINFO pConfigInfo = NULL; + LPWSTR section_name = NULL; + LPWSTR alias_name = NULL; + /* Check whether handle is an HACMDRIVERID */ + padid = MSACM_GetDriverID((HACMDRIVERID)had); + + /* If the message is DRV_CONFIGURE, and the application provides no + DRVCONFIGINFO structure, msacm must supply its own. + */ + if (uMsg == DRV_CONFIGURE && lParam2 == 0) { + LPWSTR pAlias; + + /* Get the alias from the HACMDRIVERID */ + if (padid) { + pAlias = padid->pszDriverAlias; + if (pAlias == NULL) { + WARN("DRV_CONFIGURE: no alias for this driver, cannot self-supply alias\n"); + } + } else { + FIXME("DRV_CONFIGURE: reverse lookup HACMDRIVER -> HACMDRIVERID not implemented\n"); + pAlias = NULL; + } + + if (pAlias != NULL) { + /* DRVCONFIGINFO is only 12 bytes long, but native msacm + * reports a 16-byte structure to codecs, so allocate 16 bytes, + * just to be on the safe side. + */ + const unsigned int iStructSize = 16; + pConfigInfo = HeapAlloc(MSACM_hHeap, 0, iStructSize); + if (!pConfigInfo) { + ERR("OOM while supplying DRVCONFIGINFO for DRV_CONFIGURE, using NULL\n"); + } else { + static const WCHAR drivers32[] = {'D','r','i','v','e','r','s','3','2','\0'}; + + pConfigInfo->dwDCISize = iStructSize; + + section_name = HeapAlloc(MSACM_hHeap, 0, (strlenW(drivers32) + 1) * sizeof(WCHAR)); + if (section_name) strcpyW(section_name, drivers32); + pConfigInfo->lpszDCISectionName = section_name; + alias_name = HeapAlloc(MSACM_hHeap, 0, (strlenW(pAlias) + 1) * sizeof(WCHAR)); + if (alias_name) strcpyW(alias_name, pAlias); + pConfigInfo->lpszDCIAliasName = alias_name; + + if (pConfigInfo->lpszDCISectionName == NULL || pConfigInfo->lpszDCIAliasName == NULL) { + HeapFree(MSACM_hHeap, 0, alias_name); + HeapFree(MSACM_hHeap, 0, section_name); + HeapFree(MSACM_hHeap, 0, pConfigInfo); + pConfigInfo = NULL; + ERR("OOM while supplying DRVCONFIGINFO for DRV_CONFIGURE, using NULL\n"); + } + } + } + + lParam2 = (LPARAM)pConfigInfo; + } + + if (padid) { + /* Handle is really an HACMDRIVERID, must have an open session to get an HACMDRIVER */ + if (padid->pACMDriverList != NULL) { + lResult = MSACM_Message((HACMDRIVER)padid->pACMDriverList, uMsg, lParam1, lParam2); + } else { + MMRESULT mmr = acmDriverOpen(&had, (HACMDRIVERID)padid, 0); + if (mmr != MMSYSERR_NOERROR) { + lResult = MMSYSERR_INVALPARAM; + } else { + lResult = acmDriverMessage(had, uMsg, lParam1, lParam2); + acmDriverClose(had, 0); + } + } + } else { + lResult = MSACM_Message(had, uMsg, lParam1, lParam2); + } + if (pConfigInfo) { + HeapFree(MSACM_hHeap, 0, alias_name); + HeapFree(MSACM_hHeap, 0, section_name); + HeapFree(MSACM_hHeap, 0, pConfigInfo); + } + return lResult; + } WARN("invalid parameter\n"); return MMSYSERR_INVALPARAM; } @@ -319,7 +494,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe PWINE_ACMDRIVER pad = NULL; MMRESULT ret; - TRACE("(%p, %p, %08lu)\n", phad, hadid, fdwOpen); + TRACE("(%p, %p, %08u)\n", phad, hadid, fdwOpen); if (!phad) { WARN("invalid parameter\n"); @@ -345,11 +520,14 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe pad->obj.dwType = WINE_ACMOBJ_DRIVER; pad->obj.pACMDriverID = padid; + pad->hDrvr = 0; + pad->pLocalDrvrInst = NULL; - if (!(pad->hDrvr = (HDRVR)padid->hInstModule)) + if (padid->pLocalDriver == NULL) { ACMDRVOPENDESCW adod; int len; + LPWSTR section_name; /* this is not an externally added driver... need to actually load it */ if (!padid->pszDriverAlias) @@ -365,20 +543,44 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe adod.dwFlags = fdwOpen; adod.dwError = 0; len = strlen("Drivers32") + 1; - adod.pszSectionName = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, "Drivers32", -1, (LPWSTR)adod.pszSectionName, len); + section_name = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, "Drivers32", -1, section_name, len); + adod.pszSectionName = section_name; adod.pszAliasName = padid->pszDriverAlias; adod.dnDevNode = 0; - pad->hDrvr = OpenDriver(padid->pszDriverAlias, NULL, (DWORD)&adod); + pad->hDrvr = OpenDriver(padid->pszDriverAlias, NULL, (DWORD_PTR)&adod); - HeapFree(MSACM_hHeap, 0, (LPWSTR)adod.pszSectionName); + HeapFree(MSACM_hHeap, 0, section_name); if (!pad->hDrvr) { ret = adod.dwError; goto gotError; } } + else + { + ACMDRVOPENDESCW adod; + + pad->hDrvr = NULL; + + adod.cbStruct = sizeof(adod); + adod.fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC; + adod.fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED; + adod.dwVersion = acmGetVersion(); + adod.dwFlags = fdwOpen; + adod.dwError = 0; + adod.pszSectionName = NULL; + adod.pszAliasName = NULL; + adod.dnDevNode = 0; + + pad->pLocalDrvrInst = MSACM_OpenLocalDriver(padid->pLocalDriver, (DWORD_PTR)&adod); + if (!pad->pLocalDrvrInst) + { + ret = adod.dwError; + goto gotError; + } + } /* insert new pad at beg of list */ pad->pNextACMDriver = padid->pACMDriverList; @@ -386,7 +588,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe /* FIXME: Create a WINE_ACMDRIVER32 */ *phad = (HACMDRIVER)pad; - TRACE("'%s' => %08lx\n", debugstr_w(padid->pszDriverAlias), (DWORD)pad); + TRACE("%s => %p\n", debugstr_w(padid->pszDriverAlias), pad); return MMSYSERR_NOERROR; gotError: @@ -401,21 +603,8 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe */ MMRESULT WINAPI acmDriverPriority(HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority) { - PWINE_ACMDRIVERID padid; - CHAR szSubKey[17]; - CHAR szBuffer[256]; - LONG lBufferLength = sizeof(szBuffer); - LONG lError; - HKEY hPriorityKey; - DWORD dwPriorityCounter; - TRACE("(%p, %08lx, %08lx)\n", hadid, dwPriority, fdwPriority); - - padid = MSACM_GetDriverID(hadid); - if (!padid) { - WARN("invalid handle\n"); - return MMSYSERR_INVALHANDLE; - } + TRACE("(%p, %08x, %08x)\n", hadid, dwPriority, fdwPriority); /* Check for unknown flags */ if (fdwPriority & @@ -438,33 +627,114 @@ MMRESULT WINAPI acmDriverPriority(HACMDRIVERID hadid, DWORD dwPriority, DWORD fd WARN("invalid flag\n"); return MMSYSERR_INVALFLAG; } + + /* According to MSDN, ACM_DRIVERPRIORITYF_BEGIN and ACM_DRIVERPRIORITYF_END + may only appear by themselves, and in addition, hadid and dwPriority must + both be zero */ + if ((fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) || + (fdwPriority & ACM_DRIVERPRIORITYF_END)) { + if (fdwPriority & ~(ACM_DRIVERPRIORITYF_BEGIN|ACM_DRIVERPRIORITYF_END)) { + WARN("ACM_DRIVERPRIORITYF_[BEGIN|END] cannot be used with any other flags\n"); + return MMSYSERR_INVALPARAM; + } + if (dwPriority) { + WARN("priority invalid with ACM_DRIVERPRIORITYF_[BEGIN|END]\n"); + return MMSYSERR_INVALPARAM; + } + if (hadid) { + WARN("non-null hadid invalid with ACM_DRIVERPRIORITYF_[BEGIN|END]\n"); + return MMSYSERR_INVALPARAM; + } + /* FIXME: MSDN wording suggests that deferred notification should be + implemented as a system-wide lock held by a calling task, and that + re-enabling notifications should broadcast them across all processes. + This implementation uses a simple DWORD counter. One consequence of the + current implementation is that applications will never see + MMSYSERR_ALLOCATED as a return error. + */ + if (fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) { + MSACM_DisableNotifications(); + } else if (fdwPriority & ACM_DRIVERPRIORITYF_END) { + MSACM_EnableNotifications(); + } + return MMSYSERR_NOERROR; + } else { + PWINE_ACMDRIVERID padid; + PWINE_ACMNOTIFYWND panwnd; + BOOL bPerformBroadcast = FALSE; - lError = RegOpenKeyA(HKEY_CURRENT_USER, - "Software\\Microsoft\\Multimedia\\" - "Audio Compression Manager\\Priority v4.00", - &hPriorityKey - ); - /* FIXME: Create key */ - if (lError != ERROR_SUCCESS) { - WARN("RegOpenKeyA failed\n"); - return MMSYSERR_ERROR; + /* Fetch driver ID */ + padid = MSACM_GetDriverID(hadid); + panwnd = MSACM_GetNotifyWnd(hadid); + if (!padid && !panwnd) { + WARN("invalid handle\n"); + return MMSYSERR_INVALHANDLE; + } + + if (padid) { + /* Check whether driver ID is appropriate for requested op */ + if (dwPriority) { + if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL) { + return MMSYSERR_NOTSUPPORTED; + } + if (dwPriority != 1 && dwPriority != (DWORD)-1) { + FIXME("unexpected priority %d, using sign only\n", dwPriority); + if ((signed)dwPriority < 0) dwPriority = (DWORD)-1; + if (dwPriority > 0) dwPriority = 1; + } + + if (dwPriority == 1 && (padid->pPrevACMDriverID == NULL || + (padid->pPrevACMDriverID->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))) { + /* do nothing - driver is first of list, or first after last + local driver */ + } else if (dwPriority == (DWORD)-1 && padid->pNextACMDriverID == NULL) { + /* do nothing - driver is last of list */ + } else { + MSACM_RePositionDriver(padid, dwPriority); + bPerformBroadcast = TRUE; + } + } + + /* Check whether driver ID should be enabled or disabled */ + if (fdwPriority & ACM_DRIVERPRIORITYF_DISABLE) { + if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) { + padid->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED; + bPerformBroadcast = TRUE; + } + } else if (fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) { + if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) { + padid->fdwSupport &= ~ACMDRIVERDETAILS_SUPPORTF_DISABLED; + bPerformBroadcast = TRUE; + } + } + } + + if (panwnd) { + if (dwPriority) { + return MMSYSERR_NOTSUPPORTED; + } + + /* Check whether notify window should be enabled or disabled */ + if (fdwPriority & ACM_DRIVERPRIORITYF_DISABLE) { + if (!(panwnd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) { + panwnd->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED; + bPerformBroadcast = TRUE; + } + } else if (fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) { + if (panwnd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) { + panwnd->fdwSupport &= ~ACMDRIVERDETAILS_SUPPORTF_DISABLED; + bPerformBroadcast = TRUE; + } + } + } + + /* Perform broadcast of changes */ + if (bPerformBroadcast) { + MSACM_WriteCurrentPriorities(); + MSACM_BroadcastNotification(); + } + return MMSYSERR_NOERROR; } - - for (dwPriorityCounter = 1; ; dwPriorityCounter++) { - snprintf(szSubKey, 17, "Priority%ld", dwPriorityCounter); - lError = RegQueryValueA(hPriorityKey, szSubKey, szBuffer, &lBufferLength); - if (lError != ERROR_SUCCESS) - break; - - FIXME("(%p, %ld, %ld): stub (partial)\n", - hadid, dwPriority, fdwPriority); - break; - } - - RegCloseKey(hPriorityKey); - - WARN("RegQueryValueA failed\n"); - return MMSYSERR_ERROR; } /*********************************************************************** @@ -473,11 +743,13 @@ MMRESULT WINAPI acmDriverPriority(HACMDRIVERID hadid, DWORD dwPriority, DWORD fd MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove) { PWINE_ACMDRIVERID padid; + PWINE_ACMNOTIFYWND panwnd; - TRACE("(%p, %08lx)\n", hadid, fdwRemove); + TRACE("(%p, %08x)\n", hadid, fdwRemove); padid = MSACM_GetDriverID(hadid); - if (!padid) { + panwnd = MSACM_GetNotifyWnd(hadid); + if (!padid && !panwnd) { WARN("invalid handle\n"); return MMSYSERR_INVALHANDLE; } @@ -487,7 +759,9 @@ MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove) return MMSYSERR_INVALFLAG; } - MSACM_UnregisterDriver(padid); + if (padid) MSACM_UnregisterDriver(padid); + if (panwnd) MSACM_UnRegisterNotificationWindow(panwnd); + MSACM_BroadcastNotification(); return MMSYSERR_NOERROR; } diff --git a/reactos/dll/win32/msacm32/filter.c b/reactos/dll/win32/msacm32/filter.c index 3bce5c23d3c..9d7077392c8 100644 --- a/reactos/dll/win32/msacm32/filter.c +++ b/reactos/dll/win32/msacm32/filter.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include @@ -27,6 +27,7 @@ #include "winnls.h" #include "winerror.h" #include "mmsystem.h" +#define NOBITMAP #include "mmreg.h" #include "msacm.h" #include "msacmdrv.h" @@ -90,7 +91,7 @@ MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd, MMRESULT mmr; ACMFILTERTAGDETAILSA aftd; - TRACE("(%p, %p, %ld)\n", had, pafd, fdwDetails); + TRACE("(%p, %p, %d)\n", had, pafd, fdwDetails); memset(&aftd, 0, sizeof(aftd)); aftd.cbStruct = sizeof(aftd); @@ -126,7 +127,7 @@ MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd, mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS, (LPARAM)pafd, fdwDetails); break; default: - WARN("Unknown fdwDetails %08lx\n", fdwDetails); + WARN("Unknown fdwDetails %08x\n", fdwDetails); mmr = MMSYSERR_INVALFLAG; break; } @@ -136,14 +137,14 @@ MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd, } struct MSACM_FilterEnumWtoA_Instance { - PACMFILTERDETAILSA pafda; - DWORD dwInstance; - ACMFILTERENUMCBA fnCallback; + PACMFILTERDETAILSA pafda; + DWORD_PTR dwInstance; + ACMFILTERENUMCBA fnCallback; }; static BOOL CALLBACK MSACM_FilterEnumCallbackWtoA(HACMDRIVERID hadid, PACMFILTERDETAILSW pafdw, - DWORD dwInstance, + DWORD_PTR dwInstance, DWORD fdwSupport) { struct MSACM_FilterEnumWtoA_Instance* pafei; @@ -164,8 +165,8 @@ static BOOL CALLBACK MSACM_FilterEnumCallbackWtoA(HACMDRIVERID hadid, * acmFilterEnumA (MSACM32.@) */ MMRESULT WINAPI acmFilterEnumA(HACMDRIVER had, PACMFILTERDETAILSA pafda, - ACMFILTERENUMCBA fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFILTERENUMCBA fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { ACMFILTERDETAILSW afdw; struct MSACM_FilterEnumWtoA_Instance afei; @@ -182,16 +183,16 @@ MMRESULT WINAPI acmFilterEnumA(HACMDRIVER had, PACMFILTERDETAILSA pafda, afei.fnCallback = fnCallback; return acmFilterEnumW(had, &afdw, MSACM_FilterEnumCallbackWtoA, - (DWORD)&afei, fdwEnum); + (DWORD_PTR)&afei, fdwEnum); } static BOOL MSACM_FilterEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, PACMFILTERDETAILSW pafd, - ACMFILTERENUMCBW fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFILTERENUMCBW fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { ACMFILTERTAGDETAILSW aftd; - int i, j; + unsigned int i, j; for (i = 0; i < padid->cFilterTags; i++) { memset(&aftd, 0, sizeof(aftd)); @@ -221,13 +222,13 @@ static BOOL MSACM_FilterEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, * acmFilterEnumW (MSACM32.@) */ MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd, - ACMFILTERENUMCBW fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFILTERENUMCBW fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { PWINE_ACMDRIVERID padid; BOOL ret; - TRACE("(%p, %p, %p, %ld, %ld)\n", + TRACE("(%p, %p, %p, %ld, %d)\n", had, pafd, fnCallback, dwInstance, fdwEnum); if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM; @@ -293,7 +294,7 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd PWINE_ACMDRIVERID padid; MMRESULT mmr; - TRACE("(%p, %p, %ld)\n", had, paftd, fdwDetails); + TRACE("(%p, %p, %d)\n", had, paftd, fdwDetails); if (fdwDetails & ~(ACM_FILTERTAGDETAILSF_FILTERTAG|ACM_FILTERTAGDETAILSF_INDEX| ACM_FILTERTAGDETAILSF_LARGESTSIZE)) @@ -354,7 +355,7 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd break; default: - WARN("Unsupported fdwDetails=%08lx\n", fdwDetails); + WARN("Unsupported fdwDetails=%08x\n", fdwDetails); mmr = MMSYSERR_ERROR; } @@ -367,14 +368,14 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd } struct MSACM_FilterTagEnumWtoA_Instance { - PACMFILTERTAGDETAILSA paftda; - DWORD dwInstance; - ACMFILTERTAGENUMCBA fnCallback; + PACMFILTERTAGDETAILSA paftda; + DWORD_PTR dwInstance; + ACMFILTERTAGENUMCBA fnCallback; }; static BOOL CALLBACK MSACM_FilterTagEnumCallbackWtoA(HACMDRIVERID hadid, PACMFILTERTAGDETAILSW paftdw, - DWORD dwInstance, + DWORD_PTR dwInstance, DWORD fdwSupport) { struct MSACM_FilterTagEnumWtoA_Instance* paftei; @@ -397,8 +398,8 @@ static BOOL CALLBACK MSACM_FilterTagEnumCallbackWtoA(HACMDRIVERID hadid, * acmFilterTagEnumA (MSACM32.@) */ MMRESULT WINAPI acmFilterTagEnumA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda, - ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFILTERTAGENUMCBA fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { ACMFILTERTAGDETAILSW aftdw; struct MSACM_FilterTagEnumWtoA_Instance aftei; @@ -413,20 +414,20 @@ MMRESULT WINAPI acmFilterTagEnumA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda, aftei.fnCallback = fnCallback; return acmFilterTagEnumW(had, &aftdw, MSACM_FilterTagEnumCallbackWtoA, - (DWORD)&aftei, fdwEnum); + (DWORD_PTR)&aftei, fdwEnum); } /*********************************************************************** * acmFilterTagEnumW (MSACM32.@) */ MMRESULT WINAPI acmFilterTagEnumW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, - ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFILTERTAGENUMCBW fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { PWINE_ACMDRIVERID padid; - int i; + unsigned int i; - TRACE("(%p, %p, %p, %ld, %ld)\n", + TRACE("(%p, %p, %p, %ld, %d)\n", had, paftd, fnCallback, dwInstance, fdwEnum); if (paftd->cbStruct < sizeof(*paftd)) return MMSYSERR_INVALPARAM; diff --git a/reactos/dll/win32/msacm32/format.c b/reactos/dll/win32/msacm32/format.c index e44b5b780b1..1b20ce025ac 100644 --- a/reactos/dll/win32/msacm32/format.c +++ b/reactos/dll/win32/msacm32/format.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include @@ -54,17 +54,18 @@ struct MSACM_FillFormatData { static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid, PACMFORMATTAGDETAILSA paftd, - DWORD dwInstance, DWORD fdwSupport) + DWORD_PTR dwInstance, + DWORD fdwSupport) { struct MSACM_FillFormatData* affd = (struct MSACM_FillFormatData*)dwInstance; switch (affd->mode) { case WINE_ACMFF_TAG: if (SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, - CB_FINDSTRINGEXACT, - (WPARAM)-1, (LPARAM)paftd->szFormatTag) == CB_ERR) + CB_FINDSTRINGEXACT, -1, + (LPARAM)paftd->szFormatTag) == CB_ERR) SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, - CB_ADDSTRING, 0, (DWORD)paftd->szFormatTag); + CB_ADDSTRING, 0, (LPARAM)paftd->szFormatTag); break; case WINE_ACMFF_FORMAT: if (strcmp(affd->szFormatTag, paftd->szFormatTag) == 0) { @@ -72,7 +73,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid, if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { ACMFORMATDETAILSA afd; - int i, idx; + unsigned int i, len; MMRESULT mmr; char buffer[ACMFORMATDETAILS_FORMAT_CHARS+16]; @@ -88,16 +89,15 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid, afd.dwFormatIndex = i; mmr = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX); if (mmr == MMSYSERR_NOERROR) { - strncpy(buffer, afd.szFormat, ACMFORMATTAGDETAILS_FORMATTAG_CHARS); - for (idx = strlen(buffer); - idx < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; idx++) - buffer[idx] = ' '; + lstrcpynA(buffer, afd.szFormat, ACMFORMATTAGDETAILS_FORMATTAG_CHARS + 1); + len = strlen(buffer); + memset(buffer+len, ' ', ACMFORMATTAGDETAILS_FORMATTAG_CHARS - len); wsprintfA(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS, "%d Ko/s", (afd.pwfx->nAvgBytesPerSec + 512) / 1024); SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, - CB_ADDSTRING, 0, (DWORD)buffer); + CB_ADDSTRING, 0, (LPARAM)buffer); } } acmDriverClose(had, 0); @@ -145,7 +145,7 @@ static BOOL MSACM_FillFormatTags(HWND hWnd) affd.hWnd = hWnd; affd.mode = WINE_ACMFF_TAG; - acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0); + acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD_PTR)&affd, 0); SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_SETCURSEL, 0, 0); return TRUE; } @@ -166,9 +166,9 @@ static BOOL MSACM_FillFormat(HWND hWnd) CB_GETLBTEXT, SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_GETCURSEL, 0, 0), - (DWORD)affd.szFormatTag); + (LPARAM)affd.szFormatTag); - acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0); + acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD_PTR)&affd, 0); SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_SETCURSEL, 0, 0); return TRUE; } @@ -189,9 +189,9 @@ static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEA afc) CB_GETLBTEXT, SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_GETCURSEL, 0, 0), - (DWORD)affd.szFormatTag); + (LPARAM)affd.szFormatTag); - acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0); + acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD_PTR)&affd, 0); return affd.ret; } @@ -199,7 +199,7 @@ static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - TRACE("hwnd=%p msg=%i 0x%08x 0x%08lx\n", hWnd, msg, wParam, lParam ); + TRACE("hwnd=%p msg=%i 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam ); switch (msg) { case WM_INITDIALOG: @@ -208,7 +208,7 @@ static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg, MSACM_FillFormat(hWnd); if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP| ACMFORMATCHOOSE_STYLEF_SHOWHELP)) != 0) - FIXME("Unsupported style %08lx\n", ((PACMFORMATCHOOSEA)lParam)->fdwStyle); + FIXME("Unsupported style %08x\n", ((PACMFORMATCHOOSEA)lParam)->fdwStyle); if (!(afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP)) ShowWindow(GetDlgItem(hWnd, IDD_ACMFORMATCHOOSE_BTN_HELP), SW_HIDE); return TRUE; @@ -259,7 +259,7 @@ static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg, break; #endif default: - TRACE("Dropped dlgMsg: hwnd=%p msg=%i 0x%08x 0x%08lx\n", + TRACE("Dropped dlgMsg: hwnd=%p msg=%i 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam ); break; } @@ -272,7 +272,7 @@ static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg, MMRESULT WINAPI acmFormatChooseA(PACMFORMATCHOOSEA pafmtc) { return DialogBoxParamA(MSACM_hInstance32, MAKEINTRESOURCEA(DLG_ACMFORMATCHOOSE_ID), - pafmtc->hwndOwner, FormatChooseDlgProc, (INT)pafmtc); + pafmtc->hwndOwner, FormatChooseDlgProc, (LPARAM)pafmtc); } /*********************************************************************** @@ -321,7 +321,7 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD static const WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0}; ACMFORMATTAGDETAILSA aftd; - TRACE("(%p, %p, %ld)\n", had, pafd, fdwDetails); + TRACE("(%p, %p, %d)\n", had, pafd, fdwDetails); memset(&aftd, 0, sizeof(aftd)); aftd.cbStruct = sizeof(aftd); @@ -356,12 +356,12 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails); break; default: - WARN("Unknown fdwDetails %08lx\n", fdwDetails); + WARN("Unknown fdwDetails %08x\n", fdwDetails); mmr = MMSYSERR_INVALFLAG; break; } - if (mmr == MMSYSERR_NOERROR && pafd->szFormat[0] == (WCHAR)0) { + if (mmr == MMSYSERR_NOERROR && pafd->szFormat[0] == 0) { wsprintfW(pafd->szFormat, fmt1, pafd->pwfx->nSamplesPerSec); if (pafd->pwfx->wBitsPerSample) { wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2, @@ -377,14 +377,14 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD } struct MSACM_FormatEnumWtoA_Instance { - PACMFORMATDETAILSA pafda; - DWORD dwInstance; - ACMFORMATENUMCBA fnCallback; + PACMFORMATDETAILSA pafda; + DWORD_PTR dwInstance; + ACMFORMATENUMCBA fnCallback; }; static BOOL CALLBACK MSACM_FormatEnumCallbackWtoA(HACMDRIVERID hadid, PACMFORMATDETAILSW pafdw, - DWORD dwInstance, + DWORD_PTR dwInstance, DWORD fdwSupport) { struct MSACM_FormatEnumWtoA_Instance* pafei; @@ -405,8 +405,8 @@ static BOOL CALLBACK MSACM_FormatEnumCallbackWtoA(HACMDRIVERID hadid, * acmFormatEnumA (MSACM32.@) */ MMRESULT WINAPI acmFormatEnumA(HACMDRIVER had, PACMFORMATDETAILSA pafda, - ACMFORMATENUMCBA fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFORMATENUMCBA fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { ACMFORMATDETAILSW afdw; struct MSACM_FormatEnumWtoA_Instance afei; @@ -429,7 +429,7 @@ MMRESULT WINAPI acmFormatEnumA(HACMDRIVER had, PACMFORMATDETAILSA pafda, afei.fnCallback = fnCallback; return acmFormatEnumW(had, &afdw, MSACM_FormatEnumCallbackWtoA, - (DWORD)&afei, fdwEnum); + (DWORD_PTR)&afei, fdwEnum); } /*********************************************************************** @@ -437,47 +437,91 @@ MMRESULT WINAPI acmFormatEnumA(HACMDRIVER had, PACMFORMATDETAILSA pafda, */ static BOOL MSACM_FormatEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, PACMFORMATDETAILSW pafd, PWAVEFORMATEX pwfxRef, - ACMFORMATENUMCBW fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFORMATENUMCBW fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { ACMFORMATTAGDETAILSW aftd; - int i, j; + unsigned int i, j; - for (i = 0; i < padid->cFormatTags; i++) { - memset(&aftd, 0, sizeof(aftd)); - aftd.cbStruct = sizeof(aftd); - aftd.dwFormatTagIndex = i; - if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR) - continue; + if (fdwEnum & ACM_FORMATENUMF_SUGGEST) { + HDRVR hdrvr; + ACMDRVFORMATSUGGEST adfs; + pafd->dwFormatIndex = 0; + memset(&aftd, 0, sizeof(aftd)); + aftd.cbStruct = sizeof(aftd); + memset(&adfs, 0, sizeof(adfs)); + adfs.cbStruct = sizeof(adfs); - if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag) - continue; + for (i = 0; i < padid->cFormatTags; i++) { + aftd.dwFormatTag = i; + pafd->dwFormatTag = aftd.dwFormatTag; + pafd->pwfx->wFormatTag = pafd->dwFormatTag; - for (j = 0; j < aftd.cStandardFormats; j++) { - pafd->dwFormatIndex = j; - pafd->dwFormatTag = aftd.dwFormatTag; - if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR) - continue; + if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR) + continue; - if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) && - pafd->pwfx->nChannels != pwfxRef->nChannels) - continue; - if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) && - pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec) - continue; - if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) && - pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample) - continue; - if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) && - !(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE)) - continue; + adfs.cbwfxSrc = aftd.cbFormatSize; + adfs.cbwfxDst = aftd.cbFormatSize; + adfs.pwfxSrc = pwfxRef; + adfs.pwfxDst = pafd->pwfx; + pafd->fdwSupport = padid->fdwSupport; - /* more checks to be done on fdwEnum */ + if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && + aftd.dwFormatTag != pwfxRef->wFormatTag) + continue; - if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport)) - return FALSE; - } - /* the "formats" used by the filters are also reported */ + if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) && + !(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE)) + continue; + + hdrvr = OpenDriver(padid->pszFileName,0,0); + SendDriverMessage(hdrvr,ACMDM_FORMAT_SUGGEST,(DWORD)&adfs,(fdwEnum & 0x000000FFL)); + + if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_FORMAT) != MMSYSERR_NOERROR) + continue; + + pafd->cbwfx = sizeof(*(pafd->pwfx)); + + if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport)) + return FALSE; + } + } else { + for (i = 0; i < padid->cFormatTags; i++) { + memset(&aftd, 0, sizeof(aftd)); + aftd.cbStruct = sizeof(aftd); + aftd.dwFormatTagIndex = i; + if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR) + continue; + + if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag) + continue; + + for (j = 0; j < aftd.cStandardFormats; j++) { + pafd->dwFormatIndex = j; + pafd->dwFormatTag = aftd.dwFormatTag; + if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR) + continue; + + if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) && + pafd->pwfx->nChannels != pwfxRef->nChannels) + continue; + if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) && + pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec) + continue; + if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) && + pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample) + continue; + if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) && + !(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE)) + continue; + + /* more checks to be done on fdwEnum */ + + if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport)) + return FALSE; + } + /* the "formats" used by the filters are also reported */ + } } return TRUE; } @@ -485,14 +529,14 @@ static BOOL MSACM_FormatEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, /**********************************************************************/ MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd, - ACMFORMATENUMCBW fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFORMATENUMCBW fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { PWINE_ACMDRIVERID padid; WAVEFORMATEX wfxRef; BOOL ret; - TRACE("(%p, %p, %p, %ld, %ld)\n", + TRACE("(%p, %p, %p, %ld, %d)\n", had, pafd, fnCallback, dwInstance, fdwEnum); if (!pafd) @@ -514,9 +558,8 @@ MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd, (pafd->dwFormatTag != pafd->pwfx->wFormatTag)) return MMSYSERR_INVALPARAM; - if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST| - ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT)) - FIXME("Unsupported fdwEnum values %08lx\n", fdwEnum); + if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT)) + FIXME("Unsupported fdwEnum values %08x\n", fdwEnum); if (had) { HACMDRIVERID hadid; @@ -549,7 +592,7 @@ MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc, ACMDRVFORMATSUGGEST adfg; MMRESULT mmr; - TRACE("(%p, %p, %p, %ld, %ld)\n", + TRACE("(%p, %p, %p, %d, %d)\n", had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest); if (fdwSuggest & ~(ACM_FORMATSUGGESTF_NCHANNELS|ACM_FORMATSUGGESTF_NSAMPLESPERSEC| @@ -625,7 +668,7 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd PWINE_ACMDRIVERID padid; MMRESULT mmr = ACMERR_NOTPOSSIBLE; - TRACE("(%p, %p, %ld)\n", had, paftd, fdwDetails); + TRACE("(%p, %p, %d)\n", had, paftd, fdwDetails); if (fdwDetails & ~(ACM_FORMATTAGDETAILSF_FORMATTAG|ACM_FORMATTAGDETAILSF_INDEX| ACM_FORMATTAGDETAILSF_LARGESTSIZE)) @@ -692,7 +735,7 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd break; default: - WARN("Unsupported fdwDetails=%08lx\n", fdwDetails); + WARN("Unsupported fdwDetails=%08x\n", fdwDetails); mmr = MMSYSERR_ERROR; } @@ -705,14 +748,14 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd } struct MSACM_FormatTagEnumWtoA_Instance { - PACMFORMATTAGDETAILSA paftda; - DWORD dwInstance; - ACMFORMATTAGENUMCBA fnCallback; + PACMFORMATTAGDETAILSA paftda; + DWORD_PTR dwInstance; + ACMFORMATTAGENUMCBA fnCallback; }; static BOOL CALLBACK MSACM_FormatTagEnumCallbackWtoA(HACMDRIVERID hadid, PACMFORMATTAGDETAILSW paftdw, - DWORD dwInstance, + DWORD_PTR dwInstance, DWORD fdwSupport) { struct MSACM_FormatTagEnumWtoA_Instance* paftei; @@ -735,8 +778,8 @@ static BOOL CALLBACK MSACM_FormatTagEnumCallbackWtoA(HACMDRIVERID hadid, * acmFormatTagEnumA (MSACM32.@) */ MMRESULT WINAPI acmFormatTagEnumA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda, - ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFORMATTAGENUMCBA fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { ACMFORMATTAGDETAILSW aftdw; struct MSACM_FormatTagEnumWtoA_Instance aftei; @@ -760,21 +803,21 @@ MMRESULT WINAPI acmFormatTagEnumA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda, aftei.fnCallback = fnCallback; return acmFormatTagEnumW(had, &aftdw, MSACM_FormatTagEnumCallbackWtoA, - (DWORD)&aftei, fdwEnum); + (DWORD_PTR)&aftei, fdwEnum); } /*********************************************************************** * acmFormatTagEnumW (MSACM32.@) */ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, - ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, - DWORD fdwEnum) + ACMFORMATTAGENUMCBW fnCallback, + DWORD_PTR dwInstance, DWORD fdwEnum) { PWINE_ACMDRIVERID padid; - int i; + unsigned int i; BOOL bPcmDone = FALSE; - TRACE("(%p, %p, %p, %ld, %ld)\n", + TRACE("(%p, %p, %p, %ld, %d)\n", had, paftd, fnCallback, dwInstance, fdwEnum); if (!paftd) @@ -789,8 +832,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, /* (WS) MSDN info page says that if had != 0, then we should find * the specific driver to get its tags from. Therefore I'm removing * the FIXME call and adding a search block below. It also seems - * that the lack of this functionality was the responsible for - * codecs to be multiply and incorrectly listed. + * that the lack of this functionality was the responsible for + * codecs to be multiply and incorrectly listed. */ /* if (had) FIXME("had != NULL, not supported\n"); */ @@ -815,7 +858,7 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, if (bPcmDone) continue; bPcmDone = TRUE; } - if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) + if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) return MMSYSERR_NOERROR; } } diff --git a/reactos/dll/win32/msacm32/internal.c b/reactos/dll/win32/msacm32/internal.c index 05e54e88109..feb6e9cb6cc 100644 --- a/reactos/dll/win32/msacm32/internal.c +++ b/reactos/dll/win32/msacm32/internal.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include @@ -44,7 +44,51 @@ WINE_DEFAULT_DEBUG_CHANNEL(msacm); HANDLE MSACM_hHeap = NULL; PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL; -PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL; +static PWINE_ACMDRIVERID MSACM_pLastACMDriverID; + +static DWORD MSACM_suspendBroadcastCount = 0; +static BOOL MSACM_pendingBroadcast = FALSE; +static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd = NULL; +static PWINE_ACMNOTIFYWND MSACM_pLastACMNotifyWnd = NULL; + +static void MSACM_ReorderDriversByPriority(void); + +/*********************************************************************** + * MSACM_RegisterDriverFromRegistry() + */ +PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry(LPCWSTR pszRegEntry) +{ + static const WCHAR msacmW[] = {'M','S','A','C','M','.'}; + static const WCHAR drvkey[] = {'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s',' ','N','T','\\', + 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', + 'D','r','i','v','e','r','s','3','2','\0'}; + WCHAR buf[2048]; + DWORD bufLen, lRet; + HKEY hKey; + PWINE_ACMDRIVERID padid = NULL; + + /* The requested registry entry must have the format msacm.XXXXX in order to + be recognized in any future sessions of msacm + */ + if (0 == strncmpiW(pszRegEntry, msacmW, sizeof(msacmW)/sizeof(WCHAR))) { + lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey); + if (lRet != ERROR_SUCCESS) { + WARN("unable to open registry key - 0x%08x\n", lRet); + } else { + bufLen = sizeof(buf); + lRet = RegQueryValueExW(hKey, pszRegEntry, NULL, NULL, (LPBYTE)buf, &bufLen); + if (lRet != ERROR_SUCCESS) { + WARN("unable to query requested subkey %s - 0x%08x\n", debugstr_w(pszRegEntry), lRet); + } else { + MSACM_RegisterDriver(pszRegEntry, buf, 0); + } + RegCloseKey( hKey ); + } + } + return padid; +} #if 0 /*********************************************************************** @@ -69,7 +113,7 @@ static void MSACM_DumpCache(PWINE_ACMDRIVERID padid) * Returns TRUE is the format tag fmtTag is present in the cache. * If so, idx is set to its index. */ -BOOL MSACM_FindFormatTagInCache(WINE_ACMDRIVERID* padid, DWORD fmtTag, LPDWORD idx) +BOOL MSACM_FindFormatTagInCache(const WINE_ACMDRIVERID* padid, DWORD fmtTag, LPDWORD idx) { unsigned i; @@ -88,7 +132,7 @@ BOOL MSACM_FindFormatTagInCache(WINE_ACMDRIVERID* padid, DWORD fmtTag, LPDWORD i static BOOL MSACM_FillCache(PWINE_ACMDRIVERID padid) { HACMDRIVER had = 0; - int ntag; + unsigned int ntag; ACMDRIVERDETAILSW add; ACMFORMATTAGDETAILSW aftd; @@ -205,7 +249,7 @@ static BOOL MSACM_ReadCache(PWINE_ACMDRIVERID padid) /*********************************************************************** * MSACM_WriteCache */ -static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid) +static BOOL MSACM_WriteCache(const WINE_ACMDRIVERID *padid) { LPWSTR key = MSACM_GetRegistryKey(padid); HKEY hKey; @@ -215,11 +259,11 @@ static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid) if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey)) goto errCleanUp; - if (RegSetValueExA(hKey, "cFormatTags", 0, REG_DWORD, (void*)&padid->cFormatTags, sizeof(DWORD))) + if (RegSetValueExA(hKey, "cFormatTags", 0, REG_DWORD, (const void*)&padid->cFormatTags, sizeof(DWORD))) goto errCleanUp; - if (RegSetValueExA(hKey, "cFilterTags", 0, REG_DWORD, (void*)&padid->cFilterTags, sizeof(DWORD))) + if (RegSetValueExA(hKey, "cFilterTags", 0, REG_DWORD, (const void*)&padid->cFilterTags, sizeof(DWORD))) goto errCleanUp; - if (RegSetValueExA(hKey, "fdwSupport", 0, REG_DWORD, (void*)&padid->fdwSupport, sizeof(DWORD))) + if (RegSetValueExA(hKey, "fdwSupport", 0, REG_DWORD, (const void*)&padid->fdwSupport, sizeof(DWORD))) goto errCleanUp; if (RegSetValueExA(hKey, "aFormatTagCache", 0, REG_BINARY, (void*)padid->aFormatTag, @@ -237,44 +281,68 @@ static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid) * MSACM_RegisterDriver() */ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileName, - HINSTANCE hinstModule) + PWINE_ACMLOCALDRIVER pLocalDriver) { PWINE_ACMDRIVERID padid; - TRACE("(%s, %s, %p)\n", - debugstr_w(pszDriverAlias), debugstr_w(pszFileName), hinstModule); + TRACE("(%s, %s, %p)\n", + debugstr_w(pszDriverAlias), debugstr_w(pszFileName), pLocalDriver); - padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); + padid = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); + if (!padid) + return NULL; padid->obj.dwType = WINE_ACMOBJ_DRIVERID; padid->obj.pACMDriverID = padid; padid->pszDriverAlias = NULL; if (pszDriverAlias) { padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszDriverAlias)+1) * sizeof(WCHAR) ); + if (!padid->pszDriverAlias) { + HeapFree(MSACM_hHeap, 0, padid); + return NULL; + } strcpyW( padid->pszDriverAlias, pszDriverAlias ); } padid->pszFileName = NULL; if (pszFileName) { padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszFileName)+1) * sizeof(WCHAR) ); + if (!padid->pszFileName) { + HeapFree(MSACM_hHeap, 0, padid->pszDriverAlias); + HeapFree(MSACM_hHeap, 0, padid); + return NULL; + } strcpyW( padid->pszFileName, pszFileName ); } - padid->hInstModule = hinstModule; + padid->pLocalDriver = pLocalDriver; padid->pACMDriverList = NULL; - padid->pNextACMDriverID = NULL; - padid->pPrevACMDriverID = MSACM_pLastACMDriverID; - if (MSACM_pLastACMDriverID) - MSACM_pLastACMDriverID->pNextACMDriverID = padid; - MSACM_pLastACMDriverID = padid; - if (!MSACM_pFirstACMDriverID) - MSACM_pFirstACMDriverID = padid; + + if (pLocalDriver) { + padid->pPrevACMDriverID = NULL; + padid->pNextACMDriverID = MSACM_pFirstACMDriverID; + if (MSACM_pFirstACMDriverID) + MSACM_pFirstACMDriverID->pPrevACMDriverID = padid; + MSACM_pFirstACMDriverID = padid; + if (!MSACM_pLastACMDriverID) + MSACM_pLastACMDriverID = padid; + } else { + padid->pNextACMDriverID = NULL; + padid->pPrevACMDriverID = MSACM_pLastACMDriverID; + if (MSACM_pLastACMDriverID) + MSACM_pLastACMDriverID->pNextACMDriverID = padid; + MSACM_pLastACMDriverID = padid; + if (!MSACM_pFirstACMDriverID) + MSACM_pFirstACMDriverID = padid; + } /* disable the driver if we cannot load the cache */ - if (!MSACM_ReadCache(padid) && !MSACM_FillCache(padid)) { + if ((!padid->pszDriverAlias || !MSACM_ReadCache(padid)) && !MSACM_FillCache(padid)) { WARN("Couldn't load cache for ACM driver (%s)\n", debugstr_w(pszFileName)); MSACM_UnregisterDriver(padid); return NULL; } + + if (pLocalDriver) padid->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_LOCAL; return padid; } @@ -327,10 +395,362 @@ void MSACM_RegisterAllDrivers(void) *name = '='; } } - + MSACM_ReorderDriversByPriority(); MSACM_RegisterDriver(msacm32, msacm32, 0); } +/*********************************************************************** + * MSACM_RegisterNotificationWindow() + */ +PWINE_ACMNOTIFYWND MSACM_RegisterNotificationWindow(HWND hNotifyWnd, DWORD dwNotifyMsg) +{ + PWINE_ACMNOTIFYWND panwnd; + + TRACE("(%p,0x%08x)\n", hNotifyWnd, dwNotifyMsg); + + panwnd = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMNOTIFYWND)); + panwnd->obj.dwType = WINE_ACMOBJ_NOTIFYWND; + panwnd->obj.pACMDriverID = 0; + panwnd->hNotifyWnd = hNotifyWnd; + panwnd->dwNotifyMsg = dwNotifyMsg; + panwnd->fdwSupport = 0; + + panwnd->pNextACMNotifyWnd = NULL; + panwnd->pPrevACMNotifyWnd = MSACM_pLastACMNotifyWnd; + if (MSACM_pLastACMNotifyWnd) + MSACM_pLastACMNotifyWnd->pNextACMNotifyWnd = panwnd; + MSACM_pLastACMNotifyWnd = panwnd; + if (!MSACM_pFirstACMNotifyWnd) + MSACM_pFirstACMNotifyWnd = panwnd; + + return panwnd; +} + +/*********************************************************************** + * MSACM_BroadcastNotification() + */ +void MSACM_BroadcastNotification(void) +{ + if (MSACM_suspendBroadcastCount <= 0) { + PWINE_ACMNOTIFYWND panwnd; + + for (panwnd = MSACM_pFirstACMNotifyWnd; panwnd; panwnd = panwnd->pNextACMNotifyWnd) + if (!(panwnd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) + SendMessageW(panwnd->hNotifyWnd, panwnd->dwNotifyMsg, 0, 0); + } else { + MSACM_pendingBroadcast = TRUE; + } +} + +/*********************************************************************** + * MSACM_DisableNotifications() + */ +void MSACM_DisableNotifications(void) +{ + MSACM_suspendBroadcastCount++; +} + +/*********************************************************************** + * MSACM_EnableNotifications() + */ +void MSACM_EnableNotifications(void) +{ + if (MSACM_suspendBroadcastCount > 0) { + MSACM_suspendBroadcastCount--; + if (MSACM_suspendBroadcastCount == 0 && MSACM_pendingBroadcast) { + MSACM_pendingBroadcast = FALSE; + MSACM_BroadcastNotification(); + } + } +} + +/*********************************************************************** + * MSACM_UnRegisterNotificationWindow() + */ +PWINE_ACMNOTIFYWND MSACM_UnRegisterNotificationWindow(const WINE_ACMNOTIFYWND *panwnd) +{ + PWINE_ACMNOTIFYWND p; + + for (p = MSACM_pFirstACMNotifyWnd; p; p = p->pNextACMNotifyWnd) { + if (p == panwnd) { + PWINE_ACMNOTIFYWND pNext = p->pNextACMNotifyWnd; + + if (p->pPrevACMNotifyWnd) p->pPrevACMNotifyWnd->pNextACMNotifyWnd = p->pNextACMNotifyWnd; + if (p->pNextACMNotifyWnd) p->pNextACMNotifyWnd->pPrevACMNotifyWnd = p->pPrevACMNotifyWnd; + if (MSACM_pFirstACMNotifyWnd == p) MSACM_pFirstACMNotifyWnd = p->pNextACMNotifyWnd; + if (MSACM_pLastACMNotifyWnd == p) MSACM_pLastACMNotifyWnd = p->pPrevACMNotifyWnd; + HeapFree(MSACM_hHeap, 0, p); + + return pNext; + } + } + return NULL; +} + +/*********************************************************************** + * MSACM_RePositionDriver() + */ +void MSACM_RePositionDriver(PWINE_ACMDRIVERID padid, DWORD dwPriority) +{ + PWINE_ACMDRIVERID pTargetPosition = NULL; + + /* Remove selected driver from linked list */ + if (MSACM_pFirstACMDriverID == padid) { + MSACM_pFirstACMDriverID = padid->pNextACMDriverID; + } + if (MSACM_pLastACMDriverID == padid) { + MSACM_pLastACMDriverID = padid->pPrevACMDriverID; + } + if (padid->pPrevACMDriverID != NULL) { + padid->pPrevACMDriverID->pNextACMDriverID = padid->pNextACMDriverID; + } + if (padid->pNextACMDriverID != NULL) { + padid->pNextACMDriverID->pPrevACMDriverID = padid->pPrevACMDriverID; + } + + /* Look up position where selected driver should be */ + if (dwPriority == 1) { + pTargetPosition = padid->pPrevACMDriverID; + while (pTargetPosition->pPrevACMDriverID != NULL && + !(pTargetPosition->pPrevACMDriverID->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL)) { + pTargetPosition = pTargetPosition->pPrevACMDriverID; + } + } else if (dwPriority == -1) { + pTargetPosition = padid->pNextACMDriverID; + while (pTargetPosition->pNextACMDriverID != NULL) { + pTargetPosition = pTargetPosition->pNextACMDriverID; + } + } + + /* Place selected driver in selected position */ + padid->pPrevACMDriverID = pTargetPosition->pPrevACMDriverID; + padid->pNextACMDriverID = pTargetPosition; + if (padid->pPrevACMDriverID != NULL) { + padid->pPrevACMDriverID->pNextACMDriverID = padid; + } else { + MSACM_pFirstACMDriverID = padid; + } + if (padid->pNextACMDriverID != NULL) { + padid->pNextACMDriverID->pPrevACMDriverID = padid; + } else { + MSACM_pLastACMDriverID = padid; + } +} + +/*********************************************************************** + * MSACM_ReorderDriversByPriority() + * Reorders all drivers based on the priority list indicated by the registry key: + * HKCU\\Software\\Microsoft\\Multimedia\\Audio Compression Manager\\Priority v4.00 + */ +static void MSACM_ReorderDriversByPriority(void) +{ + PWINE_ACMDRIVERID padid; + unsigned int iNumDrivers; + PWINE_ACMDRIVERID * driverList = NULL; + HKEY hPriorityKey = NULL; + + TRACE("\n"); + + /* Count drivers && alloc corresponding memory for list */ + iNumDrivers = 0; + for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) iNumDrivers++; + if (iNumDrivers > 1) + { + LONG lError; + static const WCHAR basePriorityKey[] = { + 'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'M','u','l','t','i','m','e','d','i','a','\\', + 'A','u','d','i','o',' ','C','o','m','p','r','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\', + 'P','r','i','o','r','i','t','y',' ','v','4','.','0','0','\0' + }; + unsigned int i; + LONG lBufferLength; + WCHAR szBuffer[256]; + + driverList = HeapAlloc(MSACM_hHeap, 0, iNumDrivers * sizeof(PWINE_ACMDRIVERID)); + if (!driverList) + { + ERR("out of memory\n"); + goto errCleanUp; + } + + lError = RegOpenKeyW(HKEY_CURRENT_USER, basePriorityKey, &hPriorityKey); + if (lError != ERROR_SUCCESS) { + TRACE("RegOpenKeyW failed, possibly key does not exist yet\n"); + hPriorityKey = NULL; + goto errCleanUp; + } + + /* Copy drivers into list to simplify linked list modification */ + for (i = 0, padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID, i++) + { + driverList[i] = padid; + } + + /* Query each of the priorities in turn. Alias key is in lowercase. + The general form of the priority record is the following: + "PriorityN" --> "1, msacm.driveralias" + where N is an integer, and the value is a string of the driver + alias, prefixed by "1, " for an enabled driver, or "0, " for a + disabled driver. + */ + for (i = 0; i < iNumDrivers; i++) + { + static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'}; + WCHAR szSubKey[17]; + unsigned int iTargetPosition; + unsigned int iCurrentPosition; + WCHAR * pAlias; + static const WCHAR sPrefix[] = {'m','s','a','c','m','.','\0'}; + + /* Build expected entry name */ + snprintfW(szSubKey, 17, priorityTmpl, i + 1); + lBufferLength = sizeof(szBuffer); + lError = RegQueryValueExW(hPriorityKey, szSubKey, NULL, NULL, (LPBYTE)szBuffer, (LPDWORD)&lBufferLength); + if (lError != ERROR_SUCCESS) continue; + + /* Recovered driver alias should be at this position */ + iTargetPosition = i; + + /* Locate driver alias in driver list */ + pAlias = strstrW(szBuffer, sPrefix); + if (pAlias == NULL) continue; + + for (iCurrentPosition = 0; iCurrentPosition < iNumDrivers; iCurrentPosition++) { + if (strcmpiW(driverList[iCurrentPosition]->pszDriverAlias, pAlias) == 0) + break; + } + if (iCurrentPosition < iNumDrivers && iTargetPosition != iCurrentPosition) { + padid = driverList[iTargetPosition]; + driverList[iTargetPosition] = driverList[iCurrentPosition]; + driverList[iCurrentPosition] = padid; + + /* Locate enabled status */ + if (szBuffer[0] == '1') { + driverList[iTargetPosition]->fdwSupport &= ~ACMDRIVERDETAILS_SUPPORTF_DISABLED; + } else if (szBuffer[0] == '0') { + driverList[iTargetPosition]->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED; + } + } + } + + /* Re-assign pointers so that linked list traverses the ordered array */ + for (i = 0; i < iNumDrivers; i++) { + driverList[i]->pPrevACMDriverID = (i > 0) ? driverList[i - 1] : NULL; + driverList[i]->pNextACMDriverID = (i < iNumDrivers - 1) ? driverList[i + 1] : NULL; + } + MSACM_pFirstACMDriverID = driverList[0]; + MSACM_pLastACMDriverID = driverList[iNumDrivers - 1]; + } + +errCleanUp: + if (hPriorityKey != NULL) RegCloseKey(hPriorityKey); + HeapFree(MSACM_hHeap, 0, driverList); +} + +/*********************************************************************** + * MSACM_WriteCurrentPriorities() + * Writes out current order of driver priorities to registry key: + * HKCU\\Software\\Microsoft\\Multimedia\\Audio Compression Manager\\Priority v4.00 + */ +void MSACM_WriteCurrentPriorities(void) +{ + LONG lError; + HKEY hPriorityKey; + static const WCHAR basePriorityKey[] = { + 'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'M','u','l','t','i','m','e','d','i','a','\\', + 'A','u','d','i','o',' ','C','o','m','p','r','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\', + 'P','r','i','o','r','i','t','y',' ','v','4','.','0','0','\0' + }; + PWINE_ACMDRIVERID padid; + DWORD dwPriorityCounter; + static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'}; + static const WCHAR valueTmpl[] = {'%','c',',',' ','%','s','\0'}; + static const WCHAR converterAlias[] = {'I','n','t','e','r','n','a','l',' ','P','C','M',' ','C','o','n','v','e','r','t','e','r','\0'}; + WCHAR szSubKey[17]; + WCHAR szBuffer[256]; + + /* Delete ACM priority key and create it anew */ + lError = RegDeleteKeyW(HKEY_CURRENT_USER, basePriorityKey); + if (lError != ERROR_SUCCESS && lError != ERROR_FILE_NOT_FOUND) { + ERR("unable to remove current key %s (0x%08x) - priority changes won't persist past application end.\n", + debugstr_w(basePriorityKey), lError); + return; + } + lError = RegCreateKeyW(HKEY_CURRENT_USER, basePriorityKey, &hPriorityKey); + if (lError != ERROR_SUCCESS) { + ERR("unable to create key %s (0x%08x) - priority changes won't persist past application end.\n", + debugstr_w(basePriorityKey), lError); + return; + } + + /* Write current list of priorities */ + for (dwPriorityCounter = 0, padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { + if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL) continue; + if (padid->pszDriverAlias == NULL) continue; /* internal PCM converter is last */ + + /* Build required value name */ + dwPriorityCounter++; + snprintfW(szSubKey, 17, priorityTmpl, dwPriorityCounter); + + /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */ + snprintfW(szBuffer, 256, valueTmpl, (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ? '0' : '1', padid->pszDriverAlias); + strlwrW(szBuffer); + + lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (strlenW(szBuffer) + 1) * sizeof(WCHAR)); + if (lError != ERROR_SUCCESS) { + ERR("unable to write value for %s under key %s (0x%08x)\n", + debugstr_w(padid->pszDriverAlias), debugstr_w(basePriorityKey), lError); + } + } + + /* Build required value name */ + dwPriorityCounter++; + snprintfW(szSubKey, 17, priorityTmpl, dwPriorityCounter); + + /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */ + snprintfW(szBuffer, 256, valueTmpl, '1', converterAlias); + + lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (strlenW(szBuffer) + 1) * sizeof(WCHAR)); + if (lError != ERROR_SUCCESS) { + ERR("unable to write value for %s under key %s (0x%08x)\n", + debugstr_w(converterAlias), debugstr_w(basePriorityKey), lError); + } + RegCloseKey(hPriorityKey); +} + +static PWINE_ACMLOCALDRIVER MSACM_pFirstACMLocalDriver; +static PWINE_ACMLOCALDRIVER MSACM_pLastACMLocalDriver; + +static PWINE_ACMLOCALDRIVER MSACM_UnregisterLocalDriver(PWINE_ACMLOCALDRIVER paldrv) +{ + PWINE_ACMLOCALDRIVER pNextACMLocalDriver; + + if (paldrv->pACMInstList) { + ERR("local driver instances still present after closing all drivers - memory leak\n"); + return NULL; + } + + if (paldrv == MSACM_pFirstACMLocalDriver) + MSACM_pFirstACMLocalDriver = paldrv->pNextACMLocalDrv; + if (paldrv == MSACM_pLastACMLocalDriver) + MSACM_pLastACMLocalDriver = paldrv->pPrevACMLocalDrv; + + if (paldrv->pPrevACMLocalDrv) + paldrv->pPrevACMLocalDrv->pNextACMLocalDrv = paldrv->pNextACMLocalDrv; + if (paldrv->pNextACMLocalDrv) + paldrv->pNextACMLocalDrv->pPrevACMLocalDrv = paldrv->pPrevACMLocalDrv; + + pNextACMLocalDriver = paldrv->pNextACMLocalDrv; + + HeapFree(MSACM_hHeap, 0, paldrv); + + return pNextACMLocalDriver; +} + /*********************************************************************** * MSACM_UnregisterDriver() */ @@ -341,10 +761,8 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) while (p->pACMDriverList) acmDriverClose((HACMDRIVER) p->pACMDriverList, 0); - if (p->pszDriverAlias) - HeapFree(MSACM_hHeap, 0, p->pszDriverAlias); - if (p->pszFileName) - HeapFree(MSACM_hHeap, 0, p->pszFileName); + HeapFree(MSACM_hHeap, 0, p->pszDriverAlias); + HeapFree(MSACM_hHeap, 0, p->pszFileName); HeapFree(MSACM_hHeap, 0, p->aFormatTag); if (p == MSACM_pFirstACMDriverID) @@ -359,6 +777,7 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) pNextACMDriverID = p->pNextACMDriverID; + if (p->pLocalDriver) MSACM_UnregisterLocalDriver(p->pLocalDriver); HeapFree(MSACM_hHeap, 0, p); return pNextACMDriverID; @@ -369,12 +788,17 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) */ void MSACM_UnregisterAllDrivers(void) { + PWINE_ACMNOTIFYWND panwnd = MSACM_pFirstACMNotifyWnd; PWINE_ACMDRIVERID p = MSACM_pFirstACMDriverID; while (p) { MSACM_WriteCache(p); p = MSACM_UnregisterDriver(p); } + + while (panwnd) { + panwnd = MSACM_UnRegisterNotificationWindow(panwnd); + } } /*********************************************************************** @@ -406,6 +830,26 @@ PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver) return (PWINE_ACMDRIVER)MSACM_GetObj((HACMOBJ)hDriver, WINE_ACMOBJ_DRIVER); } +/*********************************************************************** + * MSACM_GetNotifyWnd() + */ +PWINE_ACMNOTIFYWND MSACM_GetNotifyWnd(HACMDRIVERID hDriver) +{ + return (PWINE_ACMNOTIFYWND)MSACM_GetObj((HACMOBJ)hDriver, WINE_ACMOBJ_NOTIFYWND); +} + +/*********************************************************************** + * MSACM_GetLocalDriver() + */ +/* +PWINE_ACMLOCALDRIVER MSACM_GetLocalDriver(HACMDRIVER hDriver) +{ + return (PWINE_ACMLOCALDRIVER)MSACM_GetObj((HACMOBJ)hDriver, WINE_ACMOBJ_LOCALDRIVER); +} +*/ +#define MSACM_DRIVER_SendMessage(PDRVRINST, msg, lParam1, lParam2) \ + (PDRVRINST)->pLocalDriver->lpDrvProc((PDRVRINST)->dwDriverID, (HDRVR)(PDRVRINST), msg, lParam1, lParam2) + /*********************************************************************** * MSACM_Message() */ @@ -413,5 +857,223 @@ MMRESULT MSACM_Message(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2 { PWINE_ACMDRIVER pad = MSACM_GetDriver(had); - return pad ? SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2) : MMSYSERR_INVALHANDLE; + if (!pad) return MMSYSERR_INVALHANDLE; + if (pad->hDrvr) return SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2); + if (pad->pLocalDrvrInst) return MSACM_DRIVER_SendMessage(pad->pLocalDrvrInst, uMsg, lParam1, lParam2); + + return MMSYSERR_INVALHANDLE; +} + +PWINE_ACMLOCALDRIVER MSACM_RegisterLocalDriver(HMODULE hModule, DRIVERPROC lpDriverProc) +{ + PWINE_ACMLOCALDRIVER paldrv; + + TRACE("(%p, %p)\n", hModule, lpDriverProc); + if (!hModule || !lpDriverProc) return NULL; + + /* look up previous instance of local driver module */ + for (paldrv = MSACM_pFirstACMLocalDriver; paldrv; paldrv = paldrv->pNextACMLocalDrv) + { + if (paldrv->hModule == hModule && paldrv->lpDrvProc == lpDriverProc) return paldrv; + } + + paldrv = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMLOCALDRIVER)); + paldrv->obj.dwType = WINE_ACMOBJ_LOCALDRIVER; + paldrv->obj.pACMDriverID = 0; + paldrv->hModule = hModule; + paldrv->lpDrvProc = lpDriverProc; + paldrv->pACMInstList = NULL; + + paldrv->pNextACMLocalDrv = NULL; + paldrv->pPrevACMLocalDrv = MSACM_pLastACMLocalDriver; + if (MSACM_pLastACMLocalDriver) + MSACM_pLastACMLocalDriver->pNextACMLocalDrv = paldrv; + MSACM_pLastACMLocalDriver = paldrv; + if (!MSACM_pFirstACMLocalDriver) + MSACM_pFirstACMLocalDriver = paldrv; + + return paldrv; +} + +/************************************************************************** + * MSACM_GetNumberOfModuleRefs [internal] + * + * Returns the number of open drivers which share the same module. + * Inspired from implementation in dlls/winmm/driver.c + */ +static unsigned MSACM_GetNumberOfModuleRefs(HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST ** found) +{ + PWINE_ACMLOCALDRIVER lpDrv; + unsigned count = 0; + + if (found) *found = NULL; + for (lpDrv = MSACM_pFirstACMLocalDriver; lpDrv; lpDrv = lpDrv->pNextACMLocalDrv) + { + if (lpDrv->hModule == hModule && lpDrv->lpDrvProc == lpDrvProc) + { + PWINE_ACMLOCALDRIVERINST pInst = lpDrv->pACMInstList; + + while (pInst) { + if (found && !*found) *found = pInst; + count++; + pInst = pInst->pNextACMInst; + } + } + } + return count; +} + +/************************************************************************** + * MSACM_RemoveFromList [internal] + * + * Generates all the logic to handle driver closure / deletion + * Removes a driver struct to the list of open drivers. + */ +static BOOL MSACM_RemoveFromList(PWINE_ACMLOCALDRIVERINST lpDrv) +{ + PWINE_ACMLOCALDRIVER pDriverBase = lpDrv->pLocalDriver; + PWINE_ACMLOCALDRIVERINST pPrevInst; + + /* last of this driver in list ? */ + if (MSACM_GetNumberOfModuleRefs(pDriverBase->hModule, pDriverBase->lpDrvProc, NULL) == 1) { + MSACM_DRIVER_SendMessage(lpDrv, DRV_DISABLE, 0L, 0L); + MSACM_DRIVER_SendMessage(lpDrv, DRV_FREE, 0L, 0L); + } + + pPrevInst = NULL; + if (pDriverBase->pACMInstList != lpDrv) { + pPrevInst = pDriverBase->pACMInstList; + while (pPrevInst && pPrevInst->pNextACMInst != lpDrv) + pPrevInst = pPrevInst->pNextACMInst; + if (!pPrevInst) { + ERR("requested to remove invalid instance %p\n", pPrevInst); + return FALSE; + } + } + if (!pPrevInst) { + /* first driver instance on list */ + pDriverBase->pACMInstList = lpDrv->pNextACMInst; + } else { + pPrevInst->pNextACMInst = lpDrv->pNextACMInst; + } + return TRUE; +} + +/************************************************************************** + * MSACM_AddToList [internal] + * + * Adds a driver struct to the list of open drivers. + * Generates all the logic to handle driver creation / open. + */ +static BOOL MSACM_AddToList(PWINE_ACMLOCALDRIVERINST lpNewDrv, LPARAM lParam2) +{ + PWINE_ACMLOCALDRIVER pDriverBase = lpNewDrv->pLocalDriver; + + /* first of this driver in list ? */ + if (MSACM_GetNumberOfModuleRefs(pDriverBase->hModule, pDriverBase->lpDrvProc, NULL) == 0) { + if (MSACM_DRIVER_SendMessage(lpNewDrv, DRV_LOAD, 0L, 0L) != DRV_SUCCESS) { + FIXME("DRV_LOAD failed on driver %p\n", lpNewDrv); + return FALSE; + } + /* returned value is not checked */ + MSACM_DRIVER_SendMessage(lpNewDrv, DRV_ENABLE, 0L, 0L); + } + + lpNewDrv->pNextACMInst = NULL; + if (pDriverBase->pACMInstList == NULL) { + pDriverBase->pACMInstList = lpNewDrv; + } else { + PWINE_ACMLOCALDRIVERINST lpDrvInst = pDriverBase->pACMInstList; + + while (lpDrvInst->pNextACMInst != NULL) + lpDrvInst = lpDrvInst->pNextACMInst; + + lpDrvInst->pNextACMInst = lpNewDrv; + } + + /* Now just open a new instance of a driver on this module */ + lpNewDrv->dwDriverID = MSACM_DRIVER_SendMessage(lpNewDrv, DRV_OPEN, 0, lParam2); + + if (lpNewDrv->dwDriverID == 0) { + FIXME("DRV_OPEN failed on driver %p\n", lpNewDrv); + MSACM_RemoveFromList(lpNewDrv); + return FALSE; + } + return TRUE; +} + +PWINE_ACMLOCALDRIVERINST MSACM_OpenLocalDriver(PWINE_ACMLOCALDRIVER paldrv, LPARAM lParam2) +{ + PWINE_ACMLOCALDRIVERINST pDrvInst; + + pDrvInst = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMLOCALDRIVERINST)); + pDrvInst->pLocalDriver = paldrv; + pDrvInst->dwDriverID = 0; + pDrvInst->pNextACMInst = NULL; + pDrvInst->bSession = FALSE; + + /* Win32 installable drivers must support a two phase opening scheme: + * + first open with NULL as lParam2 (session instance), + * + then do a second open with the real non null lParam2) + */ + if (MSACM_GetNumberOfModuleRefs(paldrv->hModule, paldrv->lpDrvProc, NULL) == 0 && lParam2) + { + PWINE_ACMLOCALDRIVERINST ret; + + if (!MSACM_AddToList(pDrvInst, 0L)) + { + ERR("load0 failed\n"); + goto exit; + } + ret = MSACM_OpenLocalDriver(paldrv, lParam2); + if (!ret) + { + MSACM_CloseLocalDriver(pDrvInst); + ERR("load1 failed\n"); + goto exit; + } + pDrvInst->bSession = TRUE; + return ret; + } + + if (!MSACM_AddToList(pDrvInst, lParam2)) + { + ERR("load failed\n"); + goto exit; + } + + TRACE("=> %p\n", pDrvInst); + return pDrvInst; +exit: + HeapFree(MSACM_hHeap, 0, pDrvInst); + return NULL; +} + +LRESULT MSACM_CloseLocalDriver(PWINE_ACMLOCALDRIVERINST paldrv) +{ + if (MSACM_RemoveFromList(paldrv)) { + PWINE_ACMLOCALDRIVERINST lpDrv0; + PWINE_ACMLOCALDRIVER pDriverBase = paldrv->pLocalDriver; + + MSACM_DRIVER_SendMessage(paldrv, DRV_CLOSE, 0, 0); + paldrv->dwDriverID = 0; + + if (paldrv->bSession) + ERR("should not directly close session instance (%p)\n", paldrv); + + /* if driver has an opened session instance, we have to close it too */ + if (MSACM_GetNumberOfModuleRefs(pDriverBase->hModule, pDriverBase->lpDrvProc, &lpDrv0) == 1 && + lpDrv0->bSession) + { + MSACM_DRIVER_SendMessage(lpDrv0, DRV_CLOSE, 0L, 0L); + lpDrv0->dwDriverID = 0; + MSACM_RemoveFromList(lpDrv0); + HeapFree(GetProcessHeap(), 0, lpDrv0); + } + + HeapFree(MSACM_hHeap, 0, paldrv); + return TRUE; + } + ERR("unable to close driver instance\n"); + return FALSE; } diff --git a/reactos/dll/win32/msacm32/msacm.rc b/reactos/dll/win32/msacm32/msacm.rc index 7f1e32bc584..ffc14854308 100644 --- a/reactos/dll/win32/msacm32/msacm.rc +++ b/reactos/dll/win32/msacm32/msacm.rc @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include "windef.h" @@ -23,18 +23,24 @@ #include "winuser.h" #include "wineacm.h" -#include "msacm_El.rc" -#include "msacm_En.rc" +#include "msacm_Cs.rc" +#include "msacm_Da.rc" #include "msacm_De.rc" +#include "msacm_En.rc" #include "msacm_Es.rc" #include "msacm_Fr.rc" +#include "msacm_Hu.rc" #include "msacm_It.rc" #include "msacm_Ja.rc" +#include "msacm_Ko.rc" +#include "msacm_Lt.rc" #include "msacm_Nl.rc" #include "msacm_No.rc" #include "msacm_Pl.rc" #include "msacm_Pt.rc" +#include "msacm_Ro.rc" #include "msacm_Ru.rc" +#include "msacm_Si.rc" #include "msacm_Sv.rc" -#include "msacm_Hu.rc" -#include "msacm_Uk.rc" +#include "msacm_Tr.rc" +#include "msacm_Zh.rc" diff --git a/reactos/dll/win32/msacm32/msacm32.spec b/reactos/dll/win32/msacm32/msacm32.spec index 9500b53e2cd..28b1c7ca6bb 100644 --- a/reactos/dll/win32/msacm32/msacm32.spec +++ b/reactos/dll/win32/msacm32/msacm32.spec @@ -42,5 +42,6 @@ @ stdcall acmStreamSize(long long ptr long) @ stdcall acmStreamUnprepareHeader(long ptr long) -# this is wine only -@ stdcall DriverProc(long long long long long) PCM_DriverProc +################################################################ +# Wine internal extension +@ stdcall -private DriverProc(long long long long long) PCM_DriverProc diff --git a/reactos/dll/win32/msacm32/msacm32_main.c b/reactos/dll/win32/msacm32/msacm32_main.c index dde962a2dfe..d3160e32172 100644 --- a/reactos/dll/win32/msacm32/msacm32_main.c +++ b/reactos/dll/win32/msacm32/msacm32_main.c @@ -18,16 +18,16 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include "windef.h" #include "winbase.h" -#include "winerror.h" #include "wine/debug.h" #include "mmsystem.h" +#define NOBITMAP #include "mmreg.h" #include "msacm.h" #include "msacmdrv.h" @@ -44,7 +44,7 @@ HINSTANCE MSACM_hInstance32 = 0; */ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved) { - TRACE("%p 0x%lx %p\n", hInstDLL, fdwReason, lpvReserved); + TRACE("%p 0x%x %p\n", hInstDLL, fdwReason, lpvReserved); switch (fdwReason) { case DLL_PROCESS_ATTACH: @@ -86,7 +86,7 @@ DWORD WINAPI acmGetVersion(void) case VER_PLATFORM_WIN32_NT: return 0x04000565; /* 4.0.1381 */ default: - FIXME("%lx not supported\n", version.dwPlatformId); + FIXME("%x not supported\n", version.dwPlatformId); case VER_PLATFORM_WIN32_WINDOWS: return 0x04030000; /* 4.3.0 */ } @@ -107,7 +107,7 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) BOOL bLocal = TRUE; PWINE_ACMDRIVERID padid; DWORD val = 0; - int i; + unsigned int i; MMRESULT mmr = MMSYSERR_NOERROR; TRACE("(%p, %d, %p);\n", hao, uMetric, pMetric); @@ -220,11 +220,43 @@ MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) FIXME("ACM_METRIC_COUNT_HARDWARE not implemented\n"); break; + case ACM_METRIC_DRIVER_PRIORITY: + /* Return current list position of driver */ + if (!hao) return MMSYSERR_INVALHANDLE; + mmr = MMSYSERR_INVALHANDLE; + for (i = 1, padid = MSACM_pFirstACMDriverID; padid; i++, padid = padid->pNextACMDriverID) { + if (padid == (PWINE_ACMDRIVERID)hao) { + if (pMetric) { + *(LPDWORD)pMetric = i; + mmr = MMSYSERR_NOERROR; + } else { + mmr = MMSYSERR_INVALPARAM; + } + break; + } + } + break; + + case ACM_METRIC_DRIVER_SUPPORT: + /* Return fdwSupport for driver */ + if (!hao) return MMSYSERR_INVALHANDLE; + mmr = MMSYSERR_INVALHANDLE; + for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { + if (padid == (PWINE_ACMDRIVERID)hao) { + if (pMetric) { + *(LPDWORD)pMetric = padid->fdwSupport; + mmr = MMSYSERR_NOERROR; + } else { + mmr = MMSYSERR_INVALPARAM; + } + break; + } + } + break; + case ACM_METRIC_HARDWARE_WAVE_INPUT: case ACM_METRIC_HARDWARE_WAVE_OUTPUT: case ACM_METRIC_MAX_SIZE_FILTER: - case ACM_METRIC_DRIVER_SUPPORT: - case ACM_METRIC_DRIVER_PRIORITY: default: FIXME("(%p, %d, %p): stub\n", hao, uMetric, pMetric); mmr = MMSYSERR_NOTSUPPORTED; diff --git a/reactos/dll/win32/msacm32/msacm_Cs.rc b/reactos/dll/win32/msacm32/msacm_Cs.rc new file mode 100644 index 00000000000..169e760b89c --- /dev/null +++ b/reactos/dll/win32/msacm32/msacm_Cs.rc @@ -0,0 +1,60 @@ +/* Hey, Emacs, open this file with -*- coding: cp1250 -*- + * + * Copyright 2000 Eric Pouech + * + * Czech resources for MS ACM + * Copyright 2004 David Kredba + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +/* Czech strings in CP1250 */ + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Vbr zvuku" +FONT 8, "MS Shell Dlg" +BEGIN + + LTEXT "&Nzev:", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "&Uloit jako", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "Odeb&rat", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "&Formt:", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "&Atributy:", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 + PUSHBUTTON "Storno", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "P&omoc", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END diff --git a/reactos/dll/win32/msacm32/msacm_Da.rc b/reactos/dll/win32/msacm32/msacm_Da.rc new file mode 100644 index 00000000000..25ca1dbc52b --- /dev/null +++ b/reactos/dll/win32/msacm32/msacm_Da.rc @@ -0,0 +1,56 @@ +/* + * Danish resource file for MS ACM + * + * Copyright (C) 2008 Jens Albretsen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_DANISH, SUBLANG_DEFAULT + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Lyd valg" +FONT 8, "MS Shell Dlg" +BEGIN + + LTEXT "&Navn:", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "Gem &som...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "Fje&rn", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "&Attributter:", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 + PUSHBUTTON "Annuller", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "&Hjlp", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END diff --git a/reactos/dll/win32/msacm32/msacm_De.rc b/reactos/dll/win32/msacm32/msacm_De.rc index c0d4fe26b05..8d60c363a8e 100644 --- a/reactos/dll/win32/msacm32/msacm_De.rc +++ b/reactos/dll/win32/msacm32/msacm_De.rc @@ -1,7 +1,7 @@ /* * German resource file for MS ACM * - * by Friedrich Stange (dj_smith_reactos@online.de) + * Copyright 2004 Henning Gerhardt * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -15,14 +15,14 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Sound auswahl" +CAPTION "Soundauswahl" FONT 8, "MS Shell Dlg" BEGIN @@ -31,15 +31,15 @@ BEGIN COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Speichern als...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 - PUSHBUTTON "&Lschen", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + PUSHBUTTON "Speichern &unter...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "&Entfernen", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "&Eigenschaften:", -1, 5, 59, 44, 8, NOT WS_GROUP + LTEXT "&Attribute:", -1, 5, 59, 44, 8, NOT WS_GROUP #if 0 COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, diff --git a/reactos/dll/win32/msacm32/msacm_En.rc b/reactos/dll/win32/msacm32/msacm_En.rc index acbd0c44349..e7c7ec2888f 100644 --- a/reactos/dll/win32/msacm32/msacm_En.rc +++ b/reactos/dll/win32/msacm32/msacm_En.rc @@ -15,10 +15,10 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU diff --git a/reactos/dll/win32/msacm32/msacm_Es.rc b/reactos/dll/win32/msacm32/msacm_Es.rc index 3f26252898a..8d16b62240e 100644 --- a/reactos/dll/win32/msacm32/msacm_Es.rc +++ b/reactos/dll/win32/msacm32/msacm_Es.rc @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL diff --git a/reactos/dll/win32/msacm32/msacm_Fr.rc b/reactos/dll/win32/msacm32/msacm_Fr.rc index f9efdbad7d9..c170d2fff80 100644 --- a/reactos/dll/win32/msacm32/msacm_Fr.rc +++ b/reactos/dll/win32/msacm32/msacm_Fr.rc @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL @@ -52,6 +52,6 @@ BEGIN #endif DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 PUSHBUTTON "Annuler", IDCANCEL, 92, 80, 40, 14 - PUSHBUTTON "&Aide", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + PUSHBUTTON "Aid&e", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 END diff --git a/reactos/dll/win32/msacm32/msacm_Hu.rc b/reactos/dll/win32/msacm32/msacm_Hu.rc index 859afceb3a2..3bc440e2b3a 100644 --- a/reactos/dll/win32/msacm32/msacm_Hu.rc +++ b/reactos/dll/win32/msacm32/msacm_Hu.rc @@ -1,8 +1,7 @@ /* * Hungarian resource file for MS ACM * - * Copyright 2000 Eric Pouech - * Copyright 2005 Gergely Risko + * Copyright 2006 Andras Kovacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,14 +15,14 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Hang Kivlasztsa" +CAPTION "Hang kivlaszts" FONT 8, "MS Shell Dlg" BEGIN @@ -33,7 +32,7 @@ BEGIN CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "&Ments msknt...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 -/* NOT TRANSLATED */ PUSHBUTTON "&Remove", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + PUSHBUTTON "&Eltvolts", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 LTEXT "&Formtum:", -1, 5, 41, 44, 8, NOT WS_GROUP diff --git a/reactos/dll/win32/msacm32/msacm_It.rc b/reactos/dll/win32/msacm32/msacm_It.rc index c01db70511e..1ce6b42b369 100644 --- a/reactos/dll/win32/msacm32/msacm_It.rc +++ b/reactos/dll/win32/msacm32/msacm_It.rc @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL @@ -51,7 +51,7 @@ BEGIN CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP #endif DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 - PUSHBUTTON "Anulla", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "Annulla", IDCANCEL, 92, 80, 40, 14 PUSHBUTTON "&Aiuto", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 END diff --git a/reactos/dll/win32/msacm32/msacm_Ja.rc b/reactos/dll/win32/msacm32/msacm_Ja.rc index 01e7ba31372..e9a63f9e257 100644 --- a/reactos/dll/win32/msacm32/msacm_Ja.rc +++ b/reactos/dll/win32/msacm32/msacm_Ja.rc @@ -15,31 +15,34 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +/* UTF-8 */ +#pragma code_page(65001) + LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "TEh̑I" -FONT 9, "MS UI Gothic" +CAPTION "サウンドの選択" +FONT 9, "MS Shell Dlg" BEGIN - LTEXT "O(&N):", -1, 5, 5, 115, 8, NOT WS_GROUP + LTEXT "名前(&N):", -1, 5, 5, 115, 8, NOT WS_GROUP COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Otĕۑ(&S)...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 - PUSHBUTTON "폜(&R)", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + PUSHBUTTON "名前を付けて保存(&S)...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "削除(&R)", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 - LTEXT "tH[}bg(&F):", -1, 5, 41, 44, 8, NOT WS_GROUP + LTEXT "フォーマット(&F):", -1, 5, 41, 44, 8, NOT WS_GROUP COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "(&A):", -1, 5, 59, 44, 8, NOT WS_GROUP + LTEXT "属性(&A):", -1, 5, 59, 44, 8, NOT WS_GROUP #if 0 COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, @@ -50,7 +53,9 @@ BEGIN CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP #endif DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 - PUSHBUTTON "LZ", IDCANCEL, 92, 80, 40, 14 - PUSHBUTTON "wv(&H)", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + PUSHBUTTON "キャンセル", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "ヘルプ(&H)", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 END + +#pragma code_page(default) diff --git a/reactos/dll/win32/msacm32/msacm_Ko.rc b/reactos/dll/win32/msacm32/msacm_Ko.rc new file mode 100644 index 00000000000..1123e1f7f80 --- /dev/null +++ b/reactos/dll/win32/msacm32/msacm_Ko.rc @@ -0,0 +1,56 @@ +/* + * Korean resource file for MS ACM + * + * Copyright 2005,2007 YunSong Hwang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION " " +FONT 9, "MS Shell Dlg" +BEGIN + + LTEXT "̸(&N):", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 97, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "ٸ ̸ (&S)...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 103, 14, 70, 14 + PUSHBUTTON "(&R)", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "(&F):", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "Ӽ(&A):", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "Ȯ", IDOK, 48, 80, 40, 14 + PUSHBUTTON "", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "(&H)", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END diff --git a/reactos/dll/win32/msacm32/msacm_Lt.rc b/reactos/dll/win32/msacm32/msacm_Lt.rc new file mode 100644 index 00000000000..8decd59d02b --- /dev/null +++ b/reactos/dll/win32/msacm32/msacm_Lt.rc @@ -0,0 +1,61 @@ +/* + * Lithuanian resource file for MS ACM + * + * Copyright 2009 Aurimas Fišeras + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_LITHUANIAN, SUBLANG_NEUTRAL + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Garso parinkimas" +FONT 8, "MS Shell Dlg" +BEGIN + + LTEXT "&Pavadinimas:", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 100, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "Išsaugoti k&aip...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 110, 14, 60, 14 + PUSHBUTTON "Pa&šalinti", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "&Formatas:", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "A&tributai:", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "Gerai", IDOK, 48, 80, 40, 14 + PUSHBUTTON "Atsisakyti", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "&Žinynas", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END + +#pragma code_page(default) diff --git a/reactos/dll/win32/msacm32/msacm_Nl.rc b/reactos/dll/win32/msacm32/msacm_Nl.rc index 16343235ad2..fd7fb79d547 100644 --- a/reactos/dll/win32/msacm32/msacm_Nl.rc +++ b/reactos/dll/win32/msacm32/msacm_Nl.rc @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL diff --git a/reactos/dll/win32/msacm32/msacm_No.rc b/reactos/dll/win32/msacm32/msacm_No.rc index 04a81d689d6..e099f091a0e 100644 --- a/reactos/dll/win32/msacm32/msacm_No.rc +++ b/reactos/dll/win32/msacm32/msacm_No.rc @@ -1,7 +1,7 @@ /* - * Norwegian resource file for MS ACM + * Norwegian Bokml resource file for MS ACM * - * Copyright 2000 Eric Pouech + * Copyright 2005 Alexander N. Srnes * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -15,14 +15,14 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Lyd utvalg" +CAPTION "Lydutvalg" FONT 8, "MS Shell Dlg" BEGIN @@ -31,8 +31,8 @@ BEGIN COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Lagre som...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 - PUSHBUTTON "&Fjern", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + PUSHBUTTON "Lagre &som...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "Fje&rn", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP diff --git a/reactos/dll/win32/msacm32/msacm_Pl.rc b/reactos/dll/win32/msacm32/msacm_Pl.rc index 5268eff8c0d..940b004d013 100644 --- a/reactos/dll/win32/msacm32/msacm_Pl.rc +++ b/reactos/dll/win32/msacm32/msacm_Pl.rc @@ -1,15 +1,28 @@ /* - * translated by TestamenT - * testament@users.sourceforge.net - * https://sourceforge.net/projects/reactospl + * Polish resource file for MS ACM * + * Copyright 2000 Eric Pouech + * Copyright 2004 Piotr Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - LANGUAGE LANG_POLISH, SUBLANG_DEFAULT -DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 235, 100 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Sekcja dwiku" +CAPTION "Wybr dwiku" FONT 8, "MS Shell Dlg" BEGIN @@ -18,26 +31,26 @@ BEGIN COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Zapisz jako...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 - PUSHBUTTON "&Usu", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + PUSHBUTTON "&Zapisz jako...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 50, 14 + PUSHBUTTON "&Usu", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 180, 14, 50, 14 LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP - COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 180, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "&Waciwoci:", -1, 5, 59, 44, 8, NOT WS_GROUP + LTEXT "&Atrybuty:", -1, 5, 59, 44, 8, NOT WS_GROUP #if 0 - COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 180, 60, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS #else - COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 180, 60, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP #endif - DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 - PUSHBUTTON "Anuluj", IDCANCEL, 92, 80, 40, 14 - PUSHBUTTON "Pomo&c", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + DEFPUSHBUTTON "OK", IDOK, 53, 80, 40, 14 + PUSHBUTTON "Anuluj", IDCANCEL, 97, 80, 40, 14 + PUSHBUTTON "&Pomoc", IDD_ACMFORMATCHOOSE_BTN_HELP, 141, 80, 40, 14 END diff --git a/reactos/dll/win32/msacm32/msacm_Pt.rc b/reactos/dll/win32/msacm32/msacm_Pt.rc index 062742b858e..17cbca22062 100644 --- a/reactos/dll/win32/msacm32/msacm_Pt.rc +++ b/reactos/dll/win32/msacm32/msacm_Pt.rc @@ -2,6 +2,7 @@ * Portuguese resource file for MS ACM * * Copyright 2003 Marcelo Duarte + * Copyright 2006 Amrico Jos Melo * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -15,14 +16,14 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Seleo de som" +CAPTION "Seleco de som" FONT 8, "MS Shell Dlg" BEGIN @@ -31,7 +32,44 @@ BEGIN COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Salvar como...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "&Gravar como...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "&Remover", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "&Formato:", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "&Atributos:", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 + PUSHBUTTON "Cancelar", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "Aj&uda", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Seleco de som" +FONT 8, "MS Shell Dlg" +BEGIN + + LTEXT "&Nome:", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "&Gravar como...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 PUSHBUTTON "&Remover", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 LTEXT "&Formato:", -1, 5, 41, 44, 8, NOT WS_GROUP diff --git a/reactos/dll/win32/msacm32/msacm_Ro.rc b/reactos/dll/win32/msacm32/msacm_Ro.rc new file mode 100644 index 00000000000..d1cc0bbb653 --- /dev/null +++ b/reactos/dll/win32/msacm32/msacm_Ro.rc @@ -0,0 +1,54 @@ +/* + * Copyright 2000 Eric Pouech + * Copyright 2008 Michael Stefaniuc + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL + +#pragma code_page(65001) + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Sound Selection" +FONT 8, "MS Shell Dlg" +BEGIN + + LTEXT "&Nume:", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "&Salvează ca", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "&Elimină", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "&Atribute:", -1, 5, 59, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + + DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 + PUSHBUTTON "Renunță", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "&Ajutor", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END + +#pragma code_page(default) diff --git a/reactos/dll/win32/msacm32/msacm_Ru.rc b/reactos/dll/win32/msacm32/msacm_Ru.rc index b298070b885..d634139396f 100644 --- a/reactos/dll/win32/msacm32/msacm_Ru.rc +++ b/reactos/dll/win32/msacm32/msacm_Ru.rc @@ -1,7 +1,7 @@ /* * Russian resource file for MS ACM * - * Copyright 2005 Mikhail Y. Zvyozdochkin + * Copyright 2008 Vitaliy Margolen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -15,12 +15,12 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 234, 101 +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION " " FONT 8, "MS Shell Dlg" @@ -31,27 +31,26 @@ BEGIN COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "& ...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 58, 14 - PUSHBUTTON "&", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 187, 14, 38, 14 + PUSHBUTTON "& ...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "&", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 LTEXT "&:", -1, 5, 41, 44, 8, NOT WS_GROUP - COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 177, 60, + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "&:", -1, 5, 59, 44, 8, NOT WS_GROUP #if 0 - COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 177, 60, + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS #else - COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 177, 60, + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP #endif DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14 PUSHBUTTON "", IDCANCEL, 92, 80, 40, 14 - PUSHBUTTON "&", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + PUSHBUTTON "&", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 END - diff --git a/reactos/dll/win32/msacm32/msacm_Si.rc b/reactos/dll/win32/msacm32/msacm_Si.rc new file mode 100644 index 00000000000..2513f763021 --- /dev/null +++ b/reactos/dll/win32/msacm32/msacm_Si.rc @@ -0,0 +1,60 @@ +/* + * Slovenian resource file for MS ACM + * + * Copyright 2008 Rok Mandeljc + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma code_page(65001) + +LANGUAGE LANG_SLOVENIAN, SUBLANG_DEFAULT + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Izbira zvoka" +FONT 8, "MS Shell Dlg" +BEGIN + + LTEXT "&Ime:", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "&Shrani kot ...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "&Odstrani", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "&Lastnosti:", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "V redu", IDOK, 48, 80, 40, 14 + PUSHBUTTON "Prekliči", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "&Pomoč", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END + +#pragma code_page(default) diff --git a/reactos/dll/win32/msacm32/msacm_Sv.rc b/reactos/dll/win32/msacm32/msacm_Sv.rc index aa8cb5edb74..747e6085b01 100644 --- a/reactos/dll/win32/msacm32/msacm_Sv.rc +++ b/reactos/dll/win32/msacm32/msacm_Sv.rc @@ -1,7 +1,7 @@ /* * Swedish resource file for MS ACM * - * Copyright 2005 Anders Bergh + * Copyright 2007 Daniel Nylander * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL diff --git a/reactos/dll/win32/msacm32/msacm_Tr.rc b/reactos/dll/win32/msacm32/msacm_Tr.rc new file mode 100644 index 00000000000..0ececa4cca6 --- /dev/null +++ b/reactos/dll/win32/msacm32/msacm_Tr.rc @@ -0,0 +1,56 @@ +/* + * Turkish resource file for MS ACM + * + * Copyright 2006 Fatih Ac + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Ses Seimi" +FONT 8, "MS Shell Dlg" +BEGIN + + LTEXT "&Ad:", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "&Farkl Kaydet...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "&Kaldr", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "&Biim:", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "&znitelikler:", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "Tamam", IDOK, 48, 80, 40, 14 + PUSHBUTTON "ptal", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "&Yardm", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END diff --git a/reactos/dll/win32/msacm32/msacm_Zh.rc b/reactos/dll/win32/msacm32/msacm_Zh.rc new file mode 100644 index 00000000000..2bc138b5acd --- /dev/null +++ b/reactos/dll/win32/msacm32/msacm_Zh.rc @@ -0,0 +1,98 @@ +/* + * MS ACM (Simplified and Traditional Chinese Resources) + * + * Copyright 2008 Hongbo Ni + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* Chinese text is encoded in UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "声音选择" +FONT 9, "MS Shell Dlg" +BEGIN + + LTEXT "名称(&N):", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "保存为(&S)...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "删除(&R)", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "格式(&F):", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "属性(&A):", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "确定", IDOK, 48, 80, 40, 14 + PUSHBUTTON "取消", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "帮助(&H)", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL + +DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "聲音選擇" +FONT 9, "MS Shell Dlg" +BEGIN + + LTEXT "名稱(&N):", -1, 5, 5, 115, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + PUSHBUTTON "儲存為(&S)...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14 + PUSHBUTTON "刪除(&R)", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14 + + LTEXT "格式(&F):", -1, 5, 41, 44, 8, NOT WS_GROUP + + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + + LTEXT "屬性(&A):", -1, 5, 59, 44, 8, NOT WS_GROUP + +#if 0 + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS +#else + COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +#endif + DEFPUSHBUTTON "確定", IDOK, 48, 80, 40, 14 + PUSHBUTTON "取消", IDCANCEL, 92, 80, 40, 14 + PUSHBUTTON "幫助(&H)", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14 + +END + +#pragma code_page(default) diff --git a/reactos/dll/win32/msacm32/pcmconverter.c b/reactos/dll/win32/msacm32/pcmconverter.c index 3f335d005ce..7d041c93ad0 100644 --- a/reactos/dll/win32/msacm32/pcmconverter.c +++ b/reactos/dll/win32/msacm32/pcmconverter.c @@ -4,6 +4,7 @@ * MSACM32 library * * Copyright 2000 Eric Pouech + * Copyright 2004 Robert Reif * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,13 +18,9 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * * FIXME / TODO list - * + most of the computation should be done in fixed point arithmetic - * instead of floating point (16 bits for integral part, and 16 bits - * for fractional part for example) - * + implement PCM_FormatSuggest function * + get rid of hack for PCM_DriverProc (msacm32.dll shouldn't export * a DriverProc, but this would require implementing a generic * embedded driver handling scheme in msacm32.dll which isn't done yet @@ -38,6 +35,7 @@ #include "windef.h" #include "winbase.h" #include "mmsystem.h" +#define NOBITMAP #include "mmreg.h" #include "msacm.h" #include "wingdi.h" @@ -68,13 +66,13 @@ static DWORD PCM_drvOpen(LPCSTR str, PACMDRVOPENDESCW adod) */ static DWORD PCM_drvClose(DWORD dwDevID) { - TRACE("(%ld)\n", dwDevID); + TRACE("(%d)\n", dwDevID); return 1; } #define NUM_PCM_FORMATS (sizeof(PCM_Formats) / sizeof(PCM_Formats[0])) -#define NUM_OF(a,b) (((a)+(b)-1)/(b)) +#define NUM_OF(a,b) ((a)/(b)) /* flags for fdwDriver */ #define PCM_RESAMPLE 1 @@ -84,25 +82,15 @@ typedef struct tagAcmPcmData { /* conversion routine, depending if rate conversion is required */ union { void (*cvtKeepRate)(const unsigned char*, int, unsigned char*); - void (*cvtChangeRate)(struct tagAcmPcmData*, const unsigned char*, - LPDWORD, unsigned char*, LPDWORD); + void (*cvtChangeRate)(DWORD, const unsigned char*, LPDWORD, + DWORD, unsigned char*, LPDWORD); } cvt; - /* the following fields are used only with rate conversion) */ - DWORD srcPos; /* position in source stream */ - double dstPos; /* position in destination stream */ - double dstIncr; /* value to increment dst stream when src stream - is incremented by 1 */ - /* last source stream value read */ - union { - unsigned char b; /* 8 bit value */ - short s; /* 16 bit value */ - } last[2]; /* two channels max (stereo) */ } AcmPcmData; /* table to list all supported formats... those are the basic ones. this * also helps given a unique index to each of the supported formats */ -static struct { +static const struct { int nChannels; int nBits; int rate; @@ -120,7 +108,7 @@ static struct { */ static DWORD PCM_GetFormatIndex(LPWAVEFORMATEX wfx) { - int i; + unsigned int i; TRACE("(%p)\n", wfx); for (i = 0; i < NUM_PCM_FORMATS; i++) { @@ -141,11 +129,7 @@ static DWORD PCM_GetFormatIndex(LPWAVEFORMATEX wfx) * shall work in all cases) * * mono => stereo: copy the same sample on Left & Right channels - * stereo =) mono: use the average value of samples from Left & Right channels - * resampling; we lookup for each destination sample the two source adjacent - * samples were src <= dst < src+1 (dst is increased by a fractional - * value which is equivalent to the increment by one on src); then we - * use a linear interpolation between src and src+1 + * stereo => mono: use the sum of Left & Right channels */ /*********************************************************************** @@ -155,7 +139,7 @@ static DWORD PCM_GetFormatIndex(LPWAVEFORMATEX wfx) */ static inline short C816(unsigned char b) { - return (short)((b+(b << 8))-32768); + return (b - 128) << 8; } /*********************************************************************** @@ -193,22 +177,40 @@ static inline void W16(unsigned char* dst, short s) * M16 * * Convert the (l,r) 16 bit stereo sample into a 16 bit mono - * (takes the mid-point of the two values) + * (takes the sum of the two values) */ static inline short M16(short l, short r) { - return (l + r) / 2; + int sum = l + r; + + /* clip sum to saturation */ + if (sum > 32767) + sum = 32767; + else if (sum < -32768) + sum = -32768; + + return sum; } /*********************************************************************** * M8 * * Convert the (l,r) 8 bit stereo sample into a 8 bit mono - * (takes the mid-point of the two values) + * (takes the sum of the two values) */ static inline unsigned char M8(unsigned char a, unsigned char b) { - return (unsigned char)((a + b) / 2); + int l = a - 128; + int r = b - 128; + int sum = (l + r) + 128; + + /* clip sum to saturation */ + if (sum > 0xff) + sum = 0xff; + else if (sum < 0) + sum = 0; + + return sum; } /* the conversion routines without rate conversion are labelled cvtK @@ -274,7 +276,7 @@ static void cvtMS168K(const unsigned char* src, int ns, unsigned char* dst) TRACE("(%p, %d, %p)\n", src, ns, dst); while (ns--) { - v = C168(R16(src)); src += 2; + v = C168(R16(src)); src += 2; *dst++ = v; *dst++ = v; } @@ -372,47 +374,16 @@ static void cvtSS168K(const unsigned char* src, int ns, unsigned char* dst) } } -static void (*PCM_ConvertKeepRate[16])(const unsigned char*, int, unsigned char*) = { + +typedef void (*PCM_CONVERT_KEEP_RATE)(const unsigned char*, int, unsigned char*); + +static const PCM_CONVERT_KEEP_RATE PCM_ConvertKeepRate[16] = { cvtSS88K, cvtSM88K, cvtMS88K, cvtMM88K, cvtSS816K, cvtSM816K, cvtMS816K, cvtMM816K, cvtSS168K, cvtSM168K, cvtMS168K, cvtMM168K, cvtSS1616K, cvtSM1616K, cvtMS1616K, cvtMM1616K, }; -/*********************************************************************** - * I - * - * Interpolate the value at r (r in ]0, 1]) between the two points v1 and v2 - * Linear interpolation is used - */ -static inline double I(double v1, double v2, double r) -{ - if (0.0 >= r || r > 1.0) FIXME("r!! %f\n", r); - return (1.0 - r) * v1 + r * v2; -} - -static void cvtSS88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->last[1].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - *dst++ = I(apd->last[0].b, src[0], r); - *dst++ = I(apd->last[1].b, src[1], r); - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - /* the conversion routines with rate conversion are labelled cvtC * where : * is the (M)ono/(S)tereo configuration of input channel @@ -421,393 +392,321 @@ static void cvtSS88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, * is the number of bits of output channel (8 or 16) * */ -static void cvtSM88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtSS88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->last[1].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - *dst++ = I(M8(apd->last[0].b, apd->last[1].b), M8(src[0], src[1]), r); - else - *dst++ = M8(apd->last[0].b, apd->last[1].b); - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtMS88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - dst[0] = dst[1] = I(apd->last[0].b, src[0], r); - else - dst[0] = dst[1] = apd->last[0].b; - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtMM88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - *dst++ = I(apd->last[0].b, src[0], r); - else - *dst++ = apd->last[0].b; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtSS816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->last[1].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(C816(apd->last[0].b), C816(src[0]), r)); - else - W16(dst, C816(apd->last[0].b)); - dst += 2; - if (*nsrc) /* don't go off end of data */ - W16(dst, I(C816(apd->last[1].b), C816(src[1]), r)); - else - W16(dst, C816(apd->last[1].b)); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtSM816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->last[1].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(M16(C816(apd->last[0].b), C816(apd->last[1].b)), - M16(C816(src[0]), C816(src[1])), r)); - else - W16(dst, M16(C816(apd->last[0].b), C816(apd->last[1].b))); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtMS816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - short v; - TRACE("(%p, %p, %p->(%ld), %p, %p->(%ld))\n", apd, src, nsrc, *nsrc, dst, ndst, *ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - v = I(C816(apd->last[0].b), C816(src[0]), r); - else - v = C816(apd->last[0].b); - W16(dst, v); dst += 2; - W16(dst, v); dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtMM816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(C816(apd->last[0].b), C816(src[0]), r)); - else - W16(dst, C816(apd->last[0].b)); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtSS168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->last[1].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) { /* don't go off end of data */ - *dst++ = C168(I(apd->last[0].s, R16(src) , r)); - *dst++ = C168(I(apd->last[1].s, R16(src+2), r)); - } else { - *dst++ = C168(apd->last[0].s); - *dst++ = C168(apd->last[1].s); + while ((*ndst)--) { + *dst++ = *src; + *dst++ = *src; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; } - apd->dstPos += apd->dstIncr; - (*ndst)--; } } -static void cvtSM168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtSM88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->last[1].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - *dst++ = C168(I(M16(apd->last[0].s, apd->last[1].s), - M16(R16(src), R16(src + 2)), r)); - else - *dst++ = C168(M16(apd->last[0].s, apd->last[1].s)); - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + *dst++ = M8(src[0], src[1]); + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } } } - -static void cvtMS168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtMS88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - dst[0] = dst[1] = C168(I(apd->last[0].s, R16(src), r)); - else - dst[0] = dst[1] = C168(apd->last[0].s); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + *dst++ = *src; + *dst++ = *src; + error = error + srcRate; + while (error > dstRate) { + src++; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } } } - -static void cvtMM168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtMM88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - *dst++ = C168(I(apd->last[0].s, R16(src), r)); - else - *dst++ = C168(apd->last[0].s); - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + *dst++ = *src; + error = error + srcRate; + while (error > dstRate) { + src++; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } } } -static void cvtSS1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtSS816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->last[1].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(apd->last[0].s, R16(src), r)); - else - W16(dst, apd->last[0].s); - dst += 2; - if (*nsrc) /* don't go off end of data */ - W16(dst, I(apd->last[1].s, R16(src+2), r)); - else - W16(dst, apd->last[1].s); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + W16(dst, C816(src[0])); dst += 2; + W16(dst, C816(src[1])); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } } } -static void cvtSM1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtSM816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->last[1].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(M16(apd->last[0].s, apd->last[1].s), - M16(R16(src), R16(src+2)), r)); - else - W16(dst, M16(apd->last[0].s, apd->last[1].s)); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + W16(dst, M16(C816(src[0]), C816(src[1]))); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } } } -static void cvtMS1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtMS816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - short v; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - v = I(apd->last[0].s, R16(src), r); - else - v = apd->last[0].s; - W16(dst, v); dst += 2; - W16(dst, v); dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + W16(dst, C816(*src)); dst += 2; + W16(dst, C816(*src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src++; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } } } -static void cvtMM1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtMM816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(apd->last[0].s, R16(src), r)); - else - W16(dst, apd->last[0].s); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + W16(dst, C816(*src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src++; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } } } -static void (*PCM_ConvertChangeRate[16])(AcmPcmData* apd, - const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) = { +static void cvtSS168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + *dst++ = C168(R16(src)); + *dst++ = C168(R16(src + 2)); + error = error + srcRate; + while (error > dstRate) { + src += 4; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } + } +} + +static void cvtSM168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + *dst++ = C168(M16(R16(src), R16(src + 2))); + error = error + srcRate; + while (error > dstRate) { + src += 4; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } + } +} + +static void cvtMS168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + *dst++ = C168(R16(src)); + *dst++ = C168(R16(src)); + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } + } +} + +static void cvtMM168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + *dst++ = C168(R16(src)); + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +static void cvtSS1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, R16(src)); dst += 2; + W16(dst, R16(src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 4; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +static void cvtSM1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, M16(R16(src), R16(src + 2))); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 4; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +static void cvtMS1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while((*ndst)--) { + W16(dst, R16(src)); dst += 2; + W16(dst, R16(src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +static void cvtMM1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%d, %p, %p, %d, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, R16(src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +typedef void (*PCM_CONVERT_CHANGE_RATE)(DWORD, const unsigned char*, LPDWORD, DWORD, unsigned char*, LPDWORD); + +static const PCM_CONVERT_CHANGE_RATE PCM_ConvertChangeRate[16] = { cvtSS88C, cvtSM88C, cvtMS88C, cvtMM88C, cvtSS816C, cvtSM816C, cvtMS816C, cvtMM816C, cvtSS168C, cvtSM168C, cvtMS168C, cvtMM168C, @@ -851,7 +750,7 @@ static LRESULT PCM_DriverDetails(PACMDRIVERDETAILSW add) */ static LRESULT PCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery) { - TRACE("(%p, %08lx)\n", aftd, dwQuery); + TRACE("(%p, %08x)\n", aftd, dwQuery); switch (dwQuery) { case ACM_FORMATTAGDETAILSF_INDEX: @@ -874,7 +773,7 @@ static LRESULT PCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery) } break; default: - WARN("Unsupported query %08lx\n", dwQuery); + WARN("Unsupported query %08x\n", dwQuery); return MMSYSERR_NOTSUPPORTED; } @@ -894,13 +793,13 @@ static LRESULT PCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery) */ static LRESULT PCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery) { - TRACE("(%p, %08lx)\n", afd, dwQuery); + TRACE("(%p, %08x)\n", afd, dwQuery); switch (dwQuery) { case ACM_FORMATDETAILSF_FORMAT: if (PCM_GetFormatIndex(afd->pwfx) == 0xFFFFFFFF) { - return ACMERR_NOTPOSSIBLE; WARN("not possible\n"); + return ACMERR_NOTPOSSIBLE; } break; case ACM_FORMATDETAILSF_INDEX: @@ -918,7 +817,7 @@ static LRESULT PCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery) afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign; break; default: - WARN("Unsupported query %08lx\n", dwQuery); + WARN("Unsupported query %08x\n", dwQuery); return MMSYSERR_NOTSUPPORTED; } @@ -944,7 +843,7 @@ static LRESULT PCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs) PCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) { WARN("not possible\n"); return ACMERR_NOTPOSSIBLE; - } + } /* is no suggestion for destination, then copy source value */ if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS)) { @@ -976,26 +875,6 @@ static LRESULT PCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs) return MMSYSERR_NOERROR; } -/*********************************************************************** - * PCM_Reset - * - */ -static void PCM_Reset(AcmPcmData* apd, int srcNumBits) -{ - TRACE("(%p, %d)\n", apd, srcNumBits); - - apd->srcPos = 0; - apd->dstPos = 0; - /* initialize with neutral value */ - if (srcNumBits == 16) { - apd->last[0].s = 0; - apd->last[1].s = 0; - } else { - apd->last[0].b = (BYTE)0x80; - apd->last[1].b = (BYTE)0x80; - } -} - /*********************************************************************** * PCM_StreamOpen * @@ -1009,19 +888,13 @@ static LRESULT PCM_StreamOpen(PACMDRVSTREAMINSTANCE adsi) assert(!(adsi->fdwOpen & ACM_STREAMOPENF_ASYNC)); - if (PCM_GetFormatIndex(adsi->pwfxSrc) == 0xFFFFFFFF || - PCM_GetFormatIndex(adsi->pwfxDst) == 0xFFFFFFFF) { - WARN("not possible\n"); - return ACMERR_NOTPOSSIBLE; - } - apd = HeapAlloc(GetProcessHeap(), 0, sizeof(AcmPcmData)); if (apd == 0) { WARN("no memory\n"); return MMSYSERR_NOMEM; } - adsi->dwDriver = (DWORD)apd; + adsi->dwDriver = (DWORD_PTR)apd; adsi->fdwDriver = 0; if (adsi->pwfxSrc->wBitsPerSample == 16) idx += 8; @@ -1033,9 +906,6 @@ static LRESULT PCM_StreamOpen(PACMDRVSTREAMINSTANCE adsi) apd->cvt.cvtKeepRate = PCM_ConvertKeepRate[idx]; } else { adsi->fdwDriver |= PCM_RESAMPLE; - apd->dstIncr = (double)(adsi->pwfxSrc->nSamplesPerSec) / - (double)(adsi->pwfxDst->nSamplesPerSec); - PCM_Reset(apd, adsi->pwfxSrc->wBitsPerSample); apd->cvt.cvtChangeRate = PCM_ConvertChangeRate[idx]; } @@ -1090,7 +960,7 @@ static LRESULT PCM_StreamSize(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMSIZE adss adsi->pwfxSrc->nAvgBytesPerSec) & dstMask; break; default: - WARN("Unsupported query %08lx\n", adss->fdwSize); + WARN("Unsupported query %08x\n", adss->fdwSize); return MMSYSERR_NOTSUPPORTED; } return MMSYSERR_NOERROR; @@ -1108,12 +978,12 @@ static LRESULT PCM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER TRACE("(%p, %p)\n", adsi, adsh); - TRACE("nsrc=%ld,adsh->cbSrcLength=%ld\n", nsrc, adsh->cbSrcLength); - TRACE("ndst=%ld,adsh->cbDstLength=%ld\n", ndst, adsh->cbDstLength); - TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", + TRACE("nsrc=%d,adsh->cbSrcLength=%d\n", nsrc, adsh->cbSrcLength); + TRACE("ndst=%d,adsh->cbDstLength=%d\n", ndst, adsh->cbDstLength); + TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%u, nAvgBytesPerSec=%u, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", adsi->pwfxSrc->wFormatTag, adsi->pwfxSrc->nChannels, adsi->pwfxSrc->nSamplesPerSec, adsi->pwfxSrc->nAvgBytesPerSec, adsi->pwfxSrc->nBlockAlign, adsi->pwfxSrc->wBitsPerSample, adsi->pwfxSrc->cbSize); - TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", + TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%u, nAvgBytesPerSec=%u, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", adsi->pwfxDst->wFormatTag, adsi->pwfxDst->nChannels, adsi->pwfxDst->nSamplesPerSec, adsi->pwfxDst->nAvgBytesPerSec, adsi->pwfxDst->nBlockAlign, adsi->pwfxDst->wBitsPerSample, adsi->pwfxDst->cbSize); @@ -1121,7 +991,7 @@ static LRESULT PCM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER ~(ACM_STREAMCONVERTF_BLOCKALIGN| ACM_STREAMCONVERTF_END| ACM_STREAMCONVERTF_START)) { - FIXME("Unsupported fdwConvert (%08lx), ignoring it\n", adsh->fdwConvert); + FIXME("Unsupported fdwConvert (%08x), ignoring it\n", adsh->fdwConvert); } /* ACM_STREAMCONVERTF_BLOCKALIGN * currently all conversions are block aligned, so do nothing for this flag @@ -1130,15 +1000,14 @@ static LRESULT PCM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER */ if ((adsh->fdwConvert & ACM_STREAMCONVERTF_START) && (adsi->fdwDriver & PCM_RESAMPLE)) { - PCM_Reset(apd, adsi->pwfxSrc->wBitsPerSample); } /* do the job */ if (adsi->fdwDriver & PCM_RESAMPLE) { DWORD nsrc2 = nsrc; DWORD ndst2 = ndst; - - apd->cvt.cvtChangeRate(apd, adsh->pbSrc, &nsrc2, adsh->pbDst, &ndst2); + apd->cvt.cvtChangeRate(adsi->pwfxSrc->nSamplesPerSec, adsh->pbSrc, &nsrc2, + adsi->pwfxDst->nSamplesPerSec, adsh->pbDst, &ndst2); nsrc -= nsrc2; ndst -= ndst2; } else { @@ -1157,11 +1026,11 @@ static LRESULT PCM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER /************************************************************************** * DriverProc (MSACM32.@) */ -LRESULT CALLBACK PCM_DriverProc(DWORD dwDevID, HDRVR hDriv, UINT wMsg, +LRESULT CALLBACK PCM_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, LPARAM dwParam1, LPARAM dwParam2) { - TRACE("(%08lx %08lx %u %08lx %08lx);\n", - dwDevID, (DWORD)hDriv, wMsg, dwParam1, dwParam2); + TRACE("(%08lx %p %u %08lx %08lx);\n", + dwDevID, hDriv, wMsg, dwParam1, dwParam2); switch (wMsg) { case DRV_LOAD: return 1; @@ -1219,5 +1088,4 @@ LRESULT CALLBACK PCM_DriverProc(DWORD dwDevID, HDRVR hDriv, UINT wMsg, default: return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); } - return 0; } diff --git a/reactos/dll/win32/msacm32/stream.c b/reactos/dll/win32/msacm32/stream.c index 5c427ec62d4..10ce79b10fb 100644 --- a/reactos/dll/win32/msacm32/stream.c +++ b/reactos/dll/win32/msacm32/stream.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ /* TODO @@ -35,6 +35,7 @@ #include "winerror.h" #include "wine/debug.h" #include "mmsystem.h" +#define NOBITMAP #include "mmreg.h" #include "msacm.h" #include "msacmdrv.h" @@ -57,13 +58,13 @@ MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose) PWINE_ACMSTREAM was; MMRESULT ret; - TRACE("(%p, %ld)\n", has, fdwClose); + TRACE("(%p, %d)\n", has, fdwClose); if ((was = ACM_GetStream(has)) == NULL) { WARN("invalid handle\n"); return MMSYSERR_INVALHANDLE; } - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CLOSE, (DWORD)&was->drvInst, 0); + ret = MSACM_Message((HACMDRIVER)was->pDrv, ACMDM_STREAM_CLOSE, (LPARAM)&was->drvInst, 0); if (ret == MMSYSERR_NOERROR) { if (was->hAcmDriver) acmDriverClose(was->hAcmDriver, 0L); @@ -83,7 +84,7 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, MMRESULT ret = MMSYSERR_NOERROR; PACMDRVSTREAMHEADER padsh; - TRACE("(%p, %p, %ld)\n", has, pash, fdwConvert); + TRACE("(%p, %p, %d)\n", has, pash, fdwConvert); if ((was = ACM_GetStream(has)) == NULL) { WARN("invalid handle\n"); @@ -98,6 +99,9 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, return ACMERR_UNPREPARED; } + pash->cbSrcLengthUsed = 0; + pash->cbDstLengthUsed = 0; + /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same * size. some fields are private to msacm internals, and are exposed * in ACMSTREAMHEADER in the dwReservedDriver array @@ -115,7 +119,7 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, padsh->fdwConvert = fdwConvert; - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CONVERT, (DWORD)&was->drvInst, (DWORD)padsh); + ret = MSACM_Message((HACMDRIVER)was->pDrv, ACMDM_STREAM_CONVERT, (LPARAM)&was->drvInst, (LPARAM)padsh); if (ret == MMSYSERR_NOERROR) { padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE; } @@ -137,9 +141,10 @@ MMRESULT WINAPI acmStreamMessage(HACMSTREAM has, UINT uMsg, LPARAM lParam1, /*********************************************************************** * acmStreamOpen (MSACM32.@) */ -MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, - PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback, - DWORD dwInstance, DWORD fdwOpen) +MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, + PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, + PWAVEFILTER pwfltr, DWORD_PTR dwCallback, + DWORD_PTR dwInstance, DWORD fdwOpen) { PWINE_ACMSTREAM was; PWINE_ACMDRIVER wad; @@ -148,7 +153,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw int wfxDstSize; WAVEFORMATEX wfxSrc, wfxDst; - TRACE("(%p, %p, %p, %p, %p, %ld, %ld, %ld)\n", + TRACE("(%p, %p, %p, %p, %p, %ld, %ld, %d)\n", phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen); /* NOTE: pwfxSrc and/or pwfxDst can point to a structure smaller than @@ -167,11 +172,11 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw pwfxDst = &wfxDst; } - TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", + TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%u, nAvgBytesPerSec=%u, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec, pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize); - TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", + TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%u, nAvgBytesPerSec=%u, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec, pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize); @@ -227,7 +232,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw was->pDrv = wad; was->hAcmDriver = 0; /* not to close it in acmStreamClose */ - ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); + ret = MSACM_Message((HACMDRIVER)wad, ACMDM_STREAM_OPEN, (LPARAM)&was->drvInst, 0L); if (ret != MMSYSERR_NOERROR) goto errCleanUp; } else { @@ -248,7 +253,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw was->pDrv = wad; was->hAcmDriver = had; - ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); + ret = MSACM_Message((HACMDRIVER)wad, ACMDM_STREAM_OPEN, (LPARAM)&was->drvInst, 0L); TRACE("%s => %08x\n", debugstr_w(wadi->pszDriverAlias), ret); if (ret == MMSYSERR_NOERROR) { if (fdwOpen & ACM_STREAMOPENF_QUERY) { @@ -292,7 +297,7 @@ MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, MMRESULT ret = MMSYSERR_NOERROR; PACMDRVSTREAMHEADER padsh; - TRACE("(%p, %p, %ld)\n", has, pash, fdwPrepare); + TRACE("(%p, %p, %d)\n", has, pash, fdwPrepare); if ((was = ACM_GetStream(has)) == NULL) { WARN("invalid handle\n"); @@ -325,7 +330,7 @@ MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, padsh->pbPreparedDst = 0; padsh->cbPreparedDstLength = 0; - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_PREPARE, (DWORD)&was->drvInst, (DWORD)padsh); + ret = MSACM_Message((HACMDRIVER)was->pDrv, ACMDM_STREAM_PREPARE, (LPARAM)&was->drvInst, (LPARAM)padsh); if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { ret = MMSYSERR_NOERROR; padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE); @@ -356,7 +361,7 @@ MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset) PWINE_ACMSTREAM was; MMRESULT ret = MMSYSERR_NOERROR; - TRACE("(%p, %ld)\n", has, fdwReset); + TRACE("(%p, %d)\n", has, fdwReset); if (fdwReset) { WARN("invalid flag\n"); @@ -365,7 +370,7 @@ MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset) WARN("invalid handle\n"); return MMSYSERR_INVALHANDLE; } else if (was->drvInst.fdwOpen & ACM_STREAMOPENF_ASYNC) { - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_RESET, (DWORD)&was->drvInst, 0); + ret = MSACM_Message((HACMDRIVER)was->pDrv, ACMDM_STREAM_RESET, (LPARAM)&was->drvInst, 0); } TRACE("=> (%d)\n", ret); return ret; @@ -381,7 +386,7 @@ MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, ACMDRVSTREAMSIZE adss; MMRESULT ret; - TRACE("(%p, %ld, %p, %ld)\n", has, cbInput, pdwOutputBytes, fdwSize); + TRACE("(%p, %d, %p, %d)\n", has, cbInput, pdwOutputBytes, fdwSize); if ((was = ACM_GetStream(has)) == NULL) { WARN("invalid handle\n"); @@ -410,8 +415,8 @@ MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, adss.cbStruct = sizeof(adss); adss.fdwSize = fdwSize; - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE, - (DWORD)&was->drvInst, (DWORD)&adss); + ret = MSACM_Message((HACMDRIVER)was->pDrv, ACMDM_STREAM_SIZE, + (LPARAM)&was->drvInst, (LPARAM)&adss); if (ret == MMSYSERR_NOERROR) { switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) { case ACM_STREAMSIZEF_DESTINATION: @@ -422,7 +427,7 @@ MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, break; } } - TRACE("=> (%d) [%lu]\n", ret, *pdwOutputBytes); + TRACE("=> (%d) [%u]\n", ret, *pdwOutputBytes); return ret; } @@ -436,7 +441,7 @@ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, MMRESULT ret = MMSYSERR_NOERROR; PACMDRVSTREAMHEADER padsh; - TRACE("(%p, %p, %ld)\n", has, pash, fdwUnprepare); + TRACE("(%p, %p, %d)\n", has, pash, fdwUnprepare); if ((was = ACM_GetStream(has)) == NULL) { WARN("invalid handle\n"); @@ -468,7 +473,7 @@ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, padsh->fdwConvert = fdwUnprepare; - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_UNPREPARE, (DWORD)&was->drvInst, (DWORD)padsh); + ret = MSACM_Message((HACMDRIVER)was->pDrv, ACMDM_STREAM_UNPREPARE, (LPARAM)&was->drvInst, (LPARAM)padsh); if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { ret = MMSYSERR_NOERROR; padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED); diff --git a/reactos/dll/win32/msacm32/wineacm.h b/reactos/dll/win32/msacm32/wineacm.h index 5244bfb1800..b566e618a6a 100644 --- a/reactos/dll/win32/msacm32/wineacm.h +++ b/reactos/dll/win32/msacm32/wineacm.h @@ -14,275 +14,12 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef __WINE_WINEACM_H #define __WINE_WINEACM_H -#ifndef __REACTOS__ -#include "wine/windef16.h" -//#include "wine/mmsystem16.h" - -/*********************************************************************** - * Win16 definitions - */ -typedef BOOL16 (CALLBACK *ACMDRIVERENUMCB16)( - HACMDRIVERID16 hadid, DWORD dwInstance, DWORD fdwSupport -); -typedef UINT (CALLBACK *ACMFILTERCHOOSEHOOKPROC16)( - HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam -); -typedef UINT16 (CALLBACK *ACMFORMATCHOOSEHOOKPROC16)( - HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam -); - -typedef struct _ACMDRIVERDETAILS16 -{ - DWORD cbStruct; - - FOURCC fccType; - FOURCC fccComp; - - WORD wMid; - WORD wPid; - - DWORD vdwACM; - DWORD vdwDriver; - - DWORD fdwSupport; - DWORD cFormatTags; - DWORD cFilterTags; - - HICON16 hicon; - - CHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS]; - CHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS]; - CHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS]; - CHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS]; - CHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS]; -} ACMDRIVERDETAILS16, *NPACMDRIVERDETAILS16, *LPACMDRIVERDETAILS16; - -typedef struct _ACMFILTERCHOOSE16 -{ - DWORD cbStruct; - DWORD fdwStyle; - - HWND16 hwndOwner; - - LPWAVEFILTER pwfltr; - DWORD cbwfltr; - - LPCSTR pszTitle; - - char szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; - char szFilter[ACMFILTERDETAILS_FILTER_CHARS]; - LPSTR pszName; - DWORD cchName; - - DWORD fdwEnum; - LPWAVEFILTER pwfltrEnum; - - HINSTANCE16 hInstance; - LPCSTR pszTemplateName; - LPARAM lCustData; - ACMFILTERCHOOSEHOOKPROC16 pfnHook; -} ACMFILTERCHOOSE16, *NPACMFILTERCHOOSE16, *LPACMFILTERCHOOSE16; - -typedef struct _ACMFILTERDETAILS16 -{ - DWORD cbStruct; - DWORD dwFilterIndex; - DWORD dwFilterTag; - DWORD fdwSupport; - LPWAVEFILTER pwfltr; - DWORD cbwfltr; - CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS]; -} ACMFILTERDETAILS16, *NPACMFILTERDETAILS16, *LPACMFILTERDETAILS16; - -typedef struct _ACMFILTERTAGDETAILS16 -{ - DWORD cbStruct; - DWORD dwFilterTagIndex; - DWORD dwFilterTag; - DWORD cbFilterSize; - DWORD fdwSupport; - DWORD cStandardFilters; - CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; -} ACMFILTERTAGDETAILS16, *NPACMFILTERTAGDETAILS16, *LPACMFILTERTAGDETAILS16; - -typedef struct _ACMFORMATCHOOSE16 -{ - DWORD cbStruct; - DWORD fdwStyle; - - HWND16 hwndOwner; - - LPWAVEFORMATEX pwfx; - DWORD cbwfx; - LPCSTR pszTitle; - - CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; - CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; - - LPSTR pszName; - DWORD cchName; - - DWORD fdwEnum; - LPWAVEFORMATEX pwfxEnum; - - HINSTANCE16 hInstance; - LPCSTR pszTemplateName; - LPARAM lCustData; - ACMFORMATCHOOSEHOOKPROC16 pfnHook; -} ACMFORMATCHOOSE16, *NPACMFORMATCHOOSE16, *LPACMFORMATCHOOSE16; - -typedef struct _ACMFORMATDETAILS16 -{ - DWORD cbStruct; - DWORD dwFormatIndex; - DWORD dwFormatTag; - DWORD fdwSupport; - LPWAVEFORMATEX pwfx; - DWORD cbwfx; - CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; -} ACMFORMATDETAILS16, *NPACMFORMATDETAILS16, *LPACMFORMATDETAILS16; - -typedef struct _ACMFORMATTAGDETAILS16 -{ - DWORD cbStruct; - DWORD dwFormatTagIndex; - DWORD dwFormatTag; - DWORD cbFormatSize; - DWORD fdwSupport; - DWORD cStandardFormats; - CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; -} ACMFORMATTAGDETAILS16, *NPACMFORMATTAGDETAILS16, *LPACMFORMATTAGDETAILS16; - -typedef ACMSTREAMHEADER ACMSTREAMHEADER16, *NPACMSTREAMHEADER16, *LPACMSTREAMHEADER16; - -typedef BOOL16 (CALLBACK *ACMFILTERENUMCB16)( - HACMDRIVERID16 hadid, LPACMFILTERDETAILS16 pafd, - DWORD dwInstance, DWORD fdwSupport -); - -typedef BOOL16 (CALLBACK *ACMFILTERTAGENUMCB16)( - HACMDRIVERID16 hadid, LPACMFILTERTAGDETAILS16 paftd, - DWORD dwInstance, DWORD fdwSupport -); - -typedef BOOL16 (CALLBACK *ACMFORMATENUMCB16)( - HACMDRIVERID16 hadid, LPACMFORMATDETAILS16 pafd, - DWORD dwInstance, DWORD fdwSupport -); - -typedef BOOL16 (CALLBACK *ACMFORMATTAGENUMCB16)( - HACMDRIVERID16 hadid, LPACMFORMATTAGDETAILS16 paftd, - DWORD dwInstance, DWORD fdwSupport -); - -/*********************************************************************** - * Functions - Win16 - */ - -DWORD WINAPI acmGetVersion16( -); -MMRESULT16 WINAPI acmMetrics16( - HACMOBJ16 hao, UINT16 uMetric, LPVOID pMetric -); -MMRESULT16 WINAPI acmDriverEnum16( - ACMDRIVERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum -); -MMRESULT16 WINAPI acmDriverDetails16( - HACMDRIVERID16 hadid, LPACMDRIVERDETAILS16 padd, DWORD fdwDetails -); -MMRESULT16 WINAPI acmDriverAdd16( - LPHACMDRIVERID16 phadid, HINSTANCE16 hinstModule, - LPARAM lParam, DWORD dwPriority, DWORD fdwAdd -); -MMRESULT16 WINAPI acmDriverRemove16( - HACMDRIVERID16 hadid, DWORD fdwRemove -); -MMRESULT16 WINAPI acmDriverOpen16( - LPHACMDRIVER16 phad, HACMDRIVERID16 hadid, DWORD fdwOpen -); -MMRESULT16 WINAPI acmDriverClose16( - HACMDRIVER16 had, DWORD fdwClose -); -LRESULT WINAPI acmDriverMessage16( - HACMDRIVER16 had, UINT16 uMsg, LPARAM lParam1, LPARAM lParam2 -); -MMRESULT16 WINAPI acmDriverID16( - HACMOBJ16 hao, LPHACMDRIVERID16 phadid, DWORD fdwDriverID -); -MMRESULT16 WINAPI acmDriverPriority16( - HACMDRIVERID16 hadid, DWORD dwPriority, DWORD fdwPriority -); -MMRESULT16 WINAPI acmFormatTagDetails16( - HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, DWORD fdwDetails -); -MMRESULT16 WINAPI acmFormatTagEnum16( - HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, - ACMFORMATTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum -); -MMRESULT16 WINAPI acmFormatChoose16( - LPACMFORMATCHOOSE16 pafmtc -); -MMRESULT16 WINAPI acmFormatDetails16( - HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, DWORD fdwDetails -); -MMRESULT16 WINAPI acmFormatEnum16( - HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, - ACMFORMATENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum -); -MMRESULT16 WINAPI acmFormatSuggest16( - HACMDRIVER16 had, LPWAVEFORMATEX pwfxSrc, - LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest -); -MMRESULT16 WINAPI acmFilterTagDetails16( - HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, DWORD fdwDetails -); -MMRESULT16 WINAPI acmFilterTagEnum16( - HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, - ACMFILTERTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum -); -MMRESULT16 WINAPI acmFilterChoose16( - LPACMFILTERCHOOSE16 pafltrc -); -MMRESULT16 WINAPI acmFilterDetails16( - HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, DWORD fdwDetails -); -MMRESULT16 WINAPI acmFilterEnum16( - HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, - ACMFILTERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum -); -MMRESULT16 WINAPI acmStreamOpen16( - LPHACMSTREAM16 phas, HACMDRIVER16 had, - LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, - LPWAVEFILTER pwfltr, DWORD dwCallback, - DWORD dwInstance, DWORD fdwOpen -); -MMRESULT16 WINAPI acmStreamClose16( - HACMSTREAM16 has, DWORD fdwClose -); -MMRESULT16 WINAPI acmStreamSize16( - HACMSTREAM16 has, DWORD cbInput, - LPDWORD pdwOutputBytes, DWORD fdwSize -); -MMRESULT16 WINAPI acmStreamConvert16( - HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwConvert -); -MMRESULT16 WINAPI acmStreamReset16( - HACMSTREAM16 has, DWORD fdwReset -); -MMRESULT16 WINAPI acmStreamPrepareHeader16( - HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwPrepare -); -MMRESULT16 WINAPI acmStreamUnprepareHeader16( - HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwUnprepare -); -#endif - /*********************************************************************** * Wine specific - Win32 */ @@ -293,6 +30,8 @@ typedef struct _WINE_ACMDRIVER *PWINE_ACMDRIVER; #define WINE_ACMOBJ_DRIVERID 0x5EED0001 #define WINE_ACMOBJ_DRIVER 0x5EED0002 #define WINE_ACMOBJ_STREAM 0x5EED0003 +#define WINE_ACMOBJ_NOTIFYWND 0x5EED0004 +#define WINE_ACMOBJ_LOCALDRIVER 0x5EED0005 typedef struct _WINE_ACMOBJ { @@ -300,10 +39,32 @@ typedef struct _WINE_ACMOBJ PWINE_ACMDRIVERID pACMDriverID; } WINE_ACMOBJ, *PWINE_ACMOBJ; +typedef struct _WINE_ACMLOCALDRIVER * PWINE_ACMLOCALDRIVER; +typedef struct _WINE_ACMLOCALDRIVERINST * PWINE_ACMLOCALDRIVERINST; +typedef struct _WINE_ACMLOCALDRIVER +{ + WINE_ACMOBJ obj; + HMODULE hModule; + DRIVERPROC lpDrvProc; + PWINE_ACMLOCALDRIVERINST pACMInstList; + PWINE_ACMLOCALDRIVER pNextACMLocalDrv; + PWINE_ACMLOCALDRIVER pPrevACMLocalDrv; +} WINE_ACMLOCALDRIVER; + +typedef struct _WINE_ACMLOCALDRIVERINST +{ + PWINE_ACMLOCALDRIVER pLocalDriver; + DWORD dwDriverID; + BOOL bSession; + PWINE_ACMLOCALDRIVERINST pNextACMInst; +} WINE_ACMLOCALDRIVERINST; + typedef struct _WINE_ACMDRIVER { WINE_ACMOBJ obj; HDRVR hDrvr; + PWINE_ACMLOCALDRIVERINST pLocalDrvrInst; + PWINE_ACMDRIVER pNextACMDriver; } WINE_ACMDRIVER; @@ -320,7 +81,7 @@ typedef struct _WINE_ACMDRIVERID WINE_ACMOBJ obj; LPWSTR pszDriverAlias; LPWSTR pszFileName; - HINSTANCE hInstModule; /* NULL if global */ + PWINE_ACMLOCALDRIVER pLocalDriver; /* NULL if global */ PWINE_ACMDRIVER pACMDriverList; PWINE_ACMDRIVERID pNextACMDriverID; PWINE_ACMDRIVERID pPrevACMDriverID; @@ -334,27 +95,54 @@ typedef struct _WINE_ACMDRIVERID }* aFormatTag; } WINE_ACMDRIVERID; +typedef struct _WINE_ACMNOTIFYWND * PWINE_ACMNOTIFYWND; +typedef struct _WINE_ACMNOTIFYWND +{ + WINE_ACMOBJ obj; + HWND hNotifyWnd; /* Window to notify on ACM events: driver add, driver removal, priority change */ + DWORD dwNotifyMsg; /* Notification message to send to window */ + DWORD fdwSupport; + PWINE_ACMNOTIFYWND pNextACMNotifyWnd; + PWINE_ACMNOTIFYWND pPrevACMNotifyWnd; +} WINE_ACMNOTIFYWND; + /* From internal.c */ extern HANDLE MSACM_hHeap; extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID; -extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID; extern PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileName, - HINSTANCE hinstModule); + PWINE_ACMLOCALDRIVER pLocalDriver); extern void MSACM_RegisterAllDrivers(void); extern PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p); extern void MSACM_UnregisterAllDrivers(void); extern PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID); extern PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver); +extern PWINE_ACMNOTIFYWND MSACM_GetNotifyWnd(HACMDRIVERID hDriver); extern PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type); extern MMRESULT MSACM_Message(HACMDRIVER, UINT, LPARAM, LPARAM); -extern BOOL MSACM_FindFormatTagInCache(WINE_ACMDRIVERID*, DWORD, LPDWORD); +extern BOOL MSACM_FindFormatTagInCache(const WINE_ACMDRIVERID*, DWORD, LPDWORD); +extern void MSACM_RePositionDriver(PWINE_ACMDRIVERID, DWORD); +extern void MSACM_WriteCurrentPriorities(void); +extern void MSACM_BroadcastNotification(void); +extern void MSACM_DisableNotifications(void); +extern void MSACM_EnableNotifications(void); +extern PWINE_ACMNOTIFYWND MSACM_RegisterNotificationWindow(HWND hNotifyWnd, DWORD dwNotifyMsg); +extern PWINE_ACMNOTIFYWND MSACM_UnRegisterNotificationWindow(const WINE_ACMNOTIFYWND*); + +extern PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry(LPCWSTR pszRegEntry); + +extern PWINE_ACMLOCALDRIVER MSACM_RegisterLocalDriver(HMODULE hModule, DRIVERPROC lpDriverProc); +extern PWINE_ACMLOCALDRIVERINST MSACM_OpenLocalDriver(PWINE_ACMLOCALDRIVER, LPARAM); +extern LRESULT MSACM_CloseLocalDriver(PWINE_ACMLOCALDRIVERINST); +/* +extern PWINE_ACMLOCALDRIVER MSACM_GetLocalDriver(HACMDRIVER hDriver); +*/ /* From msacm32.c */ extern HINSTANCE MSACM_hInstance32; /* From pcmcnvtr.c */ -LRESULT CALLBACK PCM_DriverProc(DWORD dwDevID, HDRVR hDriv, UINT wMsg, +LRESULT CALLBACK PCM_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, LPARAM dwParam1, LPARAM dwParam2); /* Dialog box templates */