0.0.9 -> 0.1.0
+* renamed soundlib.h to asoundlib.h
+* renamed libraries from libsound to libasound
* big API changes
- added switches interfaces
* added RawMIDI API
endif
-all: include/soundlib.h
+all: include/asoundlib.h
$(MAKE) -C src
$(MAKE) -C doc
@echo
@echo "ALSA library were sucessfully compiled."
@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
cat include/header.h include/version.h include/error.h \
include/control.h include/mixer.h \
include/pcm.h include/rawmidi.h \
- include/footer.h > include/soundlib.h
+ include/footer.h > include/asoundlib.h
install: all
- $(INSTALL) -m 644 -o root -g root include/soundlib.h ${includedir}/sys
- $(INSTALL) -m 644 -o root -g root lib/libsound.a ${libdir}
- $(LN_S) -f libsound.so.${SND_LIB_VERSION} ${libdir}/libsound.so
- $(LN_S) -f libsound.so.${SND_LIB_VERSION} ${libdir}/libsound.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 include/asoundlib.h ${includedir}/sys
+ $(INSTALL) -m 644 -o root -g root lib/libasound.a ${libdir}
+ $(LN_S) -f libasound.so.${SND_LIB_VERSION} ${libdir}/libasound.so
+ $(LN_S) -f libasound.so.${SND_LIB_VERSION} ${libdir}/libasound.so.${SND_LIB_MAJOR}
+ $(INSTALL) -m 644 -o root -g root lib/libasound.so.${SND_LIB_VERSION} ${libdir}
/sbin/ldconfig
clean:
cvsclean: clean
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
chown -R root.root ../alsa-lib
dnl Checks for header files.
AC_HEADER_STDC
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.
AC_C_CONST
#echo "CFLAGS=$CFLAGS"
AC_MSG_CHECKING(for alsa-driver package)
AC_TRY_RUN([
-#include <linux/sound.h>
+#include <linux/asound.h>
void main(void)
{
#if !defined( SND_PROTOCOL_VERSION ) || !defined( SND_PROTOCOL_UNCOMPATIBLE )
<P>For a complete list of all variables and functions in the API you should look
at the following header files:
<OL>
-<LI>/usr/include/sys/soundlib.h</LI>
-<LI>/usr/include/linux/sound.h</LI>
-<LI>/usr/include/linux/sounddetect.h</LI>
+<LI>/usr/include/sys/asoundlib.h</LI>
+<LI>/usr/include/linux/asound.h</LI>
+<LI>/usr/include/linux/asoundid.h</LI>
</OL>
</P>
void *handle;
stuct snd_ctl_hw_info info;
-if ( (err = snd_ctl_open( &handle, card )) < 0 ) {
+if ( (err = snd_ctl_open( &handle, card )) < 0 ) {
fprintf( stderr, "open failed: %s\n", snd_strerror( err ) );
return;
}
-if ( (err = snd_ctl_hw_info( handle, &info )) < 0 ) {
+if ( (err = snd_ctl_hw_info( handle, &info )) < 0 ) {
fprintf( stderr, "hw info failed: %s\n", snd_strerror( err ) );
snd_ctl_close( handle );
return;
snd_mixer_info_t info;
snd_mixer_channel_t channel;
-if ( (err = snd_mixer_open( &handle, card, device )) < 0 ) {
+if ( (err = snd_mixer_open( &handle, card, device )) < 0 ) {
fprintf( stderr, "open failed: %s\n", snd_strerror( err ) );
return;
}
-if ( (err = snd_mixer_info( handle, &info )) < 0 ) {
+if ( (err = snd_mixer_info( handle, &info )) < 0 ) {
fprintf( stderr, "info failed: %s\n", snd_strerror( err ) );
snd_mixer_close( handle );
return;
card + 1, device, info.channels );
master = snd_mixer_channel( handle, SND_MIXER_ID_MASTER );
if ( master >= 0 ) {
- if ( (err = snd_mixer_read( handle, master, &channel )) < 0 ) {
+ if ( (err = snd_mixer_read( handle, master, &channel )) < 0 ) {
fprintf( stderr, "master read failed: %s\n", snd_strerror( err ) );
snd_mixer_close( handle );
return;
}
channel -> left = channel -> right = 50;
- if ( (err = snd_mixer_write( handle, master, &channel )) < 0 ) {
+ if ( (err = snd_mixer_write( handle, master, &channel )) < 0 ) {
fprintf( stderr, "master write failed: %s\n", snd_strerror( err ) );
snd_mixer_close( handle );
return;
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
be used for time synchronization. Returned value is in the same format as
-returned from the standard C function <I>gettimeofday( &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
(look to <I>snd_pcm_playback_time</I> function).</P>
<DT><B>stime</B><DD><P>Time when playback was started.
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
synchronization. Returned value is in the same format as returned by the
-from standard C function <I>gettimeofday( &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
<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
buffer = (char *)malloc( 512 * 1024 );
if ( !buffer ) return;
-if ( (err = snd_pcm_open( &handle, card, device, SND_PCM_OPEN_PLAYBACK )) < 0 ) {
+if ( (err = snd_pcm_open( &handle, card, device, SND_PCM_OPEN_PLAYBACK )) < 0 ) {
fprintf( stderr, "open failed: %s\n", snd_strerror( err ) );
return;
}
format.format = SND_PCM_SFMT_MU_LAW;
format.rate = 8000;
-format.voices = 1;
-if ( (err = snd_pcm_playback_format( handle, &format )) < 0 ) {
+format.channels = 1;
+if ( (err = snd_pcm_playback_format( handle, &format )) < 0 ) {
fprintf( stderr, "format setup failed: %s\n", snd_strerror( err ) );
snd_pcm_close( handle );
return;
}
-fd = open( "/tmp/test.au" );
+fd = open( "/tmp/test.au", O_RDONLY );
if ( fd < 0 ) {
perror( "open file" );
snd_pcm_close( handle );
if ( idx > 128 ) idx = 128;
if ( idx > count ) idx = count;
}
-size = snd_pcm_write( handle, &buffer[ idx ], count - idx );
+size = snd_pcm_write( handle, &buffer[ idx ], count - idx );
printf( "Bytes written %i from %i...\n", size, count - idx );
snd_pcm_close( handle );
free( buffer );
For a complete list of all variables and functions in the API you should look
at the following header files:
<enum>
- <item>/usr/include/sys/soundlib.h
- <item>/usr/include/linux/sound.h
- <item>/usr/include/linux/sounddetect.h
+ <item>/usr/include/sys/asoundlib.h
+ <item>/usr/include/linux/asound.h
+ <item>/usr/include/linux/asoundid.h
</enum>
<sect>Error Codes
}
format.format = SND_PCM_SFMT_MU_LAW;
format.rate = 8000;
-format.voices = 1;
+format.channels = 1;
if ( (err = snd_pcm_playback_format( handle, &ero;format )) < 0 ) {
fprintf( stderr, "format setup failed: %s\n", snd_strerror( err ) );
snd_pcm_close( handle );
return;
}
-fd = open( "/tmp/test.au" );
+fd = open( "/tmp/test.au", O_RDONLY );
if ( fd < 0 ) {
perror( "open file" );
snd_pcm_close( handle );
For a complete list of all variables and functions in the API you
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
2\b2.\b. E\bEr\brr\bro\bor\br C\bCo\bod\bde\bes\bs
}
format.format = SND_PCM_SFMT_MU_LAW;
format.rate = 8000;
- format.voices = 1;
+ format.channels = 1;
if ( (err = snd_pcm_playback_format( handle, &format )) < 0 ) {
fprintf( stderr, "format setup failed: %s\n", snd_strerror( err ) );
snd_pcm_close( handle );
return;
}
- fd = open( "/tmp/test.au" );
+ fd = open( "/tmp/test.au", O_RDONLY );
if ( fd < 0 ) {
perror( "open file" );
snd_pcm_close( handle );
#ifndef __SOUNDLIB_H
#define __SOUNDLIB_H
-#include <linux/sound.h>
+#include <linux/asound.h>
#include <unistd.h>
#include <fcntl.h>
include ../Makefile.conf
-TARGET=../lib/libsound.a
-STARGET=../lib/libsound.so
-STARGETX=../lib/libsound.so.$(SND_LIB_VERSION)
-STARGETO=../lib/libsound.so.$(SND_LIB_MAJOR)
+TARGET=../lib/libasound.a
+STARGET=../lib/libasound.so
+STARGETX=../lib/libasound.so.$(SND_LIB_VERSION)
+STARGETO=../lib/libasound.so.$(SND_LIB_MAJOR)
TARGETS=$(TARGET) $(STARGET)
STATIC_LIBS= control/libcontrol.a \
all: $(TARGETS)
$(TARGET): .depend $(OBJECTS) $(STATIC_LIBS)
- rm -f ../lib/libsound.a
+ rm -f ../lib/libasound.a
$(LINKER) -r -o $(TARGET) $(STATIC_LIBS) $(OBJECTS)
$(STARGET): .depend $(SOBJECTS) $(DYNAMIC_LIBS)
- rm -f ../lib/libsound*.so*
- $(CC) -shared -Wl,-soname,libsound.so.$(SND_LIB_MAJOR) $(DYNAMIC_LIBS) $(SOBJECTS) -o $(STARGETX)
- ln -s libsound.so.$(SND_LIB_VERSION) $(STARGET)
- ln -s libsound.so.$(SND_LIB_VERSION) $(STARGETO)
+ rm -f ../lib/libasound*.so*
+ $(CC) -shared -Wl,-soname,libasound.so.$(SND_LIB_MAJOR) $(DYNAMIC_LIBS) $(SOBJECTS) -o $(STARGETX)
+ ln -s libasound.so.$(SND_LIB_VERSION) $(STARGET)
+ ln -s libasound.so.$(SND_LIB_VERSION) $(STARGETO)
control/libcontrol.a:
$(MAKE) -C control
$(MAKE) -C mixer clean
$(MAKE) -C rawmidi clean
rm -f core .depend *.o *.So *.orig *~
- rm -f ../lib/libsound.*
+ rm -f ../lib/libasound.*
.depend:
$(CPP) $(COPTS) $(INCLUDE) -M *.c > .depend
#include <ctype.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include "soundlib.h"
+#include "asoundlib.h"
#define SND_FILE_CONTROL "/dev/sndcontrol%i"
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include "soundlib.h"
+#include "asoundlib.h"
#define SND_FILE_CONTROL "/dev/snd/control%i"
#define SND_CTL_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 )
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "soundlib.h"
+#include "asoundlib.h"
static const char *snd_error_codes[] = {
"Sound protocol isn't compatible"
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include "soundlib.h"
+#include "asoundlib.h"
#define SND_FILE_MIXER "/dev/snd/mixer%i%i"
#define SND_MIXER_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 1 )
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include "soundlib.h"
+#include "asoundlib.h"
#define SND_FILE_PCM "/dev/snd/pcm%i%i"
#define SND_PCM_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 )
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include "soundlib.h"
+#include "asoundlib.h"
#define SND_FILE_RAWMIDI "/dev/snd/midi%i%i"
#define SND_PCM_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 )
#include <stdio.h>
#include <string.h>
-#include "../include/soundlib.h"
+#include "../include/asoundlib.h"
void main( void )
{
#include <stdio.h>
#include <string.h>
-#include "../include/soundlib.h"
+#include "../include/asoundlib.h"
static void mixer_test( int card, int device )
{
#include <stdio.h>
#include <string.h>
-#include "../include/soundlib.h"
+#include "../include/asoundlib.h"
const char *get_type( unsigned int type )
{