Initial revision

This commit is contained in:
Jaroslav Kysela 1998-08-13 15:42:56 +00:00
commit 5abac67626
47 changed files with 7915 additions and 0 deletions

10
include/Makefile Normal file
View file

@ -0,0 +1,10 @@
#
# Makefile for ALSA library
# Copyright (c) 1994-98 by Jaroslav Kysela <perex@jcu.cz>
#
include ../Makefile.conf
clean:
rm -f core .depend *.o *.orig *~

7
include/config.h Normal file
View file

@ -0,0 +1,7 @@
/* include/config.h. Generated automatically by configure. */
/*
* Configuration header file for compilation of the ALSA driver
*/
#define SND_LIB_VERSION "0.0.9"
/* #undef WORDS_BIGENDIAN */

6
include/config.h.in Normal file
View file

@ -0,0 +1,6 @@
/*
* Configuration header file for compilation of the ALSA driver
*/
#undef SND_LIB_VERSION
#undef WORDS_BIGENDIAN

28
include/control.h Normal file
View file

@ -0,0 +1,28 @@
/****************************************************************************
* *
* control.h *
* Control Interface *
* *
****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
int snd_cards( void );
unsigned int snd_cards_mask( void );
int snd_card_name( const char *name );
int snd_ctl_open( void **handle, int card );
int snd_ctl_close( void *handle );
int snd_ctl_file_descriptor( void *handle );
int snd_ctl_hw_info( void *handle, struct snd_ctl_hw_info *info );
int snd_ctl_pcm_info( void *handle, int dev, snd_pcm_info_t *info );
int snd_ctl_pcm_playback_info( void *handle, int dev, snd_pcm_playback_info_t *info );
int snd_ctl_pcm_record_info( void *handle, int dev, snd_pcm_record_info_t *info );
int snd_ctl_mixer_info( void *handle, int dev, snd_mixer_info_t *info );
#ifdef __cplusplus
}
#endif

17
include/error.h Normal file
View file

@ -0,0 +1,17 @@
/*
* error.h
*/
#define SND_ERROR_BEGIN 500000
#define SND_ERROR_UNCOMPATIBLE_VERSION (SND_ERROR_BEGIN+0)
#ifdef __cplusplus
extern "C" {
#endif
const char *snd_strerror( int errnum );
#ifdef __cplusplus
}
#endif

5
include/footer.h Normal file
View file

@ -0,0 +1,5 @@
/*
*
*/
#endif /* __SOUNDLIB_H */

27
include/header.h Normal file
View file

@ -0,0 +1,27 @@
/*
* Application interface library for the ALSA driver
* Copyright (c) by Jaroslav Kysela <perex@jcu.cz>
*
*
* 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 program 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __SOUNDLIB_H
#define __SOUNDLIB_H
#include <linux/sound.h>
#include <unistd.h>

240
include/local.h Normal file
View file

@ -0,0 +1,240 @@
/*
* Application interface library for the ALSA driver
* Copyright (c) 1994/98 by Jaroslav Kysela <perex@jcu.cz>
*/
#include <asm/byteorder.h>
#include "../../../include/ultraconf.h"
#ifdef DEBUG
#include <assert.h>
#define ASSERT( s ) assert( s )
void __snd_dprintf( char *, ... );
#define snd_dprintf( args... ) __ultra_dprintf( ##args )
#else
#define ASSERT( s ) { ; }
#define snd_dprintf( fmt... ) /* nothing */
#endif
extern inline int snd_p_rint( float x )
{
return (int)( x + (float)0.5 );
}
/*
*
*/
extern inline void snd_put_byte( unsigned char *array, unsigned int idx, unsigned char b )
{
*(array + idx) = b;
}
extern inline unsigned char snd_get_byte( unsigned char *array, unsigned int idx )
{
return *(array + idx);
}
#if defined( __i386__ )
extern inline void snd_put_le_word( unsigned char *array, unsigned int idx, unsigned short w )
{
*(unsigned short *)(array + idx) = w;
}
extern inline unsigned short snd_get_le_word( unsigned char *array, unsigned int idx )
{
return *(unsigned short *)(array + idx);
}
extern inline void snd_put_le_dword( unsigned char *array, unsigned int idx, unsigned int dw )
{
*(unsigned int *)(array + idx) = dw;
}
extern inline unsigned int snd_get_le_dword( unsigned char *array, unsigned int idx )
{
return *(unsigned int *)(array + idx );
}
#else
#ifndef WORDS_BIGENDIAN
extern inline void snd_put_le_word( unsigned char *array, unsigned int idx, unsigned short w )
{
*(array + idx + 0) = (unsigned char)(w >> 0);
*(array + idx + 1) = (unsigned char)(w >> 8);
}
extern inline unsigned short snd_get_le_word( unsigned char *array, unsigned int idx )
{
return ( *(array + idx + 0) << 0 ) |
( *(array + idx + 1) << 8 );
}
extern inline void snd_put_le_dword( unsigned char *array, unsigned int idx, unsigned int dw )
{
*(array + idx + 0) = (unsigned char)(dw >> 0);
*(array + idx + 1) = (unsigned char)(dw >> 8);
*(array + idx + 2) = (unsigned char)(dw >> 16);
*(array + idx + 3) = (unsigned char)(dw >> 24);
}
extern inline unsigned int snd_get_le_dword( unsigned char *array, unsigned int idx )
{
return ( *(array + idx + 0) << 0 ) |
( *(array + idx + 1) << 8 ) |
( *(array + idx + 2) << 16 ) |
( *(array + idx + 3) << 24 );
}
#else
extern inline void snd_put_le_word( unsigned char *array, unsigned int idx, unsigned short w )
{
*(array + idx + 0) = (unsigned char)(w >> 8);
*(array + idx + 1) = (unsigned char)(w >> 0);
}
extern inline unsigned short snd_get_le_word( unsigned char *array, unsigned int idx )
{
return ( *(array + idx + 0) << 8 ) |
( *(array + idx + 1) << 0 );
}
extern inline void snd_put_le_dword( unsigned char *array, unsigned int idx, unsigned int dw )
{
*(array + idx + 0) = (unsigned char)(dw >> 24);
*(array + idx + 1) = (unsigned char)(dw >> 16);
*(array + idx + 2) = (unsigned char)(dw >> 8);
*(array + idx + 3) = (unsigned char)(dw >> 0);
}
extern inline unsigned int snd_get_le_dword( unsigned char *array, unsigned int idx )
{
return ( *(array + idx + 0) << 24 ) |
( *(array + idx + 1) << 16 ) |
( *(array + idx + 2) << 8 ) |
( *(array + idx + 3) << 0 );
}
#endif
#endif
/*
*
*/
extern inline unsigned char snd_get_unsigned_byte( unsigned char *ptr )
{
return *ptr;
}
extern inline void snd_put_unsigned_byte( unsigned char *ptr, unsigned char val )
{
*ptr = val;
}
extern inline unsigned char snd_get_signed_byte( signed char *ptr )
{
return *ptr;
}
extern inline void snd_put_signed_byte( signed char *ptr, signed char val )
{
*ptr = val;
}
#if !defined( WORDS_BIGENDIAN ) || defined( __i386__ )
extern inline signed short snd_get_signed_le_word( unsigned char *ptr )
{
return *(signed short *)ptr;
}
extern inline void snd_put_signed_le_word( unsigned char *ptr, signed short val )
{
*(signed short *)ptr = val;
}
extern inline unsigned short snd_get_unsigned_le_word( unsigned char *ptr )
{
return *(unsigned short *)ptr;
}
extern inline void snd_put_unsigned_le_word( unsigned char *ptr, unsigned short val )
{
*(unsigned short *)ptr = val;
}
extern inline unsigned int snd_get_unsigned_le_dword( unsigned char *ptr )
{
return *(unsigned int *)ptr;
}
extern inline void snd_put_unsigned_le_dword( unsigned char *ptr, unsigned int val )
{
*(unsigned int *)ptr = val;
}
#else
extern inline unsigned short snd_get_signed_le_word( unsigned char *ptr )
{
return (signed short)( *ptr + ( *( ptr + 1 ) << 8 );
}
extern inline void snd_put_signed_le_word( unsigned char *ptr, signed short val )
{
*ptr = (unsigned char)val;
*(ptr + 1) = val >> 8;
}
extern inline unsigned short snd_get_unsigned_le_word( unsigned char *ptr )
{
return (signed short)( *ptr + ( *( ptr + 1 ) << 8 );
}
extern inline void snd_put_unsigned_le_word( unsigned char *ptr, unsigned short val )
{
*ptr = (unsigned char)val;
*(ptr + 1) = val >> 8;
}
extern inline unsigned int snd_get_unsigned_le_dword( unsigned char *ptr )
{
return (signed int)( *ptr + ( *( ptr + 1 ) << 8 ) +
( *( ptr + 2 ) << 8 ) + ( *( ptr + 3 ) << 8 ) );
}
extern inline void snd_put_unsigned_le_dword( unsigned char *ptr, unsigned int val )
{
*ptr = (unsigned char)val;
*(ptr + 1) = (unsigned char)val >> 8;
*(ptr + 2) = (unsigned char)val >> 16;
*(ptr + 3) = (unsigned char)val >> 24;
}
#endif
extern inline unsigned short snd_get_be_word( unsigned char *array, unsigned int idx )
{
return ( *(array + idx + 1) << 0 ) |
( *(array + idx + 0) << 8 );
}
extern inline unsigned int snd_get_be_dword( unsigned char *array, unsigned int idx )
{
return ( *(array + idx + 3) << 0 ) |
( *(array + idx + 2) << 8 ) |
( *(array + idx + 1) << 16 ) |
( *(array + idx + 0) << 24 );
}

35
include/mixer.h Normal file
View file

@ -0,0 +1,35 @@
/****************************************************************************
* *
* mixer.h *
* Mixer Interface *
* *
****************************************************************************/
typedef struct snd_mixer_callbacks {
void *private_data; /* should be used by application */
void (*channel_was_changed)( void *private_data, int channel );
void *reserved[15]; /* reserved for future use - must be NULL!!! */
} snd_mixer_callbacks_t;
#ifdef __cplusplus
extern "C" {
#endif
int snd_mixer_open( void **handle, int card, int device );
int snd_mixer_close( void *handle );
int snd_mixer_file_descriptor( void *handle );
int snd_mixer_channels( void *handle );
int snd_mixer_info( void *handle, snd_mixer_info_t *info );
int snd_mixer_exact_mode( void *handle, int enable );
int snd_mixer_channel( void *handle, const char *channel_id );
int snd_mixer_channel_info( void *handle, int channel, snd_mixer_channel_info_t *info );
int snd_mixer_channel_read( void *handle, int channel, snd_mixer_channel_t *data );
int snd_mixer_channel_write( void *handle, int channel, snd_mixer_channel_t *data );
int snd_mixer_special_read( void *handle, snd_mixer_special_t *special );
int snd_mixer_special_write( void *handle, snd_mixer_special_t *special );
int snd_mixer_read( void *handle, snd_mixer_callbacks_t *callbacks );
#ifdef __cplusplus
}
#endif

40
include/pcm.h Normal file
View file

@ -0,0 +1,40 @@
/****************************************************************************
* *
* pcm.h *
* Digital Audio Interface *
* *
****************************************************************************/
#define SND_PCM_OPEN_PLAYBACK (O_WRONLY)
#define SND_PCM_OPEN_RECORD (O_RDONLY)
#define SND_PCM_OPEN_DUPLEX (O_RDWR)
#ifdef __cplusplus
extern "C" {
#endif
int snd_pcm_open( void **handle, int card, int device, int mode );
int snd_pcm_close( void *handle );
int snd_pcm_file_descriptor( void *handle );
int snd_pcm_block_mode( void *handle, int enable );
int snd_pcm_info( void *handle, snd_pcm_info_t *info );
int snd_pcm_playback_info( void *handle, snd_pcm_playback_info_t *info );
int snd_pcm_record_info( void *handle, snd_pcm_record_info_t *info );
int snd_pcm_playback_format( void *handle, snd_pcm_format_t *format );
int snd_pcm_record_format( void *handle, snd_pcm_format_t *format );
int snd_pcm_playback_params( void *handle, snd_pcm_playback_params_t *params );
int snd_pcm_record_params( void *handle, snd_pcm_record_params_t *params );
int snd_pcm_playback_status( void *handle, snd_pcm_playback_status_t *status );
int snd_pcm_record_status( void *handle, snd_pcm_record_status_t *status );
int snd_pcm_drain_playback( void *handle );
int snd_pcm_flush_playback( void *handle );
int snd_pcm_flush_record( void *handle );
int snd_pcm_playback_time( void *handle, int enable );
int snd_pcm_record_time( void *handle, int enable );
ssize_t snd_pcm_write( void *handle, const void *buffer, size_t size );
ssize_t snd_pcm_read( void *handle, void *buffer, size_t size );
#ifdef __cplusplus
}
#endif

161
include/soundlib.h Normal file
View file

@ -0,0 +1,161 @@
/*
* Application interface library for the ALSA driver
* Copyright (c) by Jaroslav Kysela <perex@jcu.cz>
*
*
* 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 program 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __SOUNDLIB_H
#define __SOUNDLIB_H
#include <linux/sound.h>
#include <unistd.h>
/*
* version.h
*/
#define SOUNDLIB_VERSION_MAJOR 0
#define SOUNDLIB_VERSION_MINOR 0
#define SOUNDLIB_VERSION_SUBMINOR 9
#define SOUNDLIB_VERSION ( ( LIBULTRA_VERSION_MAJOR << 16 ) | ( LIBULTRA_VERSION_MINOR << 8 ) | LIB_ULTRA_VERSION_SUBMINOR )
/*
* error.h
*/
#define SND_ERROR_BEGIN 500000
#define SND_ERROR_UNCOMPATIBLE_VERSION (SND_ERROR_BEGIN+0)
#ifdef __cplusplus
extern "C" {
#endif
const char *snd_strerror( int errnum );
#ifdef __cplusplus
}
#endif
/****************************************************************************
* *
* control.h *
* Control Interface *
* *
****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
int snd_cards( void );
unsigned int snd_cards_mask( void );
int snd_card_name( const char *name );
int snd_ctl_open( void **handle, int card );
int snd_ctl_close( void *handle );
int snd_ctl_file_descriptor( void *handle );
int snd_ctl_hw_info( void *handle, struct snd_ctl_hw_info *info );
int snd_ctl_pcm_info( void *handle, int dev, snd_pcm_info_t *info );
int snd_ctl_pcm_playback_info( void *handle, int dev, snd_pcm_playback_info_t *info );
int snd_ctl_pcm_record_info( void *handle, int dev, snd_pcm_record_info_t *info );
int snd_ctl_mixer_info( void *handle, int dev, snd_mixer_info_t *info );
#ifdef __cplusplus
}
#endif
/****************************************************************************
* *
* mixer.h *
* Mixer Interface *
* *
****************************************************************************/
typedef struct snd_mixer_callbacks {
void *private_data; /* should be used by application */
void (*channel_was_changed)( void *private_data, int channel );
void *reserved[15]; /* reserved for future use - must be NULL!!! */
} snd_mixer_callbacks_t;
#ifdef __cplusplus
extern "C" {
#endif
int snd_mixer_open( void **handle, int card, int device );
int snd_mixer_close( void *handle );
int snd_mixer_file_descriptor( void *handle );
int snd_mixer_channels( void *handle );
int snd_mixer_info( void *handle, snd_mixer_info_t *info );
int snd_mixer_exact_mode( void *handle, int enable );
int snd_mixer_channel( void *handle, const char *channel_id );
int snd_mixer_channel_info( void *handle, int channel, snd_mixer_channel_info_t *info );
int snd_mixer_channel_read( void *handle, int channel, snd_mixer_channel_t *data );
int snd_mixer_channel_write( void *handle, int channel, snd_mixer_channel_t *data );
int snd_mixer_special_read( void *handle, snd_mixer_special_t *special );
int snd_mixer_special_write( void *handle, snd_mixer_special_t *special );
int snd_mixer_read( void *handle, snd_mixer_callbacks_t *callbacks );
#ifdef __cplusplus
}
#endif
/****************************************************************************
* *
* pcm.h *
* Digital Audio Interface *
* *
****************************************************************************/
#define SND_PCM_OPEN_PLAYBACK (O_WRONLY)
#define SND_PCM_OPEN_RECORD (O_RDONLY)
#define SND_PCM_OPEN_DUPLEX (O_RDWR)
#ifdef __cplusplus
extern "C" {
#endif
int snd_pcm_open( void **handle, int card, int device, int mode );
int snd_pcm_close( void *handle );
int snd_pcm_file_descriptor( void *handle );
int snd_pcm_block_mode( void *handle, int enable );
int snd_pcm_info( void *handle, snd_pcm_info_t *info );
int snd_pcm_playback_info( void *handle, snd_pcm_playback_info_t *info );
int snd_pcm_record_info( void *handle, snd_pcm_record_info_t *info );
int snd_pcm_playback_format( void *handle, snd_pcm_format_t *format );
int snd_pcm_record_format( void *handle, snd_pcm_format_t *format );
int snd_pcm_playback_params( void *handle, snd_pcm_playback_params_t *params );
int snd_pcm_record_params( void *handle, snd_pcm_record_params_t *params );
int snd_pcm_playback_status( void *handle, snd_pcm_playback_status_t *status );
int snd_pcm_record_status( void *handle, snd_pcm_record_status_t *status );
int snd_pcm_drain_playback( void *handle );
int snd_pcm_flush_playback( void *handle );
int snd_pcm_flush_record( void *handle );
int snd_pcm_playback_time( void *handle, int enable );
int snd_pcm_record_time( void *handle, int enable );
ssize_t snd_pcm_write( void *handle, const void *buffer, size_t size );
ssize_t snd_pcm_read( void *handle, void *buffer, size_t size );
#ifdef __cplusplus
}
#endif
/*
*
*/
#endif /* __SOUNDLIB_H */

9
include/version.h Normal file
View file

@ -0,0 +1,9 @@
/*
* version.h
*/
#define SOUNDLIB_VERSION_MAJOR 0
#define SOUNDLIB_VERSION_MINOR 0
#define SOUNDLIB_VERSION_SUBMINOR 9
#define SOUNDLIB_VERSION ( ( LIBULTRA_VERSION_MAJOR << 16 ) | ( LIBULTRA_VERSION_MINOR << 8 ) | LIB_ULTRA_VERSION_SUBMINOR )

9
include/version.h.in Normal file
View file

@ -0,0 +1,9 @@
/*
* version.h
*/
#define SOUNDLIB_VERSION_MAJOR @SND_LIB_MAJOR@
#define SOUNDLIB_VERSION_MINOR @SND_LIB_MINOR@
#define SOUNDLIB_VERSION_SUBMINOR @SND_LIB_SUBMINOR@
#define SOUNDLIB_VERSION ( ( LIBULTRA_VERSION_MAJOR << 16 ) | ( LIBULTRA_VERSION_MINOR << 8 ) | LIB_ULTRA_VERSION_SUBMINOR )