Git Product home page Git Product logo

fmod-studio-typescript-types's Introduction

FMOD Studio TypeScript Definitions

This is a TypeScript definition file for the HTML5 version of FMOD Studio (version 2.01.07), which allows the benefits of static type checking and autocompletion for work in fmodstudio.js and TypeScript.

For anyone new to the FMOD Studio API in HTML5 or TypeScript, here is a starter tutorial.

Usage

Download the index.d.ts from this repository and drop it where fmodstudio.js is located in your project. Double-check that it is included in your tsconfig.json file. Once it is, the FMOD types should be recognized globally.

Annotate the type of the FMOD object instance

const fmod: FMOD = {};

Note: Do not name your FMOD object 'FMOD' since it will clash with the FMOD namespace type definitions.

Assert out-values to their corresponding types.

let outval: any = {};
fmod.Studio_System_Create(outval);
const studioSystem = outval.val as FMOD.StudioSystem;

FMOD Constants

FMOD constant bit flags have been converted to TypeScript constant enums, so what would normally be:

let flag = fmod.STUDIO_EVENT_CALLBACK_TYPE_TIMELINE_BEAT;

...is now

let flag = FMOD.STUDIO_EVENT_CALLBACK_TYPE.TIMELINE_BEAT;

This allows these enums to serve as static types in TypeScript, while the compiler will convert them to the appropriate number in JavaScript.

Turn Strict Type Checking Off (temporarily)

A good amount of FMOD type definitions still contain implicit 'any' as its type. As long as this is the case, the TypeScript compiler will throw errors if 'strict' in 'compilerOptions' is set to true in tsconfig.json. Please set this to false for the meantime until the types have been completed.

fmod-studio-typescript-types's People

Contributors

tadashibashi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.