Skip to content

Commit dc98bfb

Browse files
committed
Add a prefix for extension functions in the examples
For when static linking, to avoid duplicate symbols.
1 parent f3ad971 commit dc98bfb

11 files changed

Lines changed: 395 additions & 395 deletions

File tree

examples/alconvolve.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,16 @@ static ALuint CreateEffect(void)
252252
printf("Using Convolution\n");
253253

254254
/* Create the effect object and set the convolution effect type. */
255-
alGenEffects(1, &effect);
256-
alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_CONVOLUTION_SOFT);
255+
palGenEffects(1, &effect);
256+
palEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_CONVOLUTION_SOFT);
257257

258258
/* Check if an error occurred, and clean up if so. */
259259
err = alGetError();
260260
if(err != AL_NO_ERROR)
261261
{
262262
fprintf(stderr, "OpenAL error: %s\n", alGetString(err));
263-
if(alIsEffect(effect))
264-
alDeleteEffects(1, &effect);
263+
if(palIsEffect(effect))
264+
palDeleteEffects(1, &effect);
265265
return 0;
266266
}
267267

@@ -417,7 +417,7 @@ int main(int argc, char **argv)
417417
ir_buffer = LoadSound(argv[0]);
418418
if(!ir_buffer)
419419
{
420-
alDeleteEffects(1, &effect);
420+
palDeleteEffects(1, &effect);
421421
CloseAL();
422422
return 1;
423423
}
@@ -426,7 +426,7 @@ int main(int argc, char **argv)
426426
* that connect to it.
427427
*/
428428
slot = 0;
429-
alGenAuxiliaryEffectSlots(1, &slot);
429+
palGenAuxiliaryEffectSlots(1, &slot);
430430

431431
/* Set the impulse response sound buffer on the effect slot. This allows
432432
* effects to access it as needed. In this case, convolution uses it as the
@@ -445,16 +445,16 @@ int main(int argc, char **argv)
445445
* listener. You can use a send filter to alter a given source's
446446
* contribution to reverb.
447447
*/
448-
alAuxiliaryEffectSloti(slot, AL_BUFFER, (ALint)ir_buffer);
449-
alAuxiliaryEffectSlotf(slot, AL_EFFECTSLOT_GAIN, 1.0f / 16.0f);
450-
alAuxiliaryEffectSloti(slot, AL_EFFECTSLOT_EFFECT, (ALint)effect);
448+
palAuxiliaryEffectSloti(slot, AL_BUFFER, (ALint)ir_buffer);
449+
palAuxiliaryEffectSlotf(slot, AL_EFFECTSLOT_GAIN, 1.0f / 16.0f);
450+
palAuxiliaryEffectSloti(slot, AL_EFFECTSLOT_EFFECT, (ALint)effect);
451451
assert(alGetError()==AL_NO_ERROR && "Failed to set effect slot");
452452

453453
/* Create a filter that can silence the dry path. */
454454
filter = 0;
455-
alGenFilters(1, &filter);
456-
alFilteri(filter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
457-
alFilterf(filter, AL_LOWPASS_GAIN, 0.0f);
455+
palGenFilters(1, &filter);
456+
palFilteri(filter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
457+
palFilterf(filter, AL_LOWPASS_GAIN, 0.0f);
458458

459459
player = NewPlayer();
460460
/* Connect the player's source to the effect slot. */
@@ -511,9 +511,9 @@ int main(int argc, char **argv)
511511
DeletePlayer(player);
512512
player = NULL;
513513

514-
alDeleteAuxiliaryEffectSlots(1, &slot);
515-
alDeleteEffects(1, &effect);
516-
alDeleteFilters(1, &filter);
514+
palDeleteAuxiliaryEffectSlots(1, &slot);
515+
palDeleteEffects(1, &effect);
516+
palDeleteFilters(1, &filter);
517517
alDeleteBuffers(1, &ir_buffer);
518518

519519
CloseAL();

examples/aldebug.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ auto main(std::span<std::string_view> args) -> int
167167
LoadALExtensions();
168168

169169
/* Enable low-severity debug messages, which are disabled by default. */
170-
alDebugMessageControlEXT(AL_DONT_CARE_EXT, AL_DONT_CARE_EXT, AL_DEBUG_SEVERITY_LOW_EXT, 0,
170+
palDebugMessageControlEXT(AL_DONT_CARE_EXT, AL_DONT_CARE_EXT, AL_DEBUG_SEVERITY_LOW_EXT, 0,
171171
nullptr, AL_TRUE);
172172

173173
fmt::println("Context flags: {:#010x}", as_unsigned(alGetInteger(AL_CONTEXT_FLAGS_EXT)));
@@ -206,7 +206,7 @@ auto main(std::span<std::string_view> args) -> int
206206
auto msglength = ALsizei{};
207207

208208
/* Getting the message removes it from the log. */
209-
const auto read = alGetDebugMessageLogEXT(1, maxloglength, &source, &type, &id, &severity,
209+
const auto read = palGetDebugMessageLogEXT(1, maxloglength, &source, &type, &id, &severity,
210210
&msglength, message.data());
211211
if(read != 1)
212212
{
@@ -250,7 +250,7 @@ auto main(std::span<std::string_view> args) -> int
250250
" Message: \"{}\"", GetDebugSourceName(source), GetDebugTypeName(type), id,
251251
GetDebugSeverityName(severity), msgstr);
252252
};
253-
alDebugMessageCallbackEXT(debug_callback, nullptr);
253+
palDebugMessageCallbackEXT(debug_callback, nullptr);
254254

255255
if(const auto numlogs = alGetInteger(AL_DEBUG_LOGGED_MESSAGES_EXT))
256256
fmt::println(std::cerr, "{} left over logged message{}!", numlogs, (numlogs==1)?"":"s");
@@ -271,19 +271,19 @@ auto main(std::span<std::string_view> args) -> int
271271
fmt::println("");
272272

273273
fmt::println("Pushing a debug group, making some invalid calls, and popping the debug group...");
274-
alPushDebugGroupEXT(AL_DEBUG_SOURCE_APPLICATION_EXT, 0, -1, "Error test group");
274+
palPushDebugGroupEXT(AL_DEBUG_SOURCE_APPLICATION_EXT, 0, -1, "Error test group");
275275
alSpeedOfSound(0.0f);
276276
/* Can't set the label of the null buffer. */
277-
alObjectLabelEXT(AL_BUFFER, 0, -1, "The null buffer");
278-
alPopDebugGroupEXT();
277+
palObjectLabelEXT(AL_BUFFER, 0, -1, "The null buffer");
278+
palPopDebugGroupEXT();
279279
fmt::println("");
280280

281281
/* All done, insert a custom message and unset the callback. The context
282282
* and device will clean themselves up.
283283
*/
284-
alDebugMessageInsertEXT(AL_DEBUG_SOURCE_APPLICATION_EXT, AL_DEBUG_TYPE_MARKER_EXT, 0,
284+
palDebugMessageInsertEXT(AL_DEBUG_SOURCE_APPLICATION_EXT, AL_DEBUG_TYPE_MARKER_EXT, 0,
285285
AL_DEBUG_SEVERITY_NOTIFICATION_EXT, -1, "End of run, cleaning up");
286-
alDebugMessageCallbackEXT(nullptr, nullptr);
286+
palDebugMessageCallbackEXT(nullptr, nullptr);
287287

288288
return 0;
289289
}

examples/alffplay.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ auto AudioState::getClockNoLock() const -> nanoseconds
588588
* source offset.
589589
*/
590590
auto offset = std::array<ALint64SOFT,2>{};
591-
if(alGetSourcei64vSOFT)
592-
alGetSourcei64vSOFT(mSource, AL_SAMPLE_OFFSET_LATENCY_SOFT, offset.data());
591+
if(palGetSourcei64vSOFT)
592+
palGetSourcei64vSOFT(mSource, AL_SAMPLE_OFFSET_LATENCY_SOFT, offset.data());
593593
else
594594
{
595595
auto ioffset = ALint{};
@@ -646,8 +646,8 @@ auto AudioState::getClockNoLock() const -> nanoseconds
646646
if(mSource)
647647
{
648648
auto offset = std::array<ALint64SOFT,2>{};
649-
if(alGetSourcei64vSOFT)
650-
alGetSourcei64vSOFT(mSource, AL_SAMPLE_OFFSET_LATENCY_SOFT, offset.data());
649+
if(palGetSourcei64vSOFT)
650+
palGetSourcei64vSOFT(mSource, AL_SAMPLE_OFFSET_LATENCY_SOFT, offset.data());
651651
else
652652
{
653653
auto ioffset = ALint{};
@@ -968,7 +968,7 @@ void AudioState::handler()
968968
auto srclock = std::unique_lock{mSrcMutex, std::defer_lock};
969969
auto sleep_time = milliseconds{AudioBufferTime / 2};
970970

971-
if(alEventControlSOFT)
971+
if(palEventControlSOFT)
972972
{
973973
static constexpr auto callback = [](ALenum eventType, ALuint object, ALuint param,
974974
ALsizei length, const ALchar *message, void *userParam) noexcept -> void
@@ -977,16 +977,16 @@ void AudioState::handler()
977977
std::string_view{message, gsl::narrow_cast<ALuint>(length)});
978978
};
979979

980-
alEventControlSOFT(evt_types.size(), evt_types.data(), AL_TRUE);
981-
alEventCallbackSOFT(callback, this);
980+
palEventControlSOFT(evt_types.size(), evt_types.data(), AL_TRUE);
981+
palEventCallbackSOFT(callback, this);
982982
sleep_time = AudioBufferTotalTime;
983983
}
984984
const auto _ = gsl::finally([]
985985
{
986-
if(alEventControlSOFT)
986+
if(palEventControlSOFT)
987987
{
988-
alEventControlSOFT(evt_types.size(), evt_types.data(), AL_FALSE);
989-
alEventCallbackSOFT(nullptr, nullptr);
988+
palEventControlSOFT(evt_types.size(), evt_types.data(), AL_FALSE);
989+
palEventCallbackSOFT(nullptr, nullptr);
990990
}
991991
});
992992

@@ -1338,32 +1338,32 @@ void AudioState::handler()
13381338
{
13391339
/* Filter to mute the dry (un-corrected) path. */
13401340
auto mutefilter = ALuint{};
1341-
alGenFilters(1, &mutefilter);
1342-
alFilteri(mutefilter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
1343-
alFilterf(mutefilter, AL_LOWPASS_GAIN, 0.0f);
1341+
palGenFilters(1, &mutefilter);
1342+
palFilteri(mutefilter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
1343+
palFilterf(mutefilter, AL_LOWPASS_GAIN, 0.0f);
13441344

13451345
alSourcef(mSource, AL_PITCH, TimeStretchFactor);
13461346
alSourcei(mSource, AL_DIRECT_FILTER, static_cast<ALint>(mutefilter));
13471347
alSource3i(mSource, AL_AUXILIARY_SEND_FILTER, static_cast<ALint>(sPShiftSlot), 0,
13481348
AL_FILTER_NULL);
13491349

1350-
alDeleteFilters(1, &mutefilter);
1350+
palDeleteFilters(1, &mutefilter);
13511351
}
13521352

13531353
if(alGetError() != AL_NO_ERROR)
13541354
return;
13551355

13561356
auto samples = std::vector<uint8_t>{};
13571357
auto callback_ok = false;
1358-
if(alBufferCallbackSOFT)
1358+
if(palBufferCallbackSOFT)
13591359
{
13601360
static constexpr auto callback = [](void *userptr, void *data, ALsizei size) noexcept
13611361
-> ALsizei
13621362
{
13631363
return static_cast<AudioState*>(userptr)->bufferCallback(
13641364
std::views::counted(static_cast<ALubyte*>(data), size));
13651365
};
1366-
alBufferCallbackSOFT(mBuffers[0], mFormat, mCodecCtx->sample_rate, callback, this);
1366+
palBufferCallbackSOFT(mBuffers[0], mFormat, mCodecCtx->sample_rate, callback, this);
13671367

13681368
alSourcei(mSource, AL_BUFFER, as_signed(mBuffers[0]));
13691369
if(alGetError() != AL_NO_ERROR)
@@ -2168,7 +2168,7 @@ struct Application {
21682168
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
21692169

21702170
if(AudioState::sPShiftSlot)
2171-
alDeleteAuxiliaryEffectSlots(1, &AudioState::sPShiftSlot);
2171+
palDeleteAuxiliaryEffectSlots(1, &AudioState::sPShiftSlot);
21722172
AudioState::sPShiftSlot = 0;
21732173
}
21742174

@@ -2406,8 +2406,8 @@ auto main(std::span<std::string_view> args) -> int
24062406
* original pitch while maintaining the speed change.
24072407
*/
24082408
auto effect = ALuint{};
2409-
alGenEffects(1, &effect);
2410-
alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_PITCH_SHIFTER);
2409+
palGenEffects(1, &effect);
2410+
palEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_PITCH_SHIFTER);
24112411
if(auto const err = alGetError(); err != AL_NO_ERROR)
24122412
{
24132413
fmt::print(std::cerr, "Could not create the Pitch Shifter effect: {:#06x}\n", err);
@@ -2443,15 +2443,15 @@ auto main(std::span<std::string_view> args) -> int
24432443
fmt::println("Speed factor: {} (pitch adj: {}; course tuning: {}, fine tuning: {})",
24442444
TimeStretchFactor, pitch, course_tune, fine_tune);
24452445

2446-
alEffecti(effect, AL_PITCH_SHIFTER_COARSE_TUNE, std::clamp(course_tune, -12, +12));
2447-
alEffecti(effect, AL_PITCH_SHIFTER_FINE_TUNE, fine_tune);
2446+
palEffecti(effect, AL_PITCH_SHIFTER_COARSE_TUNE, std::clamp(course_tune, -12, +12));
2447+
palEffecti(effect, AL_PITCH_SHIFTER_FINE_TUNE, fine_tune);
24482448

2449-
alGenAuxiliaryEffectSlots(1, &AudioState::sPShiftSlot);
2450-
alAuxiliaryEffectSloti(AudioState::sPShiftSlot, AL_EFFECTSLOT_EFFECT,
2449+
palGenAuxiliaryEffectSlots(1, &AudioState::sPShiftSlot);
2450+
palAuxiliaryEffectSloti(AudioState::sPShiftSlot, AL_EFFECTSLOT_EFFECT,
24512451
static_cast<ALint>(effect));
24522452
}
24532453
}
2454-
alDeleteEffects(1, &effect);
2454+
palDeleteEffects(1, &effect);
24552455
}
24562456

24572457
curarg = std::ranges::find_if(curarg, app.mArgs.end(), [&app](const std::string_view argval)

examples/allafplay.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,26 +1369,26 @@ auto main(std::span<std::string_view> args) -> int
13691369
{
13701370
if(LfeSlotID)
13711371
{
1372-
alDeleteAuxiliaryEffectSlots(1, &LfeSlotID);
1373-
alDeleteEffects(1, &LowFrequencyEffectID);
1374-
alDeleteFilters(1, &MuteFilterID);
1372+
palDeleteAuxiliaryEffectSlots(1, &LfeSlotID);
1373+
palDeleteEffects(1, &LowFrequencyEffectID);
1374+
palDeleteFilters(1, &MuteFilterID);
13751375
}
13761376
});
13771377

13781378
if(alcIsExtensionPresent(almgr.mDevice, "ALC_EXT_EFX")
13791379
&& alcIsExtensionPresent(almgr.mDevice, "ALC_EXT_DEDICATED"))
13801380
{
1381-
alGenFilters(1, &MuteFilterID);
1382-
alFilteri(MuteFilterID, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
1383-
alFilterf(MuteFilterID, AL_LOWPASS_GAIN, 0.0f);
1381+
palGenFilters(1, &MuteFilterID);
1382+
palFilteri(MuteFilterID, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
1383+
palFilterf(MuteFilterID, AL_LOWPASS_GAIN, 0.0f);
13841384
MyAssert(alGetError() == AL_NO_ERROR);
13851385

1386-
alGenEffects(1, &LowFrequencyEffectID);
1387-
alEffecti(LowFrequencyEffectID, AL_EFFECT_TYPE, AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT);
1386+
palGenEffects(1, &LowFrequencyEffectID);
1387+
palEffecti(LowFrequencyEffectID, AL_EFFECT_TYPE, AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT);
13881388
MyAssert(alGetError() == AL_NO_ERROR);
13891389

1390-
alGenAuxiliaryEffectSlots(1, &LfeSlotID);
1391-
alAuxiliaryEffectSloti(LfeSlotID, AL_EFFECTSLOT_EFFECT, as_signed(LowFrequencyEffectID));
1390+
palGenAuxiliaryEffectSlots(1, &LfeSlotID);
1391+
palAuxiliaryEffectSloti(LfeSlotID, AL_EFFECTSLOT_EFFECT, as_signed(LowFrequencyEffectID));
13921392
MyAssert(alGetError() == AL_NO_ERROR);
13931393
}
13941394

examples/allatency.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int main(int argc, char **argv)
179179
/* Get the source offset and latency. AL_SEC_OFFSET_LATENCY_SOFT will
180180
* place the offset (in seconds) in offsets[0], and the time until that
181181
* offset will be heard (in seconds) in offsets[1]. */
182-
alGetSourcedvSOFT(source, AL_SEC_OFFSET_LATENCY_SOFT, offsets);
182+
palGetSourcedvSOFT(source, AL_SEC_OFFSET_LATENCY_SOFT, offsets);
183183
printf("\rOffset: %f - Latency:%3u ms ", offsets[0], (ALuint)(offsets[1]*1000));
184184
fflush(stdout);
185185
} while(alGetError() == AL_NO_ERROR && state == AL_PLAYING);

0 commit comments

Comments
 (0)