some preparations for new JACK audio interface

This commit is contained in:
Volker Fischer 2009-03-07 22:56:46 +00:00
parent 0308768ecb
commit 3bf3ab832d
5 changed files with 56 additions and 61 deletions

View File

@ -20,20 +20,29 @@ AC_CHECK_PROGS(RPMBUILD, rpmbuild, rpm)
dnl Configuration Arguments
AC_ARG_ENABLE( sound,[ --enable-sound generic sound support], enable_sound=$enableval, enable_sound=yes)
dnl AC_ARG_WITH( qt4dir,[ --with-qtdir=path to QT],QT4DIR=$withval)
AC_ARG_ENABLE( alsa,[ --enable-alsa use ALSA interface], enable_alsa=$enableval, enable_alsa=yes)
AC_CHECK_HEADER(sys/asoundlib.h, , enable_sound=no)
AC_CHECK_LIB(asound, snd_pcm_open, , enable_sound=no)
if test "$enable_alsa" = "yes"; then
dnl checks for ALSA audio
AC_CHECK_HEADER(sys/asoundlib.h, , enable_sound=no)
AC_CHECK_LIB(asound, snd_pcm_open, , enable_sound=no)
else
dnl checks for JACK audio
AC_CHECK_HEADER([jack/jack.h], have_jack=yes, have_jack=no, [
])
dnl AM_CONDITIONAL(USE_JACK,test "$have_jack" = yes)
if test "$have_jack" = yes; then
JACK_LIB="-ljack"
AC_DEFINE(USE_JACK, 1,[Define to enable JACK input module])
fi
fi
if test "$enable_sound" = "yes"; then
AC_DEFINE(WITH_SOUND, 1, [Define if you want to use sound])
fi
if test "$enable_client" = "yes"; then
AC_DEFINE(APPL_TYPE_CLIENT, 1, [Define if you want to use client])
fi
dnl Checks for header files.
@ -78,12 +87,9 @@ fi
QT_LIBS="$QT_LIB"
QT_LDADD="-L$QTDIR/lib $QT_LIBS"
LDFLAGS="$QT_LDADD $LDFLAGS"
dnl FOO=`echo $QT_LIBS | sed -e 's/-L/-Wl,-rpath,/' | sed -e 's/-L.*//'`
dnl LDFLAGS="$LDFLAGS $FOO"
dnl LDFLAGS="-L/usr/lib $QT_LIBS $LDFLAGS"
JACK_LIBS="$JACK_LIB"
JACK_LDADD="$JACK_LIBS"
LDFLAGS="$QT_LDADD $JACK_LDADD $LDFLAGS"
AC_MSG_NOTICE([Set LDFLAGS... $LDFLAGS])
@ -94,27 +100,5 @@ AC_SUBST(QT_MOC)
AC_SUBST(QT_RCC)
AC_SUBST(QT_UIC)
dnl old QT2/QT3 code:
dnl if test "no$QTDIR" = "no"; then
dnl AC_MSG_ERROR( "*** Please set QTDIR ***" )
dnl fi
dnl
dnl saved_ldflags="$LDFLAGS"
dnl LDFLAGS="$LDFLAGS -L$QTDIR/lib"
dnl
dnl AC_HAVE_LIBRARY(qt-mt,,exit 1)
dnl
dnl AC_PATH_PROG(MOC, moc,, "$QTDIR/bin")
dnl if test -z "$MOC"; then
dnl AC_MSG_ERROR("No moc found in $QTDIR/bin");
dnl fi
dnl AC_PATH_PROG(UIC, uic,, "$QTDIR/bin")
dnl if test -z "$UIC"; then
dnl AC_MSG_ERROR("No uic found in $QTDIR/bin");
dnl fi
dnl AC_SUBST(QTDIR)
AC_CONFIG_FILES(Makefile linux/Makefile)
AC_OUTPUT

View File

@ -25,9 +25,13 @@
#include "global.h"
#if WITH_SOUND
# define ALSA_PCM_NEW_HW_PARAMS_API
# define ALSA_PCM_NEW_SW_PARAMS_API
# include <alsa/asoundlib.h>
# if USE_JACK
# include <jack/jack.h>
# else
# define ALSA_PCM_NEW_HW_PARAMS_API
# define ALSA_PCM_NEW_SW_PARAMS_API
# include <alsa/asoundlib.h>
# endif
#endif
@ -43,18 +47,20 @@
/* Classes ********************************************************************/
#if WITH_SOUND
# if USE_JACK
// TODO, see http://jackit.sourceforge.net/cgi-bin/lxr/http/source/example-clients/simple_client.c
# else
class CSound : public CSoundBase
{
public:
CSound ( void (*fpNewCallback) ( CVector<short>& psData, void* arg ), void* arg ) :
#if WITH_SOUND
CSoundBase ( false, fpNewCallback, arg ), rhandle ( NULL ),
phandle ( NULL ), iCurPeriodSizeIn ( NUM_PERIOD_BLOCKS_IN ),
iCurPeriodSizeOut ( NUM_PERIOD_BLOCKS_OUT ), bChangParamIn ( true ),
bChangParamOut ( true ) {}
#else
CSoundBase ( false, fpNewCallback, arg ) {}
#endif
CSoundBase ( false, fpNewCallback, arg ), rhandle ( NULL ),
phandle ( NULL ), iCurPeriodSizeIn ( NUM_PERIOD_BLOCKS_IN ),
iCurPeriodSizeOut ( NUM_PERIOD_BLOCKS_OUT ), bChangParamIn ( true ),
bChangParamOut ( true ) {}
virtual ~CSound() { Close(); }
// not implemented yet, always return one device and default string
@ -63,7 +69,6 @@ public:
int SetDev ( const int iNewDev ) {} // dummy
int GetDev() { return 0; }
#if WITH_SOUND
virtual int Init ( const int iNewPrefMonoBufferSize )
{
// init base class
@ -80,9 +85,9 @@ public:
}
virtual bool Read ( CVector<short>& psData );
virtual bool Write ( CVector<short>& psData );
virtual void Close();
protected:
void Close();
void InitRecording();
void InitPlayback();
@ -98,13 +103,28 @@ protected:
int iCurPeriodSizeIn;
bool bChangParamOut;
int iCurPeriodSizeOut;
};
# endif // USE_JACK
#else
// no sound -> dummy class definition
class CSound : public CSoundBase
{
public:
CSound ( void (*fpNewCallback) ( CVector<short>& psData, void* arg ), void* arg ) :
CSoundBase ( false, fpNewCallback, arg ) {}
virtual ~CSound() { Close(); }
// not used
int GetNumDev() { return 1; }
std::string GetDeviceName ( const int iDiD ) { return "wave mapper"; }
int SetDev ( const int iNewDev ) {} // dummy
int GetDev() { return 0; }
// dummy definitions
virtual int Init ( const int iNewPrefMonoBufferSize ) { CSoundBase::Init ( iNewPrefMonoBufferSize ); }
virtual int Init ( const int iNewPrefMonoBufferSize ) { CSoundBase::Init ( iNewPrefMonoBufferSize ); }
virtual bool Read ( CVector<short>& psData ) { printf ( "no sound!" ); return false; }
virtual bool Write ( CVector<short>& psData ) { printf ( "no sound!" ); return false; }
virtual void Close() {}
#endif
};
#endif // WITH_SOUND
#endif // !defined(_SOUND_H__9518A621345F78_3634567_8C0D_EEBF182CF549__INCLUDED_)

View File

@ -45,7 +45,6 @@ public:
virtual void Start();
virtual void Stop();
bool IsRunning() const { return bRun; }
virtual void Close() = 0;
virtual void OpenDriverSetup() {}

View File

@ -360,13 +360,6 @@ void CSound::Stop()
CSoundBase::Stop();
}
void CSound::Close()
{
// TODO
}
CSound::CSound ( void (*fpNewCallback) ( CVector<short>& psData, void* arg ), void* arg ) :
CSoundBase ( true, fpNewCallback, arg )
{
@ -564,7 +557,7 @@ long CSound::asioMessages ( long selector, long value, void* message, double* op
// requires changes in client class, too
ret = 1L; // 1L if request is accepted or 0 otherwise
ret = 0;//1L; // 1L if request is accepted or 0 otherwise
break;
}
return ret;

View File

@ -62,7 +62,6 @@ public:
virtual int Init ( const int iNewPrefMonoBufferSize );
virtual void Start();
virtual void Stop();
virtual void Close();
virtual void OpenDriverSetup() { ASIOControlPanel(); }