zenilib: zenilib/jni/external/openal-soft/Alc/backends/alsa.c File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros | Functions | Variables
alsa.c File Reference
`#include "config.h"`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <memory.h>`
`#include "alMain.h"`
`#include "alu.h"`
`#include <alsa/asoundlib.h>`

Go to the source code of this file.

## Macros

#define | CHECK(x) if((funcerr=#x),(err=(x)) < 0) goto error
#define | CHECK(x) if((funcerr=#x),(err=(x)) < 0) goto error
#define | CHECK(x) if((funcerr=#x),(err=(x)) < 0) goto error

## Functions

void | alc_alsa_deinit (void)
ALCboolean | alc_alsa_init (BackendFuncs *func_list)
void | alc_alsa_probe (enum DevProbe type)
static ALCuint | alsa_available_samples (ALCdevice *Device)
static ALCenum | alsa_capture_samples (ALCdevice *Device, ALCvoid *Buffer, ALCuint Samples)
static void | alsa_close_capture (ALCdevice *Device)
static void | alsa_close_playback (ALCdevice *device)
static ALint64 | alsa_get_latency (ALCdevice *device)
static ALCboolean | alsa_load (void)
static ALCenum | alsa_open_capture (ALCdevice *Device, const ALCchar *deviceName)
static ALCenum | alsa_open_playback (ALCdevice *device, const ALCchar *deviceName)
static ALCboolean | alsa_reset_playback (ALCdevice *device)
static void | alsa_start_capture (ALCdevice *Device)
static ALCboolean | alsa_start_playback (ALCdevice *device)
static void | alsa_stop_capture (ALCdevice *Device)
static void | alsa_stop_playback (ALCdevice *device)
static ALuint | ALSANoMMapProc (ALvoid *ptr)
static ALuint | ALSAProc (ALvoid *ptr)
static const char * | prefix_name (snd_pcm_stream_t stream)
static DevMap * | probe_devices (snd_pcm_stream_t stream, ALuint *count)
static int | verify_state (snd_pcm_t *handle)

## Variables

static DevMap * | allCaptureDevNameMap
static DevMap * | allDevNameMap
static const BackendFuncs | alsa_funcs
static const ALCchar | alsaDevice [] = "ALSA Default"
static ALuint | numCaptureDevNames
static ALuint | numDevNames

## Macro Definition Documentation

#define CHECK | ( |  | x | ) | if((funcerr=#x),(err=(x)) < 0) goto error

Referenced by alsa_open_capture(), alsa_reset_playback(), and alsa_start_playback().

#define CHECK | ( |  | x | ) | if((funcerr=#x),(err=(x)) < 0) goto error

#define CHECK | ( |  | x | ) | if((funcerr=#x),(err=(x)) < 0) goto error

## Function Documentation

void alc_alsa_deinit | ( | void |  | ) |

Definition at line 1308 of file alsa.c.

References allCaptureDevNameMap, allDevNameMap, free, i, NULL, numCaptureDevNames, and numDevNames.

ALCboolean alc_alsa_init | ( | BackendFuncs * | func_list | ) |

Definition at line 1300 of file alsa.c.

References ALC_FALSE, ALC_TRUE, alsa_funcs, and alsa_load().

void alc_alsa_probe | ( | enum DevProbe | type | ) |

Definition at line 1337 of file alsa.c.

References ALL_DEVICE_PROBE, allCaptureDevNameMap, allDevNameMap, AppendAllDevicesList(), AppendCaptureDeviceList(), CAPTURE_DEVICE_PROBE, free, i, numCaptureDevNames, numDevNames, and probe_devices().

static ALCuint alsa_available_samples | ( | ALCdevice * | Device | ) |

static

Definition at line 1164 of file alsa.c.

References aluHandleDisconnect(), ALCdevice_struct::Connected, ERR, ALCdevice_struct::ExtraData, RingBufferSize(), and WriteRingBuffer().

Referenced by alsa_stop_capture().

static ALCenum alsa_capture_samples | ( | ALCdevice * | Device,
|  | ALCvoid * | Buffer,
|  | ALCuint | Samples
| ) |  |

static

Definition at line 1090 of file alsa.c.

References ALC_NO_ERROR, aluHandleDisconnect(), ALCdevice_struct::Connected, DevFmtUByte, ERR, ALCdevice_struct::ExtraData, ALCdevice_struct::FmtType, free, memmove, memset, NULL, and ReadRingBuffer().

Referenced by alsa_stop_capture().

static void alsa_close_capture | ( | ALCdevice * | Device | ) |

static

Definition at line 1063 of file alsa.c.

References DestroyRingBuffer(), ALCdevice_struct::ExtraData, free, and NULL.

static void alsa_close_playback | ( | ALCdevice * | device | ) |

static

Definition at line 688 of file alsa.c.

References ALCdevice_struct::ExtraData, free, and NULL.

static ALint64 alsa_get_latency | ( | ALCdevice * | device | ) |

static

Definition at line 1268 of file alsa.c.

References ERR, ALCdevice_struct::ExtraData, ALCdevice_struct::Frequency, and maxi64().

static ALCboolean alsa_load | ( | void |  | ) |

static

Definition at line 188 of file alsa.c.

References ALC_FALSE, ALC_TRUE, and LOAD_FUNC.

Referenced by alc_alsa_init().

static ALCenum alsa_open_capture | ( | ALCdevice * | Device,
|  | const ALCchar * | deviceName
| ) |  |

static

Definition at line 917 of file alsa.c.

References AL_FALSE, AL_TRUE, ALC_INVALID_VALUE, ALC_NO_ERROR, allCaptureDevNameMap, alsaDevice, calloc, ChannelsFromDevFmt(), CHECK, CreateRingBuffer(), DestroyRingBuffer(), DevFmtByte, DevFmtFloat, DevFmtInt, DevFmtShort, DevFmtUByte, DevFmtUInt, DevFmtUShort, ALCdevice_struct::DeviceName, ERR, error, ALCdevice_struct::ExtraData, ALCdevice_struct::FmtChans, ALCdevice_struct::FmtType, FrameSizeFromDevFmt(), free, ALCdevice_struct::Frequency, GetConfigValue(), idx, malloc, maxu(), minu(), NULL, numCaptureDevNames, ALCdevice_struct::NumUpdates, probe_devices(), strdup(), TRACE, and ALCdevice_struct::UpdateSize.

static ALCenum alsa_open_playback | ( | ALCdevice * | device,
|  | const ALCchar * | deviceName
| ) |  |

static

Definition at line 640 of file alsa.c.

References ALC_INVALID_VALUE, ALC_NO_ERROR, ALC_OUT_OF_MEMORY, allDevNameMap, alsaDevice, calloc, ALCdevice_struct::DeviceName, ERR, ALCdevice_struct::ExtraData, free, GetConfigValue(), idx, NULL, numDevNames, probe_devices(), and strdup().

static ALCboolean alsa_reset_playback | ( | ALCdevice * | device | ) |

static

Definition at line 697 of file alsa.c.

References ALC_FALSE, ALC_TRUE, ChannelsFromDevFmt(), CHECK, COUNTOF, DevFmtByte, DevFmtFloat, DevFmtInt, DevFmtMono, DevFmtQuad, DevFmtShort, DevFmtStereo, DevFmtUByte, DevFmtUInt, DevFmtUShort, DevFmtX51, DevFmtX71, ERR, error, ALCdevice_struct::ExtraData, ALCdevice_struct::FmtChans, ALCdevice_struct::FmtType, ALCdevice_struct::Frequency, GetConfigValueBool(), k, NULL, ALCdevice_struct::NumUpdates, SetDefaultChannelOrder(), and ALCdevice_struct::UpdateSize.

static void alsa_start_capture | ( | ALCdevice * | Device | ) |

static

Definition at line 1075 of file alsa.c.

References AL_TRUE, aluHandleDisconnect(), ERR, and ALCdevice_struct::ExtraData.

static ALCboolean alsa_start_playback | ( | ALCdevice * | device | ) |

static

Definition at line 847 of file alsa.c.

References ALC_FALSE, ALC_TRUE, ALSANoMMapProc(), ALSAProc(), CHECK, ERR, error, ALCdevice_struct::ExtraData, free, malloc, NULL, StartThread(), and ALCdevice_struct::UpdateSize.

static void alsa_stop_capture | ( | ALCdevice * | Device | ) |

static

Definition at line 1235 of file alsa.c.

References AL_FALSE, alsa_available_samples(), alsa_capture_samples(), ERR, ALCdevice_struct::ExtraData, and realloc.

static void alsa_stop_playback | ( | ALCdevice * | device | ) |

static

Definition at line 901 of file alsa.c.

References ALCdevice_struct::ExtraData, free, NULL, and StopThread().

static ALuint ALSANoMMapProc | ( | ALvoid * | ptr | ) |

static

Definition at line 545 of file alsa.c.

References ALCdevice_Lock, ALCdevice_Unlock, aluHandleDisconnect(), aluMixData(), ERR, ALCdevice_struct::ExtraData, ALCdevice_struct::NumUpdates, ret, SetRTPriority(), ALCdevice_struct::UpdateSize, verify_state(), and WARN.

Referenced by alsa_start_playback().

static ALuint ALSAProc | ( | ALvoid * | ptr | ) |

static

Definition at line 454 of file alsa.c.

References ALCdevice_Lock, ALCdevice_Unlock, aluHandleDisconnect(), aluMixData(), ERR, ALCdevice_struct::ExtraData, NULL, ALCdevice_struct::NumUpdates, SetRTPriority(), ALCdevice_struct::UpdateSize, verify_state(), and WARN.

Referenced by alsa_start_playback().

static const char* prefix_name | ( | snd_pcm_stream_t | stream | ) |

static

Definition at line 310 of file alsa.c.

References assert.

Referenced by probe_devices().

static DevMap* probe_devices | ( | snd_pcm_stream_t | stream,
|  | ALuint * | count
| ) |  |

static

Definition at line 316 of file alsa.c.

References alsaDevice, ConfigValueStr(), ERR, GetConfigValue(), idx, malloc, prefix_name(), realloc, strdup(), and TRACE.

Referenced by alc_alsa_probe(), alsa_open_capture(), and alsa_open_playback().

static int verify_state | ( | snd_pcm_t * | handle | ) |

static

Definition at line 422 of file alsa.c.

Referenced by ALSANoMMapProc(), and ALSAProc().

## Variable Documentation

DevMap* allCaptureDevNameMap

static

Definition at line 306 of file alsa.c.

Referenced by alc_alsa_deinit(), alc_alsa_probe(), and alsa_open_capture().

DevMap* allDevNameMap

static

Definition at line 304 of file alsa.c.

Referenced by alc_alsa_deinit(), alc_alsa_probe(), and alsa_open_playback().

const BackendFuncs alsa_funcs

static

Initial value:
= {
alsa_open_playback,
alsa_close_playback,
alsa_reset_playback,
alsa_start_playback,
alsa_stop_playback,
alsa_open_capture,
alsa_close_capture,
alsa_start_capture,
alsa_stop_capture,
alsa_capture_samples,
alsa_available_samples,
ALCdevice_LockDefault,
ALCdevice_UnlockDefault,
alsa_get_latency
}
alsa_start_playback
static ALCboolean alsa_start_playback(ALCdevice *device)
Definition: alsa.c:847
alsa_get_latency
static ALint64 alsa_get_latency(ALCdevice *device)
Definition: alsa.c:1268
alsa_close_capture
static void alsa_close_capture(ALCdevice *Device)
Definition: alsa.c:1063
alsa_close_playback
static void alsa_close_playback(ALCdevice *device)
Definition: alsa.c:688
alsa_reset_playback
static ALCboolean alsa_reset_playback(ALCdevice *device)
Definition: alsa.c:697
alsa_capture_samples
static ALCenum alsa_capture_samples(ALCdevice *Device, ALCvoid *Buffer, ALCuint Samples)
Definition: alsa.c:1090
alsa_available_samples
static ALCuint alsa_available_samples(ALCdevice *Device)
Definition: alsa.c:1164
alsa_stop_playback
static void alsa_stop_playback(ALCdevice *device)
Definition: alsa.c:901
ALCdevice_LockDefault
void ALCdevice_LockDefault(ALCdevice *device)
Definition: ALc.c:1277
alsa_open_capture
static ALCenum alsa_open_capture(ALCdevice *Device, const ALCchar *deviceName)
Definition: alsa.c:917
alsa_start_capture
static void alsa_start_capture(ALCdevice *Device)
Definition: alsa.c:1075
ALCdevice_UnlockDefault
void ALCdevice_UnlockDefault(ALCdevice *device)
Definition: ALc.c:1281
alsa_stop_capture
static void alsa_stop_capture(ALCdevice *Device)
Definition: alsa.c:1235
alsa_open_playback
static ALCenum alsa_open_playback(ALCdevice *device, const ALCchar *deviceName)
Definition: alsa.c:640

Definition at line 1283 of file alsa.c.

Referenced by alc_alsa_init().

const ALCchar alsaDevice[] = "ALSA Default"

static

OpenAL cross platform audio library Copyright (C) 1999-2007 by authors. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

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. Or go to http://www.gnu.org/copyleft/lgpl.html

Definition at line 33 of file alsa.c.

Referenced by alsa_open_capture(), alsa_open_playback(), and probe_devices().

ALuint numCaptureDevNames

static

Definition at line 307 of file alsa.c.

Referenced by alc_alsa_deinit(), alc_alsa_probe(), and alsa_open_capture().

ALuint numDevNames

static

Definition at line 305 of file alsa.c.

Referenced by alc_alsa_deinit(), alc_alsa_probe(), and alsa_open_playback().