// Win32 multimedia compatibility stubs. This file provides minimal timing and sound API entry points. #include #include #include // Types. typedef unsigned int MMRESULT; typedef void* HWAVEOUT; #define MMSYSERR_NOERROR 0 #define MMSYSERR_NOTSUPPORTED 8 #define WAVERR_STILLPLAYING 33 // WAVEFORMATEX - standard PCM audio format descriptor. typedef struct { unsigned short wFormatTag; unsigned short nChannels; unsigned int nSamplesPerSec; unsigned int nAvgBytesPerSec; unsigned short nBlockAlign; unsigned short wBitsPerSample; unsigned short cbSize; } WAVEFORMATEX; // WAVEHDR - buffer header submitted to waveOutWrite. typedef struct _WAVEHDR { char* lpData; unsigned int dwBufferLength; unsigned int dwBytesRecorded; uintptr_t dwUser; unsigned int dwFlags; unsigned int dwLoops; struct _WAVEHDR* lpNext; uintptr_t reserved; } WAVEHDR; // MMTIME - used by waveOutGetPosition. typedef struct { unsigned int wType; union { unsigned int ms; unsigned int sample; unsigned int cb; unsigned int ticks; } u; } MMTIME; // Timer. __declspec(dllexport) unsigned long timeGetTime(void) { return (unsigned long)(SysGetTick() / 1000u); } // Waveform audio (stubs - no audio hardware at this stage). __declspec(dllexport) MMRESULT waveOutOpen(HWAVEOUT* phwo, unsigned int deviceId, const WAVEFORMATEX* fmt, uintptr_t callback, uintptr_t callbackInstance, unsigned long flags) { (void)deviceId; (void)fmt; (void)callback; (void)callbackInstance; (void)flags; if (phwo) *phwo = (void*)0; return MMSYSERR_NOTSUPPORTED; } // Implements the wave Out Close operation. __declspec(dllexport) MMRESULT waveOutClose(HWAVEOUT hwo) { (void)hwo; return MMSYSERR_NOERROR; } __declspec(dllexport) MMRESULT waveOutPrepareHeader(HWAVEOUT hwo, WAVEHDR* hdr, unsigned int size) { (void)hwo; (void)hdr; (void)size; return MMSYSERR_NOERROR; } __declspec(dllexport) MMRESULT waveOutUnprepareHeader(HWAVEOUT hwo, WAVEHDR* hdr, unsigned int size) { (void)hwo; (void)hdr; (void)size; return MMSYSERR_NOERROR; } // Implements the wave Out Write operation. __declspec(dllexport) MMRESULT waveOutWrite(HWAVEOUT hwo, WAVEHDR* hdr, unsigned int size) { (void)hwo; (void)hdr; (void)size; return MMSYSERR_NOTSUPPORTED; } // Implements the wave Out Pause operation. __declspec(dllexport) MMRESULT waveOutPause(HWAVEOUT hwo) { (void)hwo; return MMSYSERR_NOERROR; } // Implements the wave Out Restart operation. __declspec(dllexport) MMRESULT waveOutRestart(HWAVEOUT hwo) { (void)hwo; return MMSYSERR_NOERROR; } // Implements the wave Out Reset operation. __declspec(dllexport) MMRESULT waveOutReset(HWAVEOUT hwo) { (void)hwo; return MMSYSERR_NOERROR; } // Implements the wave Out Set Volume operation. __declspec(dllexport) MMRESULT waveOutSetVolume(HWAVEOUT hwo, unsigned long volume) { (void)hwo; (void)volume; return MMSYSERR_NOTSUPPORTED; } __declspec(dllexport) MMRESULT waveOutGetPosition(HWAVEOUT hwo, MMTIME* mmt, unsigned int size) { (void)hwo; (void)size; if (mmt) { mmt->wType = 0; mmt->u.ms = 0; } return MMSYSERR_NOERROR; } // Timer resolution control // No hardware timer reprogramming at this stage; pretend success so callers // that wrap their audio/game loop in timeBeginPeriod(1) don't bail out. __declspec(dllexport) MMRESULT timeBeginPeriod(unsigned int uPeriod) { (void)uPeriod; return MMSYSERR_NOERROR; } // Implements the time End Period operation. __declspec(dllexport) MMRESULT timeEndPeriod(unsigned int uPeriod) { (void)uPeriod; return MMSYSERR_NOERROR; }