From b0a50cf34c1646ca943983d7a34c57360ce062c1 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 16 Apr 2001 03:27:16 +0000 Subject: * autoload.cc: Add winmm functions needed by fhandler_dsp.cc. * fhandler_dsp.cc: New file. Implements OSS like /dev/dsp. * include/sys/soundcard.h: New file. User land includes for OSS /dev/dsp. * fhandler.h: Add new class fhandler_dev_dsp and a FH_OSS_DSP definition. * dtable.cc (dtable::build_fhandler): Allow creation of the /dev/dsp device. * path.cc (windows_device_names): Add /dev/dsp into list of device names. * Makefile.in (DLL_OFILES): Add fhandler_dsp.o. --- winsup/cygwin/autoload.cc | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/autoload.cc') diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 831414b6d..8a99ea5d7 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -102,6 +102,8 @@ LoadDLLinitfunc (netapi32) netapi32_handle = h; else if (! netapi32_handle) api_fatal ("could not load netapi32.dll. %d", GetLastError ()); + + InterlockedDecrement (&here); return 0; } @@ -228,19 +230,38 @@ LoadDLLinitfunc (ole32) LoadDLLinitfunc (kernel32) { - extern void wsock_init (); HANDLE h; if ((h = LoadLibrary ("kernel32.dll")) != NULL) kernel32_handle = h; else if (!kernel32_handle) - api_fatal ("could not load wsock32.dll. Is TCP/IP installed?"); + api_fatal ("could not load kernel32.dll, %E"); else return 0; /* Already done by another thread? */ return 0; } +LoadDLLinitfunc (winmm) +{ + HANDLE h; + static NO_COPY LONG here = -1L; + + while (InterlockedIncrement (&here)) + { + InterlockedDecrement (&here); + Sleep (0); + } + + if ((h = LoadLibrary ("winmm.dll")) != NULL) + winmm_handle = h; + else if (! winmm_handle) + api_fatal ("could not load winmm.dll. %d", GetLastError ()); + + InterlockedDecrement (&here); + return 0; +} + static void __stdcall dummy_autoload (void) __attribute__ ((unused)); static void __stdcall dummy_autoload (void) @@ -396,5 +417,16 @@ LoadDLLfunc (CoCreateInstance, 20, ole32) LoadDLLinit (kernel32) LoadDLLfuncEx (SignalObjectAndWait, 16, kernel32, 1) + +LoadDLLinit (winmm) +LoadDLLfuncEx (waveOutGetNumDevs, 0, winmm, 1) +LoadDLLfuncEx (waveOutOpen, 24, winmm, 1) +LoadDLLfuncEx (waveOutReset, 4, winmm, 1) +LoadDLLfuncEx (waveOutClose, 4, winmm, 1) +LoadDLLfuncEx (waveOutGetVolume, 8, winmm, 1) +LoadDLLfuncEx (waveOutSetVolume, 8, winmm, 1) +LoadDLLfuncEx (waveOutUnprepareHeader, 12, winmm, 1) +LoadDLLfuncEx (waveOutPrepareHeader, 12, winmm, 1) +LoadDLLfuncEx (waveOutWrite, 12, winmm, 1) } } -- cgit v1.2.3