26 lines
499 B
Plaintext
26 lines
499 B
Plaintext
// Audio path helpers for reusable modules.
|
|
|
|
// Resolves an audio path with optional extension fallback.
|
|
// Checks exact path first, then ".ogg", then ".wav".
|
|
string resolve_audio_path(const string audioPath) {
|
|
if (audioPath == "") {
|
|
return "";
|
|
}
|
|
|
|
if (file_exists(audioPath)) {
|
|
return audioPath;
|
|
}
|
|
|
|
string oggPath = audioPath + ".ogg";
|
|
if (file_exists(oggPath)) {
|
|
return oggPath;
|
|
}
|
|
|
|
string wavPath = audioPath + ".wav";
|
|
if (file_exists(wavPath)) {
|
|
return wavPath;
|
|
}
|
|
|
|
return "";
|
|
}
|