Skip to content

Commit

Permalink
[Scripts] C_SFX and C_SNDSYS_CFG class articles (#140)
Browse files Browse the repository at this point in the history
* [Scripts] C_SFX class article

* [Scripts] C_SNDSYS_CFG class article
  • Loading branch information
muczc1wek authored Oct 15, 2024
1 parent 9873e55 commit eaea536
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 0 deletions.
71 changes: 71 additions & 0 deletions docs/zengin/scripts/classes/c_sfx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: C_SFX
---

# C_SFX Daedalus class

Class `C_SFX` defines sound effects of the game.

## Class definition

Class definition as it is defined in [`Scripts/System/_intern/SFX.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/SFX.d#L30-L41) script file.

??? "C_Sfx Daedalus class"
```dae
CLASS C_SFX
{
VAR string file; // Sound file in `.wav` format
VAR int pitchOff; // Pitch offset in semitones
VAR int pitchVar; // Semitone variance
VAR int vol; // Sound volume
VAR int loop; // Enable looping
VAR int loopStartOffset; // Loop start offset
VAR int loopEndOffset; // Loop end offset
VAR float reverbLevel; // Reverb level
VAR string pfxName; // Particle effect name
};
```

## Class members

| Variable | Type | Description |
|---------------------|--------|---------------------------------------|
| [file](#file) | string | Sound file in `.wav` format |
| [pitchOff](#pitchoff) | int | Pitch offset in semitones |
| [pitchVar](#pitchvar) | int | Semitone variance |
| [vol](#vol) | int | Sound volume |
| [loop](#loop) | int | Enable looping |
| [loopStartOffset](#loopstartoffset) | int | Loop start offset |
| [loopEndOffset](#loopendoffset) | int | Loop end offset |
| [reverbLevel](#reverblevel) | float | Reverb level |
| [pfxName](#pfxname) | string | Particle effect name |

## Class member overview

### file
This variable holds the name of the sound file in `.wav` format. It is used to specify which sound effect should be played. The file must be located in the `_work/Data/Sound/SFX/` directory, so the game can access it.

### pitchOff
The `pitchOff` variable sets the pitch offset in semitones. This allows you to adjust the pitch of the sound effect up or down, providing flexibility in how the sound is perceived in the game.

### pitchVar
`pitchVar` defines the semitone variance for the sound effect.

### vol
This variable controls the sound volume.

### loop
The `loop` variable enables or disables looping of the sound effect. When set to true, the sound will continuously repeat, which is useful for background sounds or ambient effects like fire or wind.

### loopStartOffset
`loopStartOffset` specifies the point in the sound file where looping should start. This allows for more precise control over which part of the sound effect is repeated.

### loopEndOffset
Similar to `loopStartOffset`, `loopEndOffset` defines where the looping should end. Together, these two variables allow you to create seamless loops by specifying the exact segment of the sound file to be repeated.

### reverbLevel
The `reverbLevel` variable sets the level of reverb applied to the sound effect.

### pfxName
This variable holds the name of the particle effect associated with the sound.

71 changes: 71 additions & 0 deletions docs/zengin/scripts/classes/c_sndsys_cfg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: C_SNDSYS_CFG
---

# C_SNDSYS_CFG Daedalus class
Class `C_SndSys_CFG` defines the global settings for the game's sounds.

An instance of this class is declared only once.
## Class definition
Class definition as it is defined in [`Scripts/System/_intern/SFX.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/SFX.d#L19-L27) script file.

??? "C_SndSys_CFG Daedalus class"
```dae
class C_SNDSYS_CFG
{
VAR FLOAT volume; // Sound volume
VAR INT bitResolution; // Sound quality
VAR INT sampleRate; // Frequency
VAR INT useStereo; // Stereo sound
VAR INT numSFXChannels; // Number of sound channels
VAR STRING used3DProviderName; // Name of the 3D sound provider
};
```
## Class members

| Variable | Type | Description |
|---------------------------------------------|--------|--------------------------------------------------------------|
| [volume](#volume) | float | Overall sound volume |
| [bitResolution](#bitresolution) | int | Sound quality |
| [sampleRate](#samplerate) | int | Frequency |
| [useStereo](#usestereo) | int | Stereo sound |
| [numSFXChannels](#numsfxchannels) | int | Number of sound channels |
| [used3DProviderName](#used3dprovidername) | string | Name of the 3D sound provider |

## Class member overview
Description of the class member variables.
### volume
The overall volume of the background music (soundtrack). This value ranges from 0.0 to 1.0, where 0.0 is completely muted and 1.0 is the maximum volume.

### bitResolution
Defines the sound quality in terms of bit depth. It can be either 8-bit or 16-bit, with 16-bit providing higher audio fidelity.

### sampleRate
Specifies the frequency at which the sound is sampled. This value ranges from 11050 Hz to 44100 Hz, with higher values offering better sound quality.

### useStereo
A flag indicating whether stereo sound is enabled. A value of 1 means stereo sound is used, while 0 means mono sound.

### numSFXChannels
Determines the number of sound effect channels available. This value ranges from 1 to 32, allowing for multiple sound effects to be played simultaneously.

### reverbBufferSize
Specifies the size of the reverb buffer, which affects the quality and duration of the reverb effect in the game's audio.

### used3DProviderName
Name of the 3D sound provider. One of the constants defined in [`Scripts/System/_intern/SFX.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/SFX.d#L4-L15).

```dae
CONST STRING PROV_DOLBY_SURR = "Dolby Surround";
CONST STRING PROV_A3D = "Aureal A3D Interactive(TM)";
CONST STRING PROV_D3D_HW = "DirectSound3D Hardware Support";
CONST STRING PROV_D3D_SW = "DirectSound3D Software Emulation";
CONST STRING PROV_D3D_EAX = "DirectSound3D with Creative Labs EAX(TM)";
CONST STRING PROV_D3D7_FULL_HRTF = "DirectSound3D 7+ Software - Full HRTF";
CONST STRING PROV_D3D7_LIGHT_HRTF = "DirectSound3D 7+ Software - Light HRTF";
CONST STRING PROV_D3D7_PAN = "DirectSound3D 7+ Software - Pan and Volume";
CONST STRING PROV_EAX = "Creative Labs EAX (TM)";
CONST STRING PROV_EAX2 = "Creative Labs EAX 2 (TM)";
CONST STRING PROV_MILES_2D = "Miles Fast 2D Positional Audio";
CONST STRING PROV_RSX = "RAD Game Tools RSX 3D Audio";
```

0 comments on commit eaea536

Please sign in to comment.