# 4. Platform Details | Windows

## Windows Specific Starter Guide

### SDK Version

FMOD is compiled using the following tools.

- Visual Studio 2019 - version 16.11.0 targeting platform toolset v142.

### Compatibility

FMOD supports the below architectures back to Windows 7.

- x86 - optimized with SSE3.
- x64 - optimized with SSE3 (and AVX if detected at runtime).

### Libraries

The provided libs are import libraries which require the corresponding DLL to be present at runtime. Substitute $ARCH your desired architecture from the 'Compatibility' list above.

The C API of the supplied libraries are compatible with MinGW (C++ ABI not supported). The 64 bit dll can be linked directly. You will need to use the import library libfmod.a and libfmodstudio.a in order to link the 32 bit dlls.

If you encounter issues linking fmod with MinGW, ensure that you are following the GCC linker ordering requirements and the MinGW library search order.

FMOD Core Engine library

- /api/core/lib/$ARCH/fmod_vc.lib - Release binary for production code (requires fmod.dll at runtime).
- /api/core/lib/$ARCH/fmodL_vc.lib - Release binary with logging enabled for development (requires fmodL.dll at runtime).

FMOD Studio Engine library (used in conjunction with core library)

- /api/studio/lib/$ARCH/fmodstudio_vc.lib - Release binary for production code (requires fmodstudio.dll at runtime).
- /api/studio/lib/$ARCH/fmodstudioL_vc.lib - Release binary with logging enabled for development (requires fmodstudioL.dll at runtime).

### COM

Before calling any FMOD functions it is important to ensure COM is initialized. You can achieve this by calling `CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED)` on each thread that will interact with the FMOD API. This is balanced with a call to `CoUninitialize()` when you are completely finished with all calls to FMOD.

If you fail to initialize COM, FMOD will perform this on-demand for you issuing a warning. FMOD will not uninitialize COM in this case so it will be considered a memory leak.

To ensure correct behavior FMOD assumes when using the WASAPI output mode (default for Windows Vista and newer) that you call System::getNumDrivers, System::getDriverInfo and System::init from your UI thread. This ensures that any platform specific dialogs that need to be presented can do so. This recommendation comes from the IAudioClient interface docs on MSDN which state:

> In Windows 8, the first use of IAudioClient to access the audio device should be on the STA thread. Calls from an MTA thread may result in undefined behavior.

### Thread Affinity

All threads will default to FMOD_THREAD_AFFINITY_CORE_ALL, this is recommended due to the wide variety of PC hardware but can be customized with Thread_SetAttributes.

### Thread Priority

The relationship between FMOD platform agnostic thread priority and the platform specific values is as follows:

- FMOD_THREAD_PRIORITY_LOW ~ THREAD_PRIORITY_BELOW_NORMAL
- FMOD_THREAD_PRIORITY_MEDIUM ~ THREAD_PRIORITY_NORMAL
- FMOD_THREAD_PRIORITY_HIGH ~ THREAD_PRIORITY_ABOVE_NORMAL
- FMOD_THREAD_PRIORITY_VERY_HIGH ~ THREAD_PRIORITY_HIGHEST
- FMOD_THREAD_PRIORITY_EXTREME ~ THREAD_PRIORITY_TIME_CRITICAL
- FMOD_THREAD_PRIORITY_CRITICAL ~ THREAD_PRIORITY_TIME_CRITICAL

## Performance Reference

This section is a companion for the CPU Performance white paper and serves as a quick reference of facts targeting this platform.

### Format Choice

Each compression format provided in FMOD has a reason for being included, the below list will detail our recommendations for this platform. Formats listed as primary are considering the best choice, secondary formats should only be considered if the primary doesn't satisfy your requirements.

- Vorbis: Primary format for all sounds.
- FADPCM: Secondary format if Vorbis CPU usage is too high for low spec machines.
- PCM: Not recommended.
- XMA: Unavailable.
- AT9: Unavailable.

### Voice Count

To give developers an idea about the costs of a particular format we provide synthetic benchmark results. These results are based on simple usage of the FMOD Studio API using recommended configuration settings.

#### Settings

- Voice count: 64
- Sample rate: 48KHz
- Speaker mode: Stereo
- DSP block size: 1024 samples

#### Test Device

- CPU: Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
- OS: Microsoft Windows [Version 6.1.7601]

#### Results

- DSP with Vorbis: 6.88% (+/- 0.52%)
- DSP with FADPCM: 3.10% (+/- 0.20%)
- DSP with PCM: 1.59% (+/- 0.24%)
- Update at 60 FPS: 0.82% (+/- 0.05%)