removed already broken support for building LMMS without libsamplerate

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@499 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2007-07-29 20:33:13 +00:00
parent eb99ab60db
commit 22f1720701
7 changed files with 32 additions and 316 deletions

View File

@@ -5,6 +5,14 @@
- replaced "+=" operator by according X="$X ..." constructs as older
bashes have problems with it
* configure.in:
* Makefile.am:
* include/audio_device.h:
* include/sample_buffer.h:
* src/audio/audio_device.cpp:
* src/lib/sample_buffer.cpp:
removed already broken support for building LMMS without libsamplerate
* acinclude.m4:
disabled Qt4-support - re-enable it / rewrite Qt4-detection code in
0.4.x-devel-branch

View File

@@ -388,9 +388,7 @@ if HAVE_LIBVORBIS
LIB_VORBIS_LDADD = -lvorbis -lvorbisenc -lvorbisfile
endif
if HAVE_LIBSRC
LIB_SRC_LDADD = -lsamplerate
endif
if HAVE_LIBSF
LIB_SF_LDADD = -lsndfile

View File

@@ -320,47 +320,37 @@ AM_CONDITIONAL(HAVE_LIBFLAC, test ! -z "$HAVE_LIBFLAC")
# check for libsamplerate
AC_ARG_WITH(libsrc,
AS_HELP_STRING([--without-libsrc],
[disable support for resampling via libsamplerate]), ,
[ with_libsrc=yes ])
AH_TEMPLATE(HAVE_SAMPLERATE_H, [Define to 1 if you have the <samplerate.h> header file.])
if test "x$with_libsrc" = "xyes" ; then
AC_CHECK_HEADER(samplerate.h, HAVE_SAMPLERATE_H="true")
AC_CHECK_LIB([samplerate], [src_simple], HAVE_LIBSRC="true", HAVE_SAMPLERATE_H="")
AC_CHECK_HEADER(samplerate.h, HAVE_SAMPLERATE_H="true")
AC_CHECK_LIB([samplerate], [src_simple], HAVE_LIBSRC="true", HAVE_SAMPLERATE_H="")
if test -z "$HAVE_SAMPLERATE_H" ; then
AC_MSG_ERROR([*** libsamplerate and/or it's devel-package is missing. Please make sure to fulfill this requirement in order to successfully configure and compile LMMS.])
fi
if test ! -z "$HAVE_SAMPLERATE_H" ; then
AC_DEFINE(HAVE_SAMPLERATE_H)
fi
AM_CONDITIONAL(HAVE_LIBSRC, test ! -z "$HAVE_SAMPLERATE_H")
# check for Festival
if test ! -z "$HAVE_SAMPLERATE_H" ; then
AC_LANG_PUSH(C++)
AC_ARG_WITH(singerbot,
AS_HELP_STRING([--without-singerbot],
[disable support for SingerBot plugin]), ,
[ with_singerbot=yes ])
AH_TEMPLATE(SINGERBOT_SUPPORT,
[Define to 1 to enable SingerBot plugin support.])
if test "x$with_singerbot" = "xyes" ; then
ORIG_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I/usr/include/festival -I/usr/include/speech_tools -Wno-non-template-friend"
AC_CHECK_HEADER([festival.h], FESTIVAL_SUPPORT="true")
AC_CHECK_LIB([Festival], [main], true, FESTIVAL_SUPPORT="")
CPPFLAGS=$ORIG_CPPFLAGS
fi
if test ! -z "$FESTIVAL_SUPPORT" ; then
AC_DEFINE(SINGERBOT_SUPPORT)
fi
AC_LANG_POP(C++)
AC_LANG_PUSH(C++)
AC_ARG_WITH(singerbot,
AS_HELP_STRING([--without-singerbot],
[disable support for SingerBot plugin]), ,
[ with_singerbot=yes ])
AH_TEMPLATE(SINGERBOT_SUPPORT,
[Define to 1 to enable SingerBot plugin support.])
if test "x$with_singerbot" = "xyes" ; then
ORIG_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I/usr/include/festival -I/usr/include/speech_tools -Wno-non-template-friend"
AC_CHECK_HEADER([festival.h], FESTIVAL_SUPPORT="true")
AC_CHECK_LIB([Festival], [main], true, FESTIVAL_SUPPORT="")
CPPFLAGS=$ORIG_CPPFLAGS
fi
if test ! -z "$FESTIVAL_SUPPORT" ; then
AC_DEFINE(SINGERBOT_SUPPORT)
fi
AC_LANG_POP(C++)
AM_CONDITIONAL(SINGERBOT_SUPPORT, test ! -z "$FESTIVAL_SUPPORT" )
# libsndfile-stuff
AC_ARG_WITH(sndfile,
AC_ARG_WITH(libsf,
AS_HELP_STRING([--without-libsf],
[disable support for importing files via libsndfile]), ,
[ with_libsf=yes ])
@@ -792,22 +782,6 @@ else
fi
if test -z "$HAVE_SAMPLERATE_H" ; then
echo " ========================"
echo " === LMMS - WARNING ======================================================="
echo " ========================"
echo " ="
echo " = You don't seem to have libsamplerate installed and/or libsamplerate-"
echo " = development-package is missing. This will disable resampling with"
echo " = libsamplerate and results in worse quality! Currently LMMS will also"
echo " = crash more often, because internal sample-rate-converter has some bugs..."
echo " = Consider installing the missing packages for using the full power of LMMS."
echo " ="
with_warnings="true"
else
PLUGINS_TO_BUILD="$PLUGINS_TO_BUILD\n\t\* libsamplerate for internal samplerate-conversion"
fi
if test -z "$FESTIVAL_SUPPORT" ; then
if test "x$with_singerbot" = "xyes" ; then
@@ -815,11 +789,7 @@ if test -z "$FESTIVAL_SUPPORT" ; then
echo " === LMMS - WARNING ======================================================="
echo " ========================"
echo " ="
if test -z "$HAVE_SAMPLERATE_H" ; then
echo " = You don't seem to have libsamplerate support."
else
echo " = You don't seem to have Festival development files."
fi
echo " = You don't seem to have Festival development files."
echo " = The SingerBot instrument plugin will be ignored."
echo " = Before enabling this plugin, bear in mind that it is still experimental."
echo " ="

View File

@@ -46,9 +46,7 @@
#include <config.h>
#endif
#ifdef HAVE_SAMPLERATE_H
#include <samplerate.h>
#endif
#include "mixer.h"
@@ -188,10 +186,8 @@ private:
QMutex m_devMutex;
#ifdef HAVE_SAMPLERATE_H
SRC_DATA m_srcData;
SRC_STATE * m_srcState;
#endif
surroundSampleFrame * m_buffer;

View File

@@ -43,9 +43,7 @@
#include <config.h>
#endif
#ifdef HAVE_SAMPLERATE_H
#include <samplerate.h>
#endif
#include "mixer.h"
@@ -79,9 +77,7 @@ public:
private:
f_cnt_t m_frame_index;
const bool m_varying_pitch;
#ifdef HAVE_SAMPLERATE_H
SRC_STATE * m_resampling_data;
#endif
friend class sampleBuffer;
@@ -264,11 +260,9 @@ private:
float m_frequency;
sample_rate_t m_sample_rate;
#ifdef HAVE_SAMPLERATE_H
void initResampling( void );
SRC_DATA m_srcData;
#endif
sampleFrame * m_sample_fragment;
sampleFrame * getSampleFragment( f_cnt_t _start, f_cnt_t _frames,

View File

@@ -44,7 +44,6 @@ audioDevice::audioDevice( const sample_rate_t _sample_rate,
m_mixer( _mixer ),
m_buffer( new surroundSampleFrame[getMixer()->framesPerAudioBuffer()] )
{
#ifdef HAVE_SAMPLERATE_H
int error;
if( ( m_srcState = src_new(
#ifdef HQ_SINC
@@ -57,7 +56,6 @@ audioDevice::audioDevice( const sample_rate_t _sample_rate,
printf( "Error: src_new() failed in audio_device.cpp!\n" );
}
m_srcData.end_of_input = 0;
#endif
}
@@ -65,9 +63,7 @@ audioDevice::audioDevice( const sample_rate_t _sample_rate,
audioDevice::~audioDevice()
{
#ifdef HAVE_SAMPLERATE_H
src_delete( m_srcState );
#endif
delete[] m_buffer;
#ifdef QT3
if( m_devMutex.locked() )
@@ -166,45 +162,12 @@ void audioDevice::renamePort( audioPort * )
#ifndef HAVE_SAMPLERATE_H
const Uint8 LP_FILTER_TAPS = 24;
const float LP_FILTER_COEFFS[LP_FILTER_TAPS] =
{
+0.000511851442,
-0.001446936402,
-0.005058312516,
-0.002347181570,
+0.011236146012,
+0.020351310667,
-0.000479735368,
-0.045333228189
-0.055186434405,
+0.032962246498,
+0.202439670159,
+0.342350604673,
+0.342350604673,
+0.202439670159,
+0.032962246498,
-0.055186434405,
-0.045333228189
-0.000479735368,
+0.020351310667,
+0.011236146012,
-0.002347181570,
-0.005058312516,
-0.001446936402,
+0.000511851442
} ;
#endif
void FASTCALL audioDevice::resample( const surroundSampleFrame * _src,
const fpab_t _frames,
surroundSampleFrame * _dst,
const sample_rate_t _src_sr,
const sample_rate_t _dst_sr )
{
#ifdef HAVE_SAMPLERATE_H
if( m_srcState == NULL )
{
return;
@@ -221,95 +184,6 @@ void FASTCALL audioDevice::resample( const surroundSampleFrame * _src,
printf( "audioDevice::resample(): error while resampling: %s\n",
src_strerror( error ) );
}
#else
if( _src_sr == 2 * SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] )
{
// we use a simple N-tap FIR-Filter with
// precalculated/-designed LP-Coeffs
static surroundSampleFrame lp_hist[LP_FILTER_TAPS] =
{
#ifndef DISABLE_SURROUND
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f }
#else
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f },
{ 0.0f, 0.0f }
#endif
} ;
static Uint8 oldest = 0;
for( fpab_t frame = 0; frame < _frames; ++frame )
{
for( ch_cnt_t chnl = 0; chnl < SURROUND_CHANNELS;
++chnl )
{
lp_hist[oldest][chnl] = _src[frame][chnl];
if( frame % 2 == 0 )
{
const fpab_t f = frame / 2;
_dst[f][chnl] = 0.0f;
for( Uint8 tap = 0;
tap < LP_FILTER_TAPS; ++tap )
{
_dst[f][chnl] +=
LP_FILTER_COEFFS[tap] * lp_hist[( oldest + tap ) % LP_FILTER_TAPS][chnl];
}
}
}
oldest = ( oldest + 1 ) % LP_FILTER_TAPS;
}
}
else if( _src_sr == SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] / 2 )
{
printf( "No resampling for given sample-rates implemented!\n"
"Consider installing libsamplerate and recompile "
"LMMS!\n" );
}
#endif
}

View File

@@ -120,9 +120,7 @@ sampleBuffer::sampleBuffer( const QString & _audio_file,
// init sound-file-system of SDL
Sound_Init();
#endif
#ifdef HAVE_SAMPLERATE_H
initResampling();
#endif
if( _is_base64_data == TRUE )
{
loadFromBase64( _audio_file );
@@ -156,9 +154,7 @@ sampleBuffer::sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames ) :
// init sound-file-system of SDL
Sound_Init();
#endif
#ifdef HAVE_SAMPLERATE_H
initResampling();
#endif
update();
}
@@ -188,9 +184,7 @@ sampleBuffer::sampleBuffer( const f_cnt_t _frames ) :
// init sound-file-system of SDL
Sound_Init();
#endif
#ifdef HAVE_SAMPLERATE_H
initResampling();
#endif
update();
}
@@ -591,12 +585,10 @@ f_cnt_t sampleBuffer::decodeSampleOGGVorbis( const char * _f,
#ifdef HAVE_SAMPLERATE_H
void sampleBuffer::initResampling( void )
{
m_srcData.end_of_input = 0;
}
#endif
@@ -656,24 +648,9 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, handleState * _state,
}
}
/* Uint32 f2 = 0;
while( f2 < f1 )
{
f2 += frames_to_process * freq_factor;
}
if( f2 > f1 && f2 >= frames_to_process )
{
f2 -= frames_to_process * freq_factor;
}*/
// static int foo = 0;
// calc pointer of first frame
//printf("diff:%d %f %d f2: %d input: %d\n", f2 -foo, play_frame * freq_factor, static_cast<Uint32>( play_frame * freq_factor ), f2, (Uint32)( frames_for_loop * freq_factor ) );
// foo = f2;
// check whether we have to change pitch...
if( freq_factor != 1.0 || _state->m_varying_pitch )
{
#ifdef HAVE_SAMPLERATE_H
// Generate output
const f_cnt_t margin = 64;
f_cnt_t fragment_size = (f_cnt_t)( _frames * freq_factor )
@@ -702,82 +679,6 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, handleState * _state,
{
play_frame = getLoopedIndex( play_frame );
}
#else
f_cnt_t src_frame_base = 0;
// check whether we're in high-quality-mode
if( engine::getMixer()->highQuality() == TRUE )
{
// we are, so let's use cubic interpolation...
for( f_cnt_t frame = 0; frame < frames_to_process;
++frame )
{
// current loop done?
if( _looped && ( frame-src_frame_base ) >
frames_for_loop )
{
start_frame = loop_start;
src_frame_base = frame;
frames_for_loop = frames_to_process %
total_frames_for_current_pitch;
}
const float src_frame_idx = frame * freq_factor;
f_cnt_t frame_num = static_cast<f_cnt_t>(
src_frame_idx) - src_frame_base;
const float frac_pos = src_frame_idx -
static_cast<f_cnt_t>( src_frame_idx );
// because of cubic interpolation we have to
// access start_frame[frame_num-1], so make
// sure we don't access data out of
// buffer-array-boundaries
if( frame_num == 0 && play_frame == 0 )
{
frame_num = 1;
}
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS;
++chnl )
{
_ab[frame][chnl] = cubicInterpolate(
start_frame[frame_num-1][chnl],
start_frame[frame_num+0][chnl],
start_frame[frame_num+1][chnl],
start_frame[frame_num+2][chnl],
frac_pos );
}
}
}
else
{
// just normal mode, so we can use linear
// interpolation...
for( f_cnt_t frame = 0; frame < frames_to_process;
++frame )
{
if( _looped && ( frame - src_frame_base ) >
frames_for_loop )
{
start_frame = loop_start;
src_frame_base = frame;
frames_for_loop = frames_to_process %
total_frames_for_current_pitch;
}
const float src_frame_idx = frame * freq_factor;
const f_cnt_t frame_num =
(f_cnt_t)src_frame_idx-src_frame_base;
const float frac_pos = src_frame_idx -
(f_cnt_t) src_frame_idx;
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS;
++chnl )
{
_ab[frame][chnl] = linearInterpolate(
start_frame[frame_num][chnl],
start_frame[frame_num+1][chnl],
frac_pos );
}
}
}
#endif
}
else
{
@@ -1162,7 +1063,7 @@ sampleBuffer * sampleBuffer::resample( sampleFrame * _data,
(float) _src_sr * (float) _dst_sr );
sampleBuffer * dst_sb = new sampleBuffer( dst_frames );
sampleFrame * dst_buf = dst_sb->m_origData;
#ifdef HAVE_SAMPLERATE_H
// yeah, libsamplerate, let's rock with sinc-interpolation!
int error;
SRC_STATE * state;
@@ -1188,27 +1089,6 @@ sampleBuffer * sampleBuffer::resample( sampleFrame * _data,
{
printf( "Error: src_new() failed in sample_buffer.cpp!\n" );
}
#else
// no libsamplerate, so do simple cubic interpolation
for( f_cnt_t frame = 0; frame < dst_frames; ++frame )
{
const float src_frame_float = frame * (float) _src_sr / _dst_sr;
const float frac_pos = src_frame_float -
static_cast<f_cnt_t>( src_frame_float );
const f_cnt_t src_frame = tLimit<f_cnt_t>(
static_cast<f_cnt_t>( src_frame_float ),
1, _frames - 3 );
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )
{
dst_buf[frame][ch] = cubicInterpolate(
_data[src_frame - 1][ch],
_data[src_frame + 0][ch],
_data[src_frame + 1][ch],
_data[src_frame + 2][ch],
frac_pos );
}
}
#endif
dst_sb->update();
return( dst_sb );
}
@@ -1476,7 +1356,6 @@ sampleBuffer::handleState::handleState( bool _varying_pitch ) :
m_frame_index( 0 ),
m_varying_pitch( _varying_pitch )
{
#ifdef HAVE_SAMPLERATE_H
int error;
if( ( m_resampling_data = src_new(/*
( engine::getMixer()->highQuality() == TRUE ) ?
@@ -1486,7 +1365,6 @@ sampleBuffer::handleState::handleState( bool _varying_pitch ) :
{
printf( "Error: src_new() failed in sample_buffer.cpp!\n" );
}
#endif
}
@@ -1494,9 +1372,7 @@ sampleBuffer::handleState::handleState( bool _varying_pitch ) :
sampleBuffer::handleState::~handleState()
{
#ifdef HAVE_SAMPLERATE_H
src_delete( m_resampling_data );
#endif
}