From 3c13e1e333e5a55185e19456df9dfbd1e80055d8 Mon Sep 17 00:00:00 2001 From: François Cami Date: Mon, 18 Aug 2014 14:11:03 +0200 Subject: Update COPYING to the latest https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt to fix the FSF' address Fix the FSF' address in the source --- Alc/backends/null.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Alc/backends/null.c') diff --git a/Alc/backends/null.c b/Alc/backends/null.c index 3f09c5d6..9dc90288 100644 --- a/Alc/backends/null.c +++ b/Alc/backends/null.c @@ -13,8 +13,8 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * Or go to http://www.gnu.org/copyleft/lgpl.html */ -- cgit v1.2.3 From 2be33d8a771a77bbcdf5809ea980bc8586a4fe22 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 8 Sep 2014 04:37:52 -0700 Subject: Only pass nano seconds to al_nssleep --- Alc/backends/null.c | 2 +- Alc/backends/oss.c | 4 ++-- Alc/backends/solaris.c | 2 +- Alc/backends/wave.c | 2 +- common/threads.c | 6 +++--- include/threads.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Alc/backends/null.c') diff --git a/Alc/backends/null.c b/Alc/backends/null.c index 9dc90288..7010f41c 100644 --- a/Alc/backends/null.c +++ b/Alc/backends/null.c @@ -106,7 +106,7 @@ static int ALCnullBackend_mixerProc(void *ptr) } if(avail-done < device->UpdateSize) - al_nssleep(0, restTime); + al_nssleep(restTime); else while(avail-done >= device->UpdateSize) { aluMixData(device, NULL, device->UpdateSize); diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c index 8c61ba93..631a496e 100644 --- a/Alc/backends/oss.c +++ b/Alc/backends/oss.c @@ -131,7 +131,7 @@ static int ALCplaybackOSS_mixerProc(void *ptr) break; } - al_nssleep(0, 1000000); + al_nssleep(1000000); continue; } @@ -362,7 +362,7 @@ static int ALCcaptureOSS_recordProc(void *ptr) } if(amt == 0) { - al_nssleep(0, 1000000); + al_nssleep(1000000); continue; } if(self->doCapture) diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c index b29fdea1..5d51d460 100644 --- a/Alc/backends/solaris.c +++ b/Alc/backends/solaris.c @@ -86,7 +86,7 @@ static int SolarisProc(void *ptr) break; } - al_nssleep(0, 1000000); + al_nssleep(1000000); continue; } diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c index ef1c307b..c80e059d 100644 --- a/Alc/backends/wave.c +++ b/Alc/backends/wave.c @@ -159,7 +159,7 @@ static int ALCwaveBackend_mixerProc(void *ptr) } if(avail-done < device->UpdateSize) - al_nssleep(0, restTime); + al_nssleep(restTime); else while(avail-done >= device->UpdateSize) { aluMixData(device, self->mBuffer, device->UpdateSize); diff --git a/common/threads.c b/common/threads.c index c4593604..71fa6ab9 100644 --- a/common/threads.c +++ b/common/threads.c @@ -733,11 +733,11 @@ int altimespec_get(struct timespec *ts, int base) #endif -void al_nssleep(time_t sec, long nsec) +void al_nssleep(unsigned long nsec) { struct timespec ts, rem; - ts.tv_sec = sec; - ts.tv_nsec = nsec; + ts.tv_sec = nsec / 1000000000ul; + ts.tv_nsec = nsec % 1000000000ul; while(althrd_sleep(&ts, &rem) == -1) ts = rem; diff --git a/include/threads.h b/include/threads.h index 25a75625..75eeb13f 100644 --- a/include/threads.h +++ b/include/threads.h @@ -234,7 +234,7 @@ void altss_delete(altss_t tss_id); int altimespec_get(struct timespec *ts, int base); -void al_nssleep(time_t sec, long nsec); +void al_nssleep(unsigned long nsec); #ifdef __cplusplus } -- cgit v1.2.3 From 9f49ac0fda04cc4bdc9e47a0d3c026722283c3a4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 18 May 2015 16:39:44 -0700 Subject: Add a macro to simplify allocating and constructing an object --- Alc/backends/alsa.c | 14 ++------------ Alc/backends/dsound.c | 14 ++------------ Alc/backends/jack.c | 7 +------ Alc/backends/loopback.c | 7 +------ Alc/backends/mmdevapi.c | 14 ++------------ Alc/backends/null.c | 7 +------ Alc/backends/oss.c | 14 ++------------ Alc/backends/pulseaudio.c | 14 ++------------ Alc/backends/solaris.c | 7 +------ Alc/backends/wave.c | 22 +--------------------- Alc/backends/winmm.c | 14 ++------------ OpenAL32/Include/alMain.h | 12 ++++++++++++ 12 files changed, 29 insertions(+), 117 deletions(-) (limited to 'Alc/backends/null.c') 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 -- cgit v1.2.3