Skip to content

Commit 88cd080

Browse files
make audio loading start at base SER folder
1 parent bed29b4 commit 88cd080

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

Code/MethodSystem/Methods/AudioMethods/LoadAudioMethod.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ public class LoadAudioMethod : SynchronousMethod, IAdditionalDescription, ICanEr
1313
public override string Description => "Loads an audio file into the audio player.";
1414

1515
public string AdditionalDescription =>
16-
"SER is using 'AudioPlayerApi' to manage audio. If the method errors, the logs will be displayed by AudioPlayerApi, not SER.";
16+
"""
17+
SER is using 'AudioPlayerApi' to manage audio. If the method errors, the logs will be displayed by AudioPlayerApi, not SER.
18+
Your .ogg file MUST BE of 48000hz, mono channel and of medium quality - higher quality causes stutters.
19+
""";
1720

1821
public string[] ErrorReasons =>
1922
[
@@ -24,18 +27,24 @@ public class LoadAudioMethod : SynchronousMethod, IAdditionalDescription, ICanEr
2427

2528
public override Argument[] ExpectedArguments { get; } =
2629
[
27-
new TextArgument("file path"),
30+
new TextArgument("file path")
31+
{
32+
Description =
33+
"This path starts at the main SER folder. " +
34+
"If your file is in [.. -> Scripted Events Reloaded -> audio.ogg] path, then the path will be 'audio.ogg'. " +
35+
"If your file is deeper, like [.. -> Scripted Events Reloaded -> subfolder -> audio.ogg], then the path will be 'subfolder/audio.ogg'."
36+
},
2837
new TextArgument("clip name")
2938
{
30-
Description = "You will be using this name to refer to this path."
39+
Description = "This will be the name of the audio clip. Refer to this name when attempting to play audio."
3140
}
3241
];
3342

3443
public override void Execute()
3544
{
3645
if (!AudioClipStorage.LoadClip(
37-
Args.GetText("file path"),
46+
Path.Combine(FileSystem.FileSystem.MainDirPath, Args.GetText("file path")),
3847
Args.GetText("clip name")
39-
)) throw new ScriptRuntimeError(this, "Audio has failed to load. Check the ");
48+
)) throw new ScriptRuntimeError(this, "Audio has failed to load. Check the console for more info.");
4049
}
4150
}

0 commit comments

Comments
 (0)