Big renaming - from sound to asound...

This commit is contained in:
Jaroslav Kysela 1998-08-30 21:08:44 +00:00
parent 254d52fc84
commit 2ae16fb30d
20 changed files with 59 additions and 57 deletions

View file

@ -1,5 +1,7 @@
0.0.9 -> 0.1.0 0.0.9 -> 0.1.0
* renamed soundlib.h to asoundlib.h
* renamed libraries from libsound to libasound
* big API changes * big API changes
- added switches interfaces - added switches interfaces
* added RawMIDI API * added RawMIDI API

View file

@ -13,26 +13,26 @@ dummy:
endif endif
all: include/soundlib.h all: include/asoundlib.h
$(MAKE) -C src $(MAKE) -C src
$(MAKE) -C doc $(MAKE) -C doc
@echo @echo
@echo "ALSA library were sucessfully compiled." @echo "ALSA library were sucessfully compiled."
@echo @echo
include/soundlib.h: include/header.h include/version.h include/error.h include/footer.h \ include/asoundlib.h: include/header.h include/version.h include/error.h include/footer.h \
include/control.h include/mixer.h include/pcm.h include/rawmidi.h include/control.h include/mixer.h include/pcm.h include/rawmidi.h
cat include/header.h include/version.h include/error.h \ cat include/header.h include/version.h include/error.h \
include/control.h include/mixer.h \ include/control.h include/mixer.h \
include/pcm.h include/rawmidi.h \ include/pcm.h include/rawmidi.h \
include/footer.h > include/soundlib.h include/footer.h > include/asoundlib.h
install: all install: all
$(INSTALL) -m 644 -o root -g root include/soundlib.h ${includedir}/sys $(INSTALL) -m 644 -o root -g root include/asoundlib.h ${includedir}/sys
$(INSTALL) -m 644 -o root -g root lib/libsound.a ${libdir} $(INSTALL) -m 644 -o root -g root lib/libasound.a ${libdir}
$(LN_S) -f libsound.so.${SND_LIB_VERSION} ${libdir}/libsound.so $(LN_S) -f libasound.so.${SND_LIB_VERSION} ${libdir}/libasound.so
$(LN_S) -f libsound.so.${SND_LIB_VERSION} ${libdir}/libsound.so.${SND_LIB_MAJOR} $(LN_S) -f libasound.so.${SND_LIB_VERSION} ${libdir}/libasound.so.${SND_LIB_MAJOR}
$(INSTALL) -m 644 -o root -g root lib/libsound.so.${SND_LIB_VERSION} ${libdir} $(INSTALL) -m 644 -o root -g root lib/libasound.so.${SND_LIB_VERSION} ${libdir}
/sbin/ldconfig /sbin/ldconfig
clean: clean:
@ -46,7 +46,7 @@ clean:
cvsclean: clean cvsclean: clean
rm -f configure config.cache config.log config.status Makefile.conf \ rm -f configure config.cache config.log config.status Makefile.conf \
utils/alsa-lib.spec include/config.h include/soundlib.h include/version.h utils/alsa-lib.spec include/config.h include/asoundlib.h include/version.h
pack: cvsclean pack: cvsclean
chown -R root.root ../alsa-lib chown -R root.root ../alsa-lib

View file

@ -12,7 +12,7 @@ AC_PROG_LN_S
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CONFIG_HEADER(include/config.h) AC_CONFIG_HEADER(include/config.h)
AC_CHECK_HEADERS(linux/sound.h) AC_CHECK_HEADERS(linux/asound.h)
dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST AC_C_CONST
@ -32,7 +32,7 @@ CFLAGS="-I$myprefix/include"
#echo "CFLAGS=$CFLAGS" #echo "CFLAGS=$CFLAGS"
AC_MSG_CHECKING(for alsa-driver package) AC_MSG_CHECKING(for alsa-driver package)
AC_TRY_RUN([ AC_TRY_RUN([
#include <linux/sound.h> #include <linux/asound.h>
void main(void) void main(void)
{ {
#if !defined( SND_PROTOCOL_VERSION ) || !defined( SND_PROTOCOL_UNCOMPATIBLE ) #if !defined( SND_PROTOCOL_VERSION ) || !defined( SND_PROTOCOL_UNCOMPATIBLE )

View file

@ -20,9 +20,9 @@ may be placed in the library code instead of the kernel driver.</P>
<P>For a complete list of all variables and functions in the API you should look <P>For a complete list of all variables and functions in the API you should look
at the following header files: at the following header files:
<OL> <OL>
<LI>/usr/include/sys/soundlib.h</LI> <LI>/usr/include/sys/asoundlib.h</LI>
<LI>/usr/include/linux/sound.h</LI> <LI>/usr/include/linux/asound.h</LI>
<LI>/usr/include/linux/sounddetect.h</LI> <LI>/usr/include/linux/asoundid.h</LI>
</OL> </OL>
</P> </P>

View file

@ -134,11 +134,11 @@ int card = 0, err;
void *handle; void *handle;
stuct snd_ctl_hw_info info; stuct snd_ctl_hw_info info;
if ( (err = snd_ctl_open( &amp;handle, card )) &lt; 0 ) { if ( (err = snd_ctl_open( &handle, card )) &lt; 0 ) {
fprintf( stderr, &quot;open failed: %s\n&quot;, snd_strerror( err ) ); fprintf( stderr, &quot;open failed: %s\n&quot;, snd_strerror( err ) );
return; return;
} }
if ( (err = snd_ctl_hw_info( handle, &amp;info )) &lt; 0 ) { if ( (err = snd_ctl_hw_info( handle, &info )) &lt; 0 ) {
fprintf( stderr, &quot;hw info failed: %s\n&quot;, snd_strerror( err ) ); fprintf( stderr, &quot;hw info failed: %s\n&quot;, snd_strerror( err ) );
snd_ctl_close( handle ); snd_ctl_close( handle );
return; return;

View file

@ -228,11 +228,11 @@ void *handle;
snd_mixer_info_t info; snd_mixer_info_t info;
snd_mixer_channel_t channel; snd_mixer_channel_t channel;
if ( (err = snd_mixer_open( &amp;handle, card, device )) &lt; 0 ) { if ( (err = snd_mixer_open( &handle, card, device )) &lt; 0 ) {
fprintf( stderr, &quot;open failed: %s\n&quot;, snd_strerror( err ) ); fprintf( stderr, &quot;open failed: %s\n&quot;, snd_strerror( err ) );
return; return;
} }
if ( (err = snd_mixer_info( handle, &amp;info )) &lt; 0 ) { if ( (err = snd_mixer_info( handle, &info )) &lt; 0 ) {
fprintf( stderr, &quot;info failed: %s\n&quot;, snd_strerror( err ) ); fprintf( stderr, &quot;info failed: %s\n&quot;, snd_strerror( err ) );
snd_mixer_close( handle ); snd_mixer_close( handle );
return; return;
@ -241,13 +241,13 @@ printf( &quot;Installed MIXER channels for card #i and device %i: %i\n&quot;,
card + 1, device, info.channels ); card + 1, device, info.channels );
master = snd_mixer_channel( handle, SND_MIXER_ID_MASTER ); master = snd_mixer_channel( handle, SND_MIXER_ID_MASTER );
if ( master &gt;= 0 ) { if ( master &gt;= 0 ) {
if ( (err = snd_mixer_read( handle, master, &amp;channel )) &lt; 0 ) { if ( (err = snd_mixer_read( handle, master, &channel )) &lt; 0 ) {
fprintf( stderr, &quot;master read failed: %s\n&quot;, snd_strerror( err ) ); fprintf( stderr, &quot;master read failed: %s\n&quot;, snd_strerror( err ) );
snd_mixer_close( handle ); snd_mixer_close( handle );
return; return;
} }
channel -&gt; left = channel -&gt; right = 50; channel -&gt; left = channel -&gt; right = 50;
if ( (err = snd_mixer_write( handle, master, &amp;channel )) &lt; 0 ) { if ( (err = snd_mixer_write( handle, master, &channel )) &lt; 0 ) {
fprintf( stderr, &quot;master write failed: %s\n&quot;, snd_strerror( err ) ); fprintf( stderr, &quot;master write failed: %s\n&quot;, snd_strerror( err ) );
snd_mixer_close( handle ); snd_mixer_close( handle );
return; return;

View file

@ -394,7 +394,7 @@ should not be equal to <I>count</I>.</P>
of <I>snd_pcm_playback_status</I>.</P> of <I>snd_pcm_playback_status</I>.</P>
<DT><B>time</B><DD><P>Delay till played of the first sample from next write. This value should <DT><B>time</B><DD><P>Delay till played of the first sample from next write. This value should
be used for time synchronization. Returned value is in the same format as be used for time synchronization. Returned value is in the same format as
returned from the standard C function <I>gettimeofday( &amp;time, NULL )</I>. returned from the standard C function <I>gettimeofday( &time, NULL )</I>.
This variable contains right value only if playback time mode is enabled This variable contains right value only if playback time mode is enabled
(look to <I>snd_pcm_playback_time</I> function).</P> (look to <I>snd_pcm_playback_time</I> function).</P>
<DT><B>stime</B><DD><P>Time when playback was started. <DT><B>stime</B><DD><P>Time when playback was started.
@ -434,7 +434,7 @@ should not be equal to <I>count</I>.</P>
to <I>snd_pcm_record_status</I>.</P> to <I>snd_pcm_record_status</I>.</P>
<DT><B>time</B><DD><P>Lag since the next sample read was recorded. This value should be used for time <DT><B>time</B><DD><P>Lag since the next sample read was recorded. This value should be used for time
synchronization. Returned value is in the same format as returned by the synchronization. Returned value is in the same format as returned by the
from standard C function <I>gettimeofday( &amp;time, NULL )</I>. This from standard C function <I>gettimeofday( &time, NULL )</I>. This
variable contains right value only if record time mode is enabled (look to variable contains right value only if record time mode is enabled (look to
<I>snd_pcm_record_time</I> function).</P> <I>snd_pcm_record_time</I> function).</P>
<DT><B>stime</B><DD><P>Time when record was started. This variable contains right value only if <DT><B>stime</B><DD><P>Time when record was started. This variable contains right value only if
@ -503,19 +503,19 @@ char *buffer;
buffer = (char *)malloc( 512 * 1024 ); buffer = (char *)malloc( 512 * 1024 );
if ( !buffer ) return; if ( !buffer ) return;
if ( (err = snd_pcm_open( &amp;handle, card, device, SND_PCM_OPEN_PLAYBACK )) &lt; 0 ) { if ( (err = snd_pcm_open( &handle, card, device, SND_PCM_OPEN_PLAYBACK )) &lt; 0 ) {
fprintf( stderr, &quot;open failed: %s\n&quot;, snd_strerror( err ) ); fprintf( stderr, &quot;open failed: %s\n&quot;, snd_strerror( err ) );
return; return;
} }
format.format = SND_PCM_SFMT_MU_LAW; format.format = SND_PCM_SFMT_MU_LAW;
format.rate = 8000; format.rate = 8000;
format.voices = 1; format.channels = 1;
if ( (err = snd_pcm_playback_format( handle, &amp;format )) &lt; 0 ) { if ( (err = snd_pcm_playback_format( handle, &format )) &lt; 0 ) {
fprintf( stderr, &quot;format setup failed: %s\n&quot;, snd_strerror( err ) ); fprintf( stderr, &quot;format setup failed: %s\n&quot;, snd_strerror( err ) );
snd_pcm_close( handle ); snd_pcm_close( handle );
return; return;
} }
fd = open( &quot;/tmp/test.au&quot; ); fd = open( &quot;/tmp/test.au&quot;, O_RDONLY );
if ( fd &lt; 0 ) { if ( fd &lt; 0 ) {
perror( &quot;open file&quot; ); perror( &quot;open file&quot; );
snd_pcm_close( handle ); snd_pcm_close( handle );
@ -534,7 +534,7 @@ if ( !memcmp( buffer, &quot;.snd&quot;, 4 ) ) {
if ( idx &gt; 128 ) idx = 128; if ( idx &gt; 128 ) idx = 128;
if ( idx &gt; count ) idx = count; if ( idx &gt; count ) idx = count;
} }
size = snd_pcm_write( handle, &amp;buffer[ idx ], count - idx ); size = snd_pcm_write( handle, &buffer[ idx ], count - idx );
printf( &quot;Bytes written %i from %i...\n&quot;, size, count - idx ); printf( &quot;Bytes written %i from %i...\n&quot;, size, count - idx );
snd_pcm_close( handle ); snd_pcm_close( handle );
free( buffer ); free( buffer );

View file

@ -35,9 +35,9 @@ may be placed in the library code instead of the kernel driver.
For a complete list of all variables and functions in the API you should look For a complete list of all variables and functions in the API you should look
at the following header files: at the following header files:
<enum> <enum>
<item>/usr/include/sys/soundlib.h <item>/usr/include/sys/asoundlib.h
<item>/usr/include/linux/sound.h <item>/usr/include/linux/asound.h
<item>/usr/include/linux/sounddetect.h <item>/usr/include/linux/asoundid.h
</enum> </enum>
<sect>Error Codes <sect>Error Codes
@ -922,13 +922,13 @@ if ( (err = snd_pcm_open( &ero;handle, card, device, SND_PCM_OPEN_PLAYBACK )) <
} }
format.format = SND_PCM_SFMT_MU_LAW; format.format = SND_PCM_SFMT_MU_LAW;
format.rate = 8000; format.rate = 8000;
format.voices = 1; format.channels = 1;
if ( (err = snd_pcm_playback_format( handle, &ero;format )) < 0 ) { if ( (err = snd_pcm_playback_format( handle, &ero;format )) < 0 ) {
fprintf( stderr, "format setup failed: %s\n", snd_strerror( err ) ); fprintf( stderr, "format setup failed: %s\n", snd_strerror( err ) );
snd_pcm_close( handle ); snd_pcm_close( handle );
return; return;
} }
fd = open( "/tmp/test.au" ); fd = open( "/tmp/test.au", O_RDONLY );
if ( fd < 0 ) { if ( fd < 0 ) {
perror( "open file" ); perror( "open file" );
snd_pcm_close( handle ); snd_pcm_close( handle );

View file

@ -163,11 +163,11 @@
For a complete list of all variables and functions in the API you For a complete list of all variables and functions in the API you
should look at the following header files: should look at the following header files:
1. /usr/include/sys/soundlib.h 1. /usr/include/sys/asoundlib.h
2. /usr/include/linux/sound.h 2. /usr/include/linux/asound.h
3. /usr/include/linux/sounddetect.h 3. /usr/include/linux/asoundid.h
22.. EErrrroorr CCooddeess 22.. EErrrroorr CCooddeess
@ -1197,13 +1197,13 @@
} }
format.format = SND_PCM_SFMT_MU_LAW; format.format = SND_PCM_SFMT_MU_LAW;
format.rate = 8000; format.rate = 8000;
format.voices = 1; format.channels = 1;
if ( (err = snd_pcm_playback_format( handle, &format )) < 0 ) { if ( (err = snd_pcm_playback_format( handle, &format )) < 0 ) {
fprintf( stderr, "format setup failed: %s\n", snd_strerror( err ) ); fprintf( stderr, "format setup failed: %s\n", snd_strerror( err ) );
snd_pcm_close( handle ); snd_pcm_close( handle );
return; return;
} }
fd = open( "/tmp/test.au" ); fd = open( "/tmp/test.au", O_RDONLY );
if ( fd < 0 ) { if ( fd < 0 ) {
perror( "open file" ); perror( "open file" );
snd_pcm_close( handle ); snd_pcm_close( handle );

View file

@ -22,7 +22,7 @@
#ifndef __SOUNDLIB_H #ifndef __SOUNDLIB_H
#define __SOUNDLIB_H #define __SOUNDLIB_H
#include <linux/sound.h> #include <linux/asound.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>

View file

@ -5,10 +5,10 @@
include ../Makefile.conf include ../Makefile.conf
TARGET=../lib/libsound.a TARGET=../lib/libasound.a
STARGET=../lib/libsound.so STARGET=../lib/libasound.so
STARGETX=../lib/libsound.so.$(SND_LIB_VERSION) STARGETX=../lib/libasound.so.$(SND_LIB_VERSION)
STARGETO=../lib/libsound.so.$(SND_LIB_MAJOR) STARGETO=../lib/libasound.so.$(SND_LIB_MAJOR)
TARGETS=$(TARGET) $(STARGET) TARGETS=$(TARGET) $(STARGET)
STATIC_LIBS= control/libcontrol.a \ STATIC_LIBS= control/libcontrol.a \
@ -34,14 +34,14 @@ SOBJECTS=error.So
all: $(TARGETS) all: $(TARGETS)
$(TARGET): .depend $(OBJECTS) $(STATIC_LIBS) $(TARGET): .depend $(OBJECTS) $(STATIC_LIBS)
rm -f ../lib/libsound.a rm -f ../lib/libasound.a
$(LINKER) -r -o $(TARGET) $(STATIC_LIBS) $(OBJECTS) $(LINKER) -r -o $(TARGET) $(STATIC_LIBS) $(OBJECTS)
$(STARGET): .depend $(SOBJECTS) $(DYNAMIC_LIBS) $(STARGET): .depend $(SOBJECTS) $(DYNAMIC_LIBS)
rm -f ../lib/libsound*.so* rm -f ../lib/libasound*.so*
$(CC) -shared -Wl,-soname,libsound.so.$(SND_LIB_MAJOR) $(DYNAMIC_LIBS) $(SOBJECTS) -o $(STARGETX) $(CC) -shared -Wl,-soname,libasound.so.$(SND_LIB_MAJOR) $(DYNAMIC_LIBS) $(SOBJECTS) -o $(STARGETX)
ln -s libsound.so.$(SND_LIB_VERSION) $(STARGET) ln -s libasound.so.$(SND_LIB_VERSION) $(STARGET)
ln -s libsound.so.$(SND_LIB_VERSION) $(STARGETO) ln -s libasound.so.$(SND_LIB_VERSION) $(STARGETO)
control/libcontrol.a: control/libcontrol.a:
$(MAKE) -C control $(MAKE) -C control
@ -69,7 +69,7 @@ clean:
$(MAKE) -C mixer clean $(MAKE) -C mixer clean
$(MAKE) -C rawmidi clean $(MAKE) -C rawmidi clean
rm -f core .depend *.o *.So *.orig *~ rm -f core .depend *.o *.So *.orig *~
rm -f ../lib/libsound.* rm -f ../lib/libasound.*
.depend: .depend:
$(CPP) $(COPTS) $(INCLUDE) -M *.c > .depend $(CPP) $(COPTS) $(INCLUDE) -M *.c > .depend

View file

@ -26,7 +26,7 @@
#include <ctype.h> #include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "soundlib.h" #include "asoundlib.h"
#define SND_FILE_CONTROL "/dev/sndcontrol%i" #define SND_FILE_CONTROL "/dev/sndcontrol%i"

View file

@ -26,7 +26,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "soundlib.h" #include "asoundlib.h"
#define SND_FILE_CONTROL "/dev/snd/control%i" #define SND_FILE_CONTROL "/dev/snd/control%i"
#define SND_CTL_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 ) #define SND_CTL_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 )

View file

@ -24,7 +24,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "soundlib.h" #include "asoundlib.h"
static const char *snd_error_codes[] = { static const char *snd_error_codes[] = {
"Sound protocol isn't compatible" "Sound protocol isn't compatible"

View file

@ -26,7 +26,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "soundlib.h" #include "asoundlib.h"
#define SND_FILE_MIXER "/dev/snd/mixer%i%i" #define SND_FILE_MIXER "/dev/snd/mixer%i%i"
#define SND_MIXER_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 1 ) #define SND_MIXER_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 1 )

View file

@ -26,7 +26,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "soundlib.h" #include "asoundlib.h"
#define SND_FILE_PCM "/dev/snd/pcm%i%i" #define SND_FILE_PCM "/dev/snd/pcm%i%i"
#define SND_PCM_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 ) #define SND_PCM_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 )

View file

@ -26,7 +26,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "soundlib.h" #include "asoundlib.h"
#define SND_FILE_RAWMIDI "/dev/snd/midi%i%i" #define SND_FILE_RAWMIDI "/dev/snd/midi%i%i"
#define SND_PCM_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 ) #define SND_PCM_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 )

View file

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "../include/soundlib.h" #include "../include/asoundlib.h"
void main( void ) void main( void )
{ {

View file

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "../include/soundlib.h" #include "../include/asoundlib.h"
static void mixer_test( int card, int device ) static void mixer_test( int card, int device )
{ {

View file

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "../include/soundlib.h" #include "../include/asoundlib.h"
const char *get_type( unsigned int type ) const char *get_type( unsigned int type )
{ {