Skip to content

Commit

Permalink
Feature/5.x/documentation (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
piiertho authored Dec 10, 2024
1 parent 61ecb98 commit 698ccb7
Show file tree
Hide file tree
Showing 9 changed files with 377 additions and 242 deletions.
5 changes: 4 additions & 1 deletion docs/src/doc/user-guide/2-initialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ Range: [0, [FMOD_MAX_CHANNEL_WIDTH](https://www.fmod.com/docs/2.02/api/core-api-
## 3d Settings

- "Doppler Scale": A scaling factor for doppler shift. Default 1.
- "Distance Factor": A factor for converting game distance units to FMOD distance units. Default 1.
- "Distance Factor": A factor for converting game distance units to FMOD distance units. Default 1.
!!! warning
In 2D this value represents pixels, so you should set it to the number of pixel for your world meter (If your world
meter is 64px, set it to 64). In 3D this represents meter, so we recommend to set it to 1.
- "Rolloff Scale": A scaling factor for distance attenuation. When a sound uses a roll-off mode other than
FMOD_3D_CUSTOMROLLOFF and the distance is greater than the sound's minimum distance, the distance is scaled by the
roll-off scale.
Expand Down
126 changes: 0 additions & 126 deletions docs/src/doc/user-guide/3-nodes.md

This file was deleted.

29 changes: 29 additions & 0 deletions docs/src/doc/user-guide/3-using-fmod-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Using FMOD plugin

This documentation provides detailed guidance on how to use the FMOD GDExtension plugin for integrating FMOD into your
Godot projects.

The plugin offers two main approaches for interacting with FMOD:
1. **Using FMOD Nodes**: Predefined nodes that simplify common FMOD tasks.
2. **Using the `FmodServer` API**: A singleton that gives you direct access to FMOD's core and system APIs for more
advanced or customized workflows.

#### Core Component: `FmodServer`
At the heart of the plugin is the `FmodServer` singleton. It serves as a bridge to FMOD's powerful API, allowing you to
control audio behavior programmatically. FMOD nodes are built on top of this singleton, offering higher-level
abstractions for convenience.

## Summary
- Loading banks
- [Using node](4-loading-banks.md#fmodbankloader-node)
- [Using FmodServer](4-loading-banks.md#fmodserver-api)
- Playing events
- [Using node](5-playing-events.md#fmodeventemitter-nodes)
- [Using FmodServer](5-playing-events.md#fmodserver-api)
- Listeners
- [Using node](6-listeners.md#fmod-listener-nodes)
- [Using FmodServer](6-listeners.md#using-fmodserver-api)
- [Playing sounds](7-playing-sounds.md)
- [Other low level examples](8-other-low-level-examples.md)


45 changes: 45 additions & 0 deletions docs/src/doc/user-guide/4-loading-banks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Loading banks

In this guide we'll explore how to load banks within your game.

## FmodBankLoader node

`FmodBankLoader` is in charge of loading banks when entering the scene. You should place it, in the scene hierarchy,
before all other fmod nodes using this bank. Banks are unloaded on exit tree.

Banks are `RefCounted`, so several `FmodBankLoader` can share same banks.

If you want to load your bank when starting game and keep them loaded, use this node and add it as **autoload** node.

You can add banks with fmod project explorer, using the `+` button with bank icon, or manually add a bank using bottom
line edit. You can also remove and re-order banks:
![fmod-bank-image]

!!! warning
Make sure to first place `Master.strings.bank` first, and `Master.bank` in second. Those banks are dependencies needed
by other banks. So if you don't load them first, you won't be able to load other banks.

## FmodServer api

You can also load banks using `FmodServer` api.
For this purpose, you should use `load_bank` method of `FmodServer` singleton.

Here is an example:
```gdscript
var banks := Array()
func _ready():
banks.append(FmodServer.load_bank("res://Master.bank", FmodServer.FMOD_STUDIO_LOAD_BANK_NORMAL))
banks.append(FmodServer.load_bank("res://Master.strings.bank", FmodServer.FMOD_STUDIO_LOAD_BANK_NORMAL))
banks.append(FmodServer.load_bank("res://Music.bank", FmodServer.FMOD_STUDIO_LOAD_BANK_NORMAL))
```

!!! warning
As banks are `RefCounted`, don't forget to store them. Otherwise reference counter will be directly decremented leading
to unload of the bank.

!!! warning
Make sure to first load `Master.strings.bank`, and `Master.bank` in second. Those banks are dependencies needed by other
banks. So if you don't load them first, you won't be able to load other banks.

[fmod-bank-image]: ./assets/fmod-bank.png
Loading

0 comments on commit 698ccb7

Please sign in to comment.