Post

C++ FMOD Install

Light mode only Dark mode only

This guide will provide step-by-step instructions on how to add the FMOD library to a Visual Studio C++ project. You will learn how to download and set up FMOD, configure Visual Studio to recognize the library, and integrate FMOD into your project for enhanced multimedia capabilities. By the end of this guide, you will be ready to utilize FMOD in your Visual Studio C++ projects.

About FMOD

FMOD is a proprietary sound effects engine and authoring tool for video games and applications. It is able to play and mix sounds of diverse formats on many operating systems. FMOD is used many popular game engines like Unity and Unreal Engine.

Download FMOD

  • Go to the FMOD website https://www.fmod.com/
    • Go to the Sign In and sign up for an account if you don’t have one
    • Go to the Download
Sign-in
  • Download the FMOD Engine for Windows
Download
  • Install the downloaded FMOD Engine file (accepts all defaults)
Installer
  • Create a folder in the Solution directory called “ThirdParty”, if one doesn’t exist
    • ThirdParty will contain libraries from external developers to be used in the project
  • Create a folder in the ThirdParty folder called “fmod”
ThirdParty
  • Navigate to where FMOD was installed on your computer
  • The default location (copy into Windows Explorer):
    1
    
    C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows
    
  • In the api folder, copy the core folder into the ThirdParty\fmod folder
Api Core Api ThirdParty

Add FMOD to the Solution Project(s)

Add FMOD Include Directories

  • Add the directory of the FMOD include folder to the Additional Include Directories.
    • Additional Include Directories is located in C/C++>General.
    • Add $(SolutionDir)ThirdParty\fmod\core\inc
1
$(SolutionDir)ThirdParty\fmod\core\inc
Include

This needs to be done in all Projects in the Solution.

  • Once the directory is added to the list of included directories, the FMOD header can be add to the files.
    • Add the following to a file
      1
      
      #include <fmod.hpp>
      

If the FMOD include directory was properly added, building the project (CTRL+B) will result in no errors.

Add FMOD Library Directories and Library (.lib)

If the Solution contains multiple Projects, the following steps will need to be done for each project. This is because each project needs the path to the FMOD includes and libraries.

Projects

In the Project Properties, make sure that the Configuration is set to All Configurations and Platform is set to All Platforms.

Configurations
  • Add the directory of the FMOD library folder in Project Properties
    • Additional Library Directories is located in Librarian>General or Linker>Input
    • Add $(SolutionDir)ThirdParty\fmod\core\lib\$(PlatformTarget)
1
$(SolutionDir)ThirdParty\fmod\core\lib\$(PlatformTarget)
Library


The fmod_vc.lib only needs to be added on the project that is the application (Game). Do not add it to the library project (Engine). If it is added to both, there will be a warning reported when built.

  • Add the FMOD .lib files that the project needs to function
    • Additional Dependencies is located in Librarian>General or Linker>General
    • Add fmod_vc.lib
1
fmod_vc.lib
Library


If the FMOD library was properly added, building the project (CTRL+B) will result in no errors.

  • Create a folder in the Solution directory called “Build”
    • This step might have already been done previously
    • The Build folder will contain the FMOD dll (dynamic link library) files.
Build
  • Copy the fmod.dll file from the ThirdParty\fmod\core\lib\x64 directory to the Build folder.
    • The project is a x64 project (64-bit application).
DLL DLL


The next step might have already been completed in a previous guide.

  • Set the Working Directory that the project will be run from in Project Properties
    • Working Directory is located in Debugging
    • Add $(SolutionDir)Build
1
$(SolutionDir)Build
Working


If FMOD was properly added, building and running the project will result in no errors.

Create FMOD System

  • A sound (.wav) file will need to be added to the Build folder to work. For this example a sound file “test.wav” was added. Any available sound file can be used.
Wav
  • You can download this file if needed: test.wav

  • In main() add the following code to create the audio system (place where the engine systems are created):
    1
    2
    3
    4
    5
    6
    
      // create audio system
      FMOD::System* audio;
      FMOD::System_Create(&audio);
    
      void* extradriverdata = nullptr;
      audio->init(32, FMOD_INIT_NORMAL, extradriverdata);
    
  • In main() add the following code to load and play a sound (place before the main loop):
    1
    2
    3
    4
    
      FMOD::Sound* sound = nullptr;
      audio->createSound("test.wav", FMOD_DEFAULT, 0, &sound);
    
      audio->playSound(sound, 0, false, nullptr);
    
  • In main() inside the main loop add the following to update FMOD:
    1
    
      audio->update();
    

Build and run the Solution and the “test.wav” will be played at startup.

This post is licensed under CC BY 4.0 by the author.