diff options
author | Chris Robinson <[email protected]> | 2022-04-01 19:30:28 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-04-01 19:31:22 -0700 |
commit | f2f83aaabba5b5c5f6c2b1657ff102bcac3f11aa (patch) | |
tree | 5a3b9b229ef0e532c50326d22fc39fe0f6266b6c | |
parent | 33109e86c91961562ceb8cca4447dbecc85442cd (diff) |
Finalize AL_SOFT_callback_buffer
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | alc/context.cpp | 2 | ||||
-rw-r--r-- | alc/inprogext.h | 17 | ||||
-rw-r--r-- | examples/alffplay.cpp | 22 | ||||
-rw-r--r-- | examples/alstreamcb.cpp | 13 | ||||
-rw-r--r-- | include/AL/alext.h | 17 |
6 files changed, 22 insertions, 51 deletions
@@ -3,6 +3,8 @@ openal-soft-1.22.0: Implemented the ALC_SOFT_reopen_device extension. This allows for moving devices to different outputs without losing object state. + Implemented the AL_SOFT_callback_buffer extension. + Implemented the legacy EAX extensions. Enabled by default only on Windows. Improved sound positioning stability when a source is near the listener. diff --git a/alc/context.cpp b/alc/context.cpp index bec3d56a..ffc31a42 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -65,7 +65,7 @@ constexpr ALchar alExtList[] = "AL_SOFT_bformat_ex " "AL_SOFTX_bformat_hoa " "AL_SOFT_block_alignment " - "AL_SOFTX_callback_buffer " + "AL_SOFT_callback_buffer " "AL_SOFTX_convolution_reverb " "AL_SOFT_deferred_updates " "AL_SOFT_direct_channels " diff --git a/alc/inprogext.h b/alc/inprogext.h index 046c2004..79826d5e 100644 --- a/alc/inprogext.h +++ b/alc/inprogext.h @@ -28,23 +28,6 @@ AL_API void AL_APIENTRY alFlushMappedBufferSOFT(ALuint buffer, ALsizei offset, A #endif #endif -#ifndef AL_SOFT_callback_buffer -#define AL_SOFT_callback_buffer -#define AL_BUFFER_CALLBACK_FUNCTION_SOFT 0x19A0 -#define AL_BUFFER_CALLBACK_USER_PARAM_SOFT 0x19A1 -typedef ALsizei (AL_APIENTRY*ALBUFFERCALLBACKTYPESOFT)(ALvoid *userptr, ALvoid *sampledata, ALsizei numbytes); -typedef void (AL_APIENTRY*LPALBUFFERCALLBACKSOFT)(ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr); -typedef void (AL_APIENTRY*LPALGETBUFFERPTRSOFT)(ALuint buffer, ALenum param, ALvoid **value); -typedef void (AL_APIENTRY*LPALGETBUFFER3PTRSOFT)(ALuint buffer, ALenum param, ALvoid **value1, ALvoid **value2, ALvoid **value3); -typedef void (AL_APIENTRY*LPALGETBUFFERPTRVSOFT)(ALuint buffer, ALenum param, ALvoid **values); -#ifdef AL_ALEXT_PROTOTYPES -AL_API void AL_APIENTRY alBufferCallbackSOFT(ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr); -AL_API void AL_APIENTRY alGetBufferPtrSOFT(ALuint buffer, ALenum param, ALvoid **ptr); -AL_API void AL_APIENTRY alGetBuffer3PtrSOFT(ALuint buffer, ALenum param, ALvoid **ptr0, ALvoid **ptr1, ALvoid **ptr2); -AL_API void AL_APIENTRY alGetBufferPtrvSOFT(ALuint buffer, ALenum param, ALvoid **ptr); -#endif -#endif - #ifndef AL_SOFT_bformat_hoa #define AL_SOFT_bformat_hoa #define AL_UNPACK_AMBISONIC_ORDER_SOFT 0x199D diff --git a/examples/alffplay.cpp b/examples/alffplay.cpp index e191a323..d243b295 100644 --- a/examples/alffplay.cpp +++ b/examples/alffplay.cpp @@ -76,16 +76,6 @@ extern "C" { #define ALLOW_EXPERIMENTAL_EXTS #ifdef ALLOW_EXPERIMENTAL_EXTS -#ifndef AL_SOFT_callback_buffer -#define AL_SOFT_callback_buffer -#define AL_BUFFER_CALLBACK_FUNCTION_SOFT 0x19A0 -#define AL_BUFFER_CALLBACK_USER_PARAM_SOFT 0x19A1 -typedef ALsizei (AL_APIENTRY*ALBUFFERCALLBACKTYPESOFT)(ALvoid *userptr, ALvoid *sampledata, ALsizei numbytes); -typedef void (AL_APIENTRY*LPALBUFFERCALLBACKSOFT)(ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr); -typedef void (AL_APIENTRY*LPALGETBUFFERPTRSOFT)(ALuint buffer, ALenum param, ALvoid **value); -typedef void (AL_APIENTRY*LPALGETBUFFER3PTRSOFT)(ALuint buffer, ALenum param, ALvoid **value1, ALvoid **value2, ALvoid **value3); -typedef void (AL_APIENTRY*LPALGETBUFFERPTRVSOFT)(ALuint buffer, ALenum param, ALvoid **values); -#endif #ifndef AL_SOFT_UHJ #define AL_SOFT_UHJ #define AL_FORMAT_UHJ2CHN8_SOFT 0x19A2 @@ -132,9 +122,7 @@ LPALCGETINTEGER64VSOFT alcGetInteger64vSOFT; LPALEVENTCONTROLSOFT alEventControlSOFT; LPALEVENTCALLBACKSOFT alEventCallbackSOFT; -#ifdef AL_SOFT_callback_buffer LPALBUFFERCALLBACKSOFT alBufferCallbackSOFT; -#endif ALenum FormatStereo8{AL_FORMAT_STEREO8}; ALenum FormatStereo16{AL_FORMAT_STEREO16}; ALenum FormatStereo32F{AL_FORMAT_STEREO_FLOAT32}; @@ -377,11 +365,9 @@ struct AudioState { void eventCallback(ALenum eventType, ALuint object, ALuint param, ALsizei length, const ALchar *message); -#ifdef AL_SOFT_callback_buffer static ALsizei AL_APIENTRY bufferCallbackC(void *userptr, void *data, ALsizei size) { return static_cast<AudioState*>(userptr)->bufferCallback(data, size); } ALsizei bufferCallback(void *data, ALsizei size); -#endif nanoseconds getClockNoLock(); nanoseconds getClock() @@ -945,7 +931,6 @@ void AL_APIENTRY AudioState::eventCallback(ALenum eventType, ALuint object, ALui } } -#ifdef AL_SOFT_callback_buffer ALsizei AudioState::bufferCallback(void *data, ALsizei size) { ALsizei got{0}; @@ -971,7 +956,6 @@ ALsizei AudioState::bufferCallback(void *data, ALsizei size) return got; } -#endif int AudioState::handler() { @@ -1277,7 +1261,6 @@ int AudioState::handler() if(alGetError() != AL_NO_ERROR) return 0; -#ifdef AL_SOFT_callback_buffer bool callback_ok{false}; if(alBufferCallbackSOFT) { @@ -1305,7 +1288,6 @@ int AudioState::handler() } } if(!callback_ok) -#endif buffer_len = static_cast<int>(duration_cast<seconds>(mCodecCtx->sample_rate * AudioBufferTime).count() * mFrameSize); if(buffer_len > 0) @@ -2048,14 +2030,12 @@ int main(int argc, char *argv[]) alEventCallbackSOFT = reinterpret_cast<LPALEVENTCALLBACKSOFT>( alGetProcAddress("alEventCallbackSOFT")); } -#ifdef AL_SOFT_callback_buffer - if(alIsExtensionPresent("AL_SOFTX_callback_buffer")) + if(alIsExtensionPresent("AL_SOFT_callback_buffer")) { std::cout<< "Found AL_SOFT_callback_buffer" <<std::endl; alBufferCallbackSOFT = reinterpret_cast<LPALBUFFERCALLBACKSOFT>( alGetProcAddress("alBufferCallbackSOFT")); } -#endif int fileidx{0}; for(;fileidx < argc;++fileidx) diff --git a/examples/alstreamcb.cpp b/examples/alstreamcb.cpp index d37fe118..e0dff4aa 100644 --- a/examples/alstreamcb.cpp +++ b/examples/alstreamcb.cpp @@ -45,17 +45,6 @@ #include "common/alhelpers.h" -#ifndef AL_SOFT_callback_buffer -#define AL_SOFT_callback_buffer -#define AL_BUFFER_CALLBACK_FUNCTION_SOFT 0x19A0 -#define AL_BUFFER_CALLBACK_USER_PARAM_SOFT 0x19A1 -typedef ALsizei (AL_APIENTRY*LPALBUFFERCALLBACKTYPESOFT)(ALvoid *userptr, ALvoid *sampledata, ALsizei numsamples); -typedef void (AL_APIENTRY*LPALBUFFERCALLBACKSOFT)(ALuint buffer, ALenum format, ALsizei freq, LPALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr); -typedef void (AL_APIENTRY*LPALGETBUFFERPTRSOFT)(ALuint buffer, ALenum param, ALvoid **value); -typedef void (AL_APIENTRY*LPALGETBUFFER3PTRSOFT)(ALuint buffer, ALenum param, ALvoid **value1, ALvoid **value2, ALvoid **value3); -typedef void (AL_APIENTRY*LPALGETBUFFERPTRVSOFT)(ALuint buffer, ALenum param, ALvoid **values); -#endif - namespace { using std::chrono::seconds; @@ -352,7 +341,7 @@ int main(int argc, char **argv) argv++; argc--; AudioManager almgr{&argv, &argc}; - if(!alIsExtensionPresent("AL_SOFTX_callback_buffer")) + if(!alIsExtensionPresent("AL_SOFT_callback_buffer")) { fprintf(stderr, "AL_SOFT_callback_buffer extension not available\n"); return 1; diff --git a/include/AL/alext.h b/include/AL/alext.h index 6b21acaf..46b5c071 100644 --- a/include/AL/alext.h +++ b/include/AL/alext.h @@ -589,6 +589,23 @@ ALCboolean ALC_APIENTRY alcReopenDeviceSOFT(ALCdevice *device, const ALCchar *de #endif #endif +#ifndef AL_SOFT_callback_buffer +#define AL_SOFT_callback_buffer +#define AL_BUFFER_CALLBACK_FUNCTION_SOFT 0x19A0 +#define AL_BUFFER_CALLBACK_USER_PARAM_SOFT 0x19A1 +typedef ALsizei (AL_APIENTRY*ALBUFFERCALLBACKTYPESOFT)(ALvoid *userptr, ALvoid *sampledata, ALsizei numbytes); +typedef void (AL_APIENTRY*LPALBUFFERCALLBACKSOFT)(ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr); +typedef void (AL_APIENTRY*LPALGETBUFFERPTRSOFT)(ALuint buffer, ALenum param, ALvoid **value); +typedef void (AL_APIENTRY*LPALGETBUFFER3PTRSOFT)(ALuint buffer, ALenum param, ALvoid **value1, ALvoid **value2, ALvoid **value3); +typedef void (AL_APIENTRY*LPALGETBUFFERPTRVSOFT)(ALuint buffer, ALenum param, ALvoid **values); +#ifdef AL_ALEXT_PROTOTYPES +AL_API void AL_APIENTRY alBufferCallbackSOFT(ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr); +AL_API void AL_APIENTRY alGetBufferPtrSOFT(ALuint buffer, ALenum param, ALvoid **ptr); +AL_API void AL_APIENTRY alGetBuffer3PtrSOFT(ALuint buffer, ALenum param, ALvoid **ptr0, ALvoid **ptr1, ALvoid **ptr2); +AL_API void AL_APIENTRY alGetBufferPtrvSOFT(ALuint buffer, ALenum param, ALvoid **ptr); +#endif +#endif + #ifdef __cplusplus } #endif |