diff options
-rw-r--r-- | Alc/backends/alsa.c | 14 | ||||
-rw-r--r-- | Alc/backends/dsound.c | 14 | ||||
-rw-r--r-- | Alc/backends/jack.c | 7 | ||||
-rw-r--r-- | Alc/backends/loopback.c | 7 | ||||
-rw-r--r-- | Alc/backends/mmdevapi.c | 14 | ||||
-rw-r--r-- | Alc/backends/null.c | 7 | ||||
-rw-r--r-- | Alc/backends/oss.c | 14 | ||||
-rw-r--r-- | Alc/backends/pulseaudio.c | 14 | ||||
-rw-r--r-- | Alc/backends/solaris.c | 7 | ||||
-rw-r--r-- | Alc/backends/wave.c | 22 | ||||
-rw-r--r-- | Alc/backends/winmm.c | 14 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 12 |
12 files changed, 29 insertions, 117 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c index 174252e3..e07f3ce5 100644 --- a/Alc/backends/alsa.c +++ b/Alc/backends/alsa.c @@ -1352,25 +1352,15 @@ static ALCbackend* ALCalsaBackendFactory_createBackend(ALCalsaBackendFactory* UN if(type == ALCbackend_Playback) { ALCplaybackAlsa *backend; - - backend = ALCplaybackAlsa_New(sizeof(*backend)); + NEW_OBJ(backend, ALCplaybackAlsa)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCplaybackAlsa_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } if(type == ALCbackend_Capture) { ALCcaptureAlsa *backend; - - backend = ALCcaptureAlsa_New(sizeof(*backend)); + NEW_OBJ(backend, ALCcaptureAlsa)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCcaptureAlsa_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c index 8d7d7db3..174cc42f 100644 --- a/Alc/backends/dsound.c +++ b/Alc/backends/dsound.c @@ -1039,26 +1039,16 @@ static ALCbackend* ALCdsoundBackendFactory_createBackend(ALCdsoundBackendFactory if(type == ALCbackend_Playback) { ALCdsoundPlayback *backend; - - backend = ALCdsoundPlayback_New(sizeof(*backend)); + NEW_OBJ(backend, ALCdsoundPlayback)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCdsoundPlayback_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } if(type == ALCbackend_Capture) { ALCdsoundCapture *backend; - - backend = ALCdsoundCapture_New(sizeof(*backend)); + NEW_OBJ(backend, ALCdsoundCapture)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCdsoundCapture_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/Alc/backends/jack.c b/Alc/backends/jack.c index 57f129fc..fbf2e54b 100644 --- a/Alc/backends/jack.c +++ b/Alc/backends/jack.c @@ -592,13 +592,8 @@ static ALCbackend* ALCjackBackendFactory_createBackend(ALCjackBackendFactory* UN if(type == ALCbackend_Playback) { ALCjackPlayback *backend; - - backend = ALCjackPlayback_New(sizeof(*backend)); + NEW_OBJ(backend, ALCjackPlayback)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCjackPlayback_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/Alc/backends/loopback.c b/Alc/backends/loopback.c index f511b8b1..3e577f78 100644 --- a/Alc/backends/loopback.c +++ b/Alc/backends/loopback.c @@ -124,13 +124,8 @@ static ALCbackend* ALCloopbackFactory_createBackend(ALCloopbackFactory* UNUSED(s if(type == ALCbackend_Loopback) { ALCloopback *backend; - - backend = ALCloopback_New(sizeof(*backend)); + NEW_OBJ(backend, ALCloopback)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCloopback_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c index cfd12d8d..a4fd1071 100644 --- a/Alc/backends/mmdevapi.c +++ b/Alc/backends/mmdevapi.c @@ -1756,25 +1756,15 @@ static ALCbackend* ALCmmdevBackendFactory_createBackend(ALCmmdevBackendFactory* if(type == ALCbackend_Playback) { ALCmmdevPlayback *backend; - - backend = ALCmmdevPlayback_New(sizeof(*backend)); + NEW_OBJ(backend, ALCmmdevPlayback)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCmmdevPlayback_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } if(type == ALCbackend_Capture) { ALCmmdevCapture *backend; - - backend = ALCmmdevCapture_New(sizeof(*backend)); + NEW_OBJ(backend, ALCmmdevCapture)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCmmdevCapture_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/Alc/backends/null.c b/Alc/backends/null.c index 7010f41c..99729c0a 100644 --- a/Alc/backends/null.c +++ b/Alc/backends/null.c @@ -214,13 +214,8 @@ static ALCbackend* ALCnullBackendFactory_createBackend(ALCnullBackendFactory* UN if(type == ALCbackend_Playback) { ALCnullBackend *backend; - - backend = ALCnullBackend_New(sizeof(*backend)); + NEW_OBJ(backend, ALCnullBackend)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCnullBackend_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c index e4478515..f3e68550 100644 --- a/Alc/backends/oss.c +++ b/Alc/backends/oss.c @@ -606,25 +606,15 @@ ALCbackend* ALCossBackendFactory_createBackend(ALCossBackendFactory* UNUSED(self if(type == ALCbackend_Playback) { ALCplaybackOSS *backend; - - backend = ALCplaybackOSS_New(sizeof(*backend)); + NEW_OBJ(backend, ALCplaybackOSS)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCplaybackOSS_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } if(type == ALCbackend_Capture) { ALCcaptureOSS *backend; - - backend = ALCcaptureOSS_New(sizeof(*backend)); + NEW_OBJ(backend, ALCcaptureOSS)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCcaptureOSS_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index f8761c91..b8a0b0a1 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -1689,25 +1689,15 @@ static ALCbackend* ALCpulseBackendFactory_createBackend(ALCpulseBackendFactory* if(type == ALCbackend_Playback) { ALCpulsePlayback *backend; - - backend = ALCpulsePlayback_New(sizeof(*backend)); + NEW_OBJ(backend, ALCpulsePlayback)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCpulsePlayback_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } if(type == ALCbackend_Capture) { ALCpulseCapture *backend; - - backend = ALCpulseCapture_New(sizeof(*backend)); + NEW_OBJ(backend, ALCpulseCapture)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCpulseCapture_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c index 3150b4fe..c3c2a86f 100644 --- a/Alc/backends/solaris.c +++ b/Alc/backends/solaris.c @@ -329,13 +329,8 @@ ALCbackend* ALCsolarisBackendFactory_createBackend(ALCsolarisBackendFactory* UNU if(type == ALCbackend_Playback) { ALCsolarisBackend *backend; - - backend = ALCsolarisBackend_New(sizeof(*backend)); + NEW_OBJ(backend, ALCsolarisBackend)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCsolarisBackend_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c index bfe0e2cf..728b4d91 100644 --- a/Alc/backends/wave.c +++ b/Alc/backends/wave.c @@ -433,30 +433,10 @@ static ALCbackend* ALCwaveBackendFactory_createBackend(ALCwaveBackendFactory* UN if(type == ALCbackend_Playback) { ALCwaveBackend *backend; - - backend = ALCwaveBackend_New(sizeof(*backend)); + NEW_OBJ(backend, ALCwaveBackend)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCwaveBackend_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } return NULL; } - -void alc_wave_probe(enum DevProbe type) -{ - if(!ConfigValueExists("wave", "file")) - return; - - switch(type) - { - case ALL_DEVICE_PROBE: - AppendAllDevicesList(waveDevice); - break; - case CAPTURE_DEVICE_PROBE: - break; - } -} diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c index 03805ab8..e4ea151e 100644 --- a/Alc/backends/winmm.c +++ b/Alc/backends/winmm.c @@ -780,25 +780,15 @@ static ALCbackend* ALCwinmmBackendFactory_createBackend(ALCwinmmBackendFactory* if(type == ALCbackend_Playback) { ALCwinmmPlayback *backend; - - backend = ALCwinmmPlayback_New(sizeof(*backend)); + NEW_OBJ(backend, ALCwinmmPlayback)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCwinmmPlayback_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } if(type == ALCbackend_Capture) { ALCwinmmCapture *backend; - - backend = ALCwinmmCapture_New(sizeof(*backend)); + NEW_OBJ(backend, ALCwinmmCapture)(device); if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); - - ALCwinmmCapture_Construct(backend, device); - return STATIC_CAST(ALCbackend, backend); } diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index e92e94fb..8d766939 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -413,6 +413,18 @@ static void T##_Delete(void *ptr) { al_free(ptr); } } while(0) +#define EXTRACT_NEW_ARGS(...) __VA_ARGS__); \ + } \ +} while(0) + +#define NEW_OBJ(_ptr, T) do { \ + _ptr = T##_New(sizeof(*_ptr)); \ + if(_ptr) \ + { \ + memset(_ptr, 0, sizeof(*_ptr)); \ + T##_Construct(_ptr, EXTRACT_NEW_ARGS + + #ifdef __cplusplus extern "C" { #endif |