Skip to content

Commit

Permalink
Add v5 audio function pages
Browse files Browse the repository at this point in the history
  • Loading branch information
MegAmi24 committed Oct 2, 2024
1 parent 1138873 commit 5985d9d
Show file tree
Hide file tree
Showing 19 changed files with 526 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/RSDKv3/Functions/Audio/SetMusicTrack.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# SetMusicTrack <small>(RSDKv3)</small>

## Description
Loads a music file in the given track slot with the given loop point. The music file must be in OGG format.
Loads a music file in the given track slot with the given loop point.

## Parameters
`Path`

: The file path to load the music file from, relative to `Data/Music/`.
: The file path to load the music file from, relative to `Data/Music/`. The music file must be in OGG format.

`TrackID`

Expand Down
2 changes: 1 addition & 1 deletion docs/RSDKv3/Functions/Audio/SetSfxAttributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Sets the loop count and panning of the given sound effect slot in the GameConfig
## Parameters
`SFX`

: The slot of the sound effect in the GameConfig.
: The slot of the sound effect in the GameConfig to set the values for.

`LoopCount`

Expand Down
4 changes: 2 additions & 2 deletions docs/RSDKv4/Functions/Audio/SetMusicTrack.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# SetMusicTrack <small>(RSDKv4)</small>

## Description
Loads a music file in the given track slot with the given loop point. The music file must be in OGG format.
Loads a music file in the given track slot with the given loop point.

## Parameters
`path`

: The file path to load the music file from, relative to `Data/Music/`.
: The file path to load the music file from, relative to `Data/Music/`. The music file must be in OGG format.

`trackID`

Expand Down
2 changes: 1 addition & 1 deletion docs/RSDKv4/Functions/Audio/SetSfxAttributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Sets the loop count and panning of the given sound effect to the given values.
## Parameters
`sfx`

: The slot of the sound effect. It's recommended to the `SfxName` alias for this.
: The slot of the sound effect to set the values for. It's recommended to the `SfxName` alias for this.

`loopCount`

Expand Down
4 changes: 2 additions & 2 deletions docs/RSDKv4/Functions/Audio/SwapMusicTrack.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# SwapMusicTrack

## Description
Loads a music file in the given track slot with the given loop point. If the track slot that's currently playing is the one that's been overwritten, the new song will automatically play at a position based on the given ratio of the current track's position. The music file must be in OGG format.
Loads a music file in the given track slot with the given loop point. If the track slot that's currently playing is the one that's been overwritten, the new song will automatically play at a position based on the given ratio of the current track's position.

## Parameters
`path`

: The file path to load the music file from, relative to `Data/Music/`.
: The file path to load the music file from, relative to `Data/Music/`. The music file must be in OGG format.

`trackID`

Expand Down
38 changes: 38 additions & 0 deletions docs/RSDKv5/Functions/Audio/ChannelActive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ChannelActive

## Description
Checks if a channel is currently playing audio or is paused.

## Parameters
`channel`

: The ID of the channel to check.

## Return Value
Returns the result of the check as a `bool32`. The result will be `false` if the channel is in an idle state; otherwise, it will be `true`.

## Syntax
=== "C"

``` c
RSDK.ChannelActive(uint32 channel);
```

=== "C++"

``` cpp
channels[uint8 channel].IsActive();
```

## Example
=== "C"

``` c
bool32 isActive = RSDK.ChannelActive(0);
```

=== "C++"

``` cpp
bool32 isActive = channels[0].IsActive();
```
38 changes: 38 additions & 0 deletions docs/RSDKv5/Functions/Audio/GetChannelPos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# GetChannelPos

## Description
Gets the position of the current track in the given channel.

## Parameters
`channel`

: The ID of the channel to check.

## Return Value
Returns the current position of the channel's track, in samples, as a `uint32`.

## Syntax
=== "C"

``` c
RSDK.GetChannelPos(uint32 channel);
```

=== "C++"

``` cpp
channels[uint8 channel].AudioPos();
```

## Example
=== "C"

``` c
uint32 trackPos = RSDK.GetChannelPos(0);
```

=== "C++"

``` cpp
uint32 trackPos = channels[0].AudioPos();
```
38 changes: 38 additions & 0 deletions docs/RSDKv5/Functions/Audio/GetSfx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# GetSfx

## Description
Retrieves the ID of the given sound effect.

## Parameters
`sfxPath`

: The path of the sound effect. SFX must be defined in the GameConfig/StageConfig in order to be valid.

## Return Value
Returns the ID of the sound effect as a `uint16`. The return value will be `-1` if the sound effect is invalid.

## Syntax
=== "C"

``` c
RSDK.GetSfx(const char *sfxName);
```

=== "C++"

``` cpp
SoundFX.Get(const char *sfxName);
```

## Example
=== "C"

``` c
MyObject->mySfx = RSDK.GetSfx("Global/SoundFX.wav");
```

=== "C++"

``` cpp
sVars->mySfx.Get("Global/SoundFX.wav");
```
38 changes: 38 additions & 0 deletions docs/RSDKv5/Functions/Audio/PauseChannel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# PauseChannel

## Description
Pauses the currently playing audio in the given channel, if any is playing. The channel can be resumed with [ResumeChannel()](ResumeChannel.md).

## Parameters
`channel`

: The ID of the channel to pause.

## Return Value
None.

## Syntax
=== "C"

``` c
RSDK.PauseChannel(uint32 channel);
```

=== "C++"

``` cpp
channels[uint8 channel].Pause();
```

## Example
=== "C"

``` c
RSDK.PauseChannel(0);
```

=== "C++"

``` cpp
channels[0].Pause();
```
52 changes: 52 additions & 0 deletions docs/RSDKv5/Functions/Audio/PlaySfx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# PlaySfx <small>(RSDKv5)</small>

## Description
Plays the sound effect in the given slot, looping it if a loop point is set.

## Parameters
`sfx`

: The slot of the sound effect.

`loopPoint`

: The sound effect's loop point, in samples. `0` will disable looping, `1` will loop from the beginning of the sound effect, and anything else is the sample to loop from.

`priority`

: The priority of the sound effect.

## Return Value
Returns the ID of the channel the sound effect plays in as an `int32`. The return value will be `-1` if the sound effect failed to play.

## Syntax
=== "C"

``` c
RSDK.PlaySfx(uint16 sfx, uint32 loopPoint, uint32 priority);
```

=== "C++"

``` cpp
SoundFX.Play(uint32 loopPoint, uint32 priority);
```
``` cpp
SoundFX.Play(); // loopPoint and priority default to 0 and 0xFF, respectively
```

## Example
=== "C"

``` c
RSDK.PlaySfx(MyObject->mySfx, 0, 0xFF);
```

=== "C++"

``` cpp
sVars->mySfx.Play(0, 0xFF);
```
``` cpp
sVars->mySfx.Play();
```
54 changes: 54 additions & 0 deletions docs/RSDKv5/Functions/Audio/PlayStream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# PlayStream

## Description
Plays the given music file, looping it if set to do so.

## Parameters
`filename`

: The file path to load the music file from, relative to `Data/Music/`. The music file must be in OGG format.

`id`

: The ID of the channel to play the track in. If the given number is `16` or higher, the channel will be automatically chosen.

`startPos`

: The point of the track to start at, in samples. `0` will play the track from the beginning.

`loopPoint`

: The track's loop point, in samples. `0` will disable looping, `1` will loop from the beginning of the track, and anything else is the sample to loop from.

`loadASync`

: If true, loads the track asynchronously. This should usually be `true`, unless the track is for a video/image, in which case it should be `false`.

## Return Value
Returns the ID of the channel the track plays in as an `int32`. The return value will be `-1` if the track failed to play.

## Syntax
=== "C"

``` c
RSDK.PlayStream(const char *filename, uint32 slot, uint32 startPos, uint32 loopPoint, bool32 loadASync);
```

=== "C++"

``` cpp
channels[uint8 slot].PlayStream(const char *filename, uint32 startPos, uint32 loopPoint, bool32 loadASync);
```

## Example
=== "C"

``` c
RSDK.PlayStream("Test.ogg", 0, 0, 0, true);
```

=== "C++"

``` cpp
channels[0].PlayStream("Test.ogg", 0, 0, true);
```
38 changes: 38 additions & 0 deletions docs/RSDKv5/Functions/Audio/ResumeChannel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ResumeChannel

## Description
If the given channel's audio has been paused with [PauseChannel()](PauseChannel.md), resumes playing the audio.

## Parameters
`channel`

: The ID of the channel to resume.

## Return Value
None.

## Syntax
=== "C"

``` c
RSDK.ResumeChannel(uint32 channel);
```

=== "C++"

``` cpp
channels[uint8 channel].Resume();
```

## Example
=== "C"

``` c
RSDK.ResumeChannel(0);
```

=== "C++"

``` cpp
channels[0].Resume();
```
Loading

0 comments on commit 5985d9d

Please sign in to comment.