Added configure and cmake support for libsamplerate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2945e49..00e1e46 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -267,8 +267,6 @@ set_option(DISKAUDIO "Support the disk writer audio driver" ON)
set_option(DUMMYAUDIO "Support the dummy audio driver" ON)
set_option(VIDEO_DIRECTFB "Use DirectFB video driver" OFF)
dep_option(DIRECTFB_SHARED "Dynamically load directfb support" ON "VIDEO_DIRECTFB" OFF)
-set_option(FUSIONSOUND "Use FusionSound audio driver" OFF)
-dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF)
set_option(VIDEO_DUMMY "Use dummy video driver" ON)
set_option(VIDEO_OPENGL "Include OpenGL support" ON)
set_option(VIDEO_OPENGLES "Include OpenGL ES support" ON)
@@ -287,6 +285,10 @@ dep_option(ARTS_SHARED "Dynamically load aRts audio support" ON "ARTS" O
set_option(NAS "Support the NAS audio API" ${UNIX_SYS})
set_option(NAS_SHARED "Dynamically load NAS audio API" ${UNIX_SYS})
set_option(SNDIO "Support the sndio audio API" ${UNIX_SYS})
+set_option(FUSIONSOUND "Use FusionSound audio driver" OFF)
+dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF)
+set_option(LIBSAMPLERATE "Use libsamplerate for audio rate conversion" ${UNIX_SYS})
+dep_option(LIBSAMPLERATE_SHARED "Dynamically load libsamplerate" ON "LIBSAMPLERATE" OFF)
set_option(RPATH "Use an rpath when linking SDL" ${UNIX_SYS})
set_option(CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF)
set_option(INPUT_TSLIB "Use the Touchscreen library for input" ${UNIX_SYS})
@@ -847,6 +849,7 @@ elseif(UNIX AND NOT APPLE)
CheckNAS()
CheckSNDIO()
CheckFusionSound()
+ CheckLibSampleRate()
endif()
if(SDL_VIDEO)
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index b100781..e45ab1d 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -316,6 +316,29 @@ macro(CheckFusionSound)
endmacro()
# Requires:
+# - LIBSAMPLERATE
+# Optional:
+# - LIBSAMPLERATE_SHARED opt
+# - HAVE_DLOPEN opt
+macro(CheckLibSampleRate)
+ if(LIBSAMPLERATE)
+ check_include_file(samplerate.h HAVE_LIBSAMPLERATE_H)
+ if(HAVE_LIBSAMPLERATE_H)
+ if(LIBSAMPLERATE_SHARED)
+ if(NOT HAVE_DLOPEN)
+ message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading")
+ else()
+ FindLibraryAndSONAME("samplerate")
+ set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"")
+ endif()
+ else()
+ list(APPEND EXTRA_LDFLAGS -lsamplerate)
+ endif()
+ endif()
+ endif()
+endmacro()
+
+# Requires:
# - n/a
# Optional:
# - X11_SHARED opt
diff --git a/configure b/configure
index 173b9e7..1babfd1 100755
--- a/configure
+++ b/configure
@@ -818,8 +818,12 @@ enable_nas
enable_nas_shared
enable_sndio
enable_sndio_shared
+enable_fusionsound
+enable_fusionsound_shared
enable_diskaudio
enable_dummyaudio
+enable_libsamplerate
+enable_libsamplerate_shared
enable_video_wayland
enable_video_wayland_qt_touch
enable_wayland_shared
@@ -840,8 +844,6 @@ enable_video_vivante
enable_video_cocoa
enable_video_directfb
enable_directfb_shared
-enable_fusionsound
-enable_fusionsound_shared
enable_video_dummy
enable_video_opengl
enable_video_opengles
@@ -1544,8 +1546,16 @@ Optional Features:
--enable-nas-shared dynamically load NAS audio support [[default=yes]]
--enable-sndio support the sndio audio API [[default=yes]]
--enable-sndio-shared dynamically load sndio audio support [[default=yes]]
+ --enable-fusionsound use FusionSound audio driver [[default=no]]
+ --enable-fusionsound-shared
+ dynamically load fusionsound audio support
+ [[default=yes]]
--enable-diskaudio support the disk writer audio driver [[default=yes]]
--enable-dummyaudio support the dummy audio driver [[default=yes]]
+ --enable-libsamplerate use libsamplerate for audio rate conversion
+ [[default=yes]]
+ --enable-libsamplerate-shared
+ dynamically load libsamplerate [[default=yes]]
--enable-video-wayland use Wayland video driver [[default=yes]]
--enable-video-wayland-qt-touch
QtWayland server support for Wayland video driver
@@ -1576,10 +1586,6 @@ Optional Features:
--enable-video-directfb use DirectFB video driver [[default=no]]
--enable-directfb-shared
dynamically load directfb support [[default=yes]]
- --enable-fusionsound use FusionSound audio driver [[default=no]]
- --enable-fusionsound-shared
- dynamically load fusionsound audio support
- [[default=yes]]
--enable-video-dummy use dummy video driver [[default=yes]]
--enable-video-opengl include OpenGL support [[default=yes]]
--enable-video-opengles include OpenGL ES support [[default=yes]]
@@ -18547,6 +18553,116 @@ $as_echo "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h
fi
}
+CheckFusionSound()
+{
+ # Check whether --enable-fusionsound was given.
+if test "${enable_fusionsound+set}" = set; then :
+ enableval=$enable_fusionsound;
+else
+ enable_fusionsound=no
+fi
+
+ if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
+ fusionsound=no
+
+ FUSIONSOUND_REQUIRED_VERSION=1.1.1
+
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support" >&5
+$as_echo_n "checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support... " >&6; }
+ if test x$PKG_CONFIG != xno; then
+ if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
+ FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
+ FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
+ fusionsound=yes
+ fi
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound" >&5
+$as_echo "$fusionsound" >&6; }
+
+ if test x$fusionsound = xyes; then
+
+$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h
+
+ SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
+ EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
+
+ # Check whether --enable-fusionsound-shared was given.
+if test "${enable_fusionsound_shared+set}" = set; then :
+ enableval=$enable_fusionsound_shared;
+else
+ enable_fusionsound_shared=yes
+fi
+
+ fusionsound_shared=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5
+$as_echo_n "checking for FusionSound dynamic loading support... " >&6; }
+ if test x$have_loadso != xyes && \
+ test x$enable_fusionsound_shared = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5
+$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;}
+ fi
+ if test x$have_loadso = xyes && \
+ test x$enable_fusionsound_shared = xyes; then
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so"
+_ACEOF
+
+ fusionsound_shared=yes
+ SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
+ else
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
+ SUMMARY_audio="${SUMMARY_audio} fusionsound"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5
+$as_echo "$fusionsound_shared" >&6; }
+
+ have_audio=yes
+ fi
+ fi
+}
+
CheckDiskAudio()
{
# Check whether --enable-diskaudio was given.
@@ -18583,6 +18699,52 @@ $as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h
fi
}
+CheckLibSampleRate()
+{
+ # Check whether --enable-libsamplerate was given.
+if test "${enable_libsamplerate+set}" = set; then :
+ enableval=$enable_libsamplerate;
+else
+ enable_libsamplerate=yes
+fi
+
+ if test x$enable_libsamplerate = xyes; then
+ ac_fn_c_check_header_mongrel "$LINENO" "samplerate.h" "ac_cv_header_samplerate_h" "$ac_includes_default"
+if test "x$ac_cv_header_samplerate_h" = xyes; then :
+ have_samplerate_h_hdr=yes
+else
+ have_samplerate_h_hdr=no
+fi
+
+
+ if test x$have_samplerate_h_hdr = xyes; then
+
+$as_echo "#define HAVE_LIBSAMPLERATE_H 1" >>confdefs.h
+
+
+ # Check whether --enable-libsamplerate-shared was given.
+if test "${enable_libsamplerate_shared+set}" = set; then :
+ enableval=$enable_libsamplerate_shared;
+else
+ enable_libsamplerate_shared=yes
+fi
+
+
+ if test x$enable_libsamplerate_shared = xyes; then
+ samplerate_lib=`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`
+ if test x$samplerate_lib != x; then
+ echo "-- dynamic samplerate -> $samplerate_lib"
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_LIBSAMPLERATE_DYNAMIC "$samplerate_lib"
+_ACEOF
+
+ fi
+ fi
+ fi
+ fi
+}
+
CheckVisibilityHidden()
{
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5
@@ -20959,116 +21121,6 @@ $as_echo "$directfb_shared" >&6; }
fi
}
-CheckFusionSound()
-{
- # Check whether --enable-fusionsound was given.
-if test "${enable_fusionsound+set}" = set; then :
- enableval=$enable_fusionsound;
-else
- enable_fusionsound=no
-fi
-
- if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
- fusionsound=no
-
- FUSIONSOUND_REQUIRED_VERSION=1.1.1
-
- # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PKG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
- ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support" >&5
-$as_echo_n "checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support... " >&6; }
- if test x$PKG_CONFIG != xno; then
- if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
- FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
- FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
- fusionsound=yes
- fi
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound" >&5
-$as_echo "$fusionsound" >&6; }
-
- if test x$fusionsound = xyes; then
-
-$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h
-
- SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
-
- # Check whether --enable-fusionsound-shared was given.
-if test "${enable_fusionsound_shared+set}" = set; then :
- enableval=$enable_fusionsound_shared;
-else
- enable_fusionsound_shared=yes
-fi
-
- fusionsound_shared=no
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5
-$as_echo_n "checking for FusionSound dynamic loading support... " >&6; }
- if test x$have_loadso != xyes && \
- test x$enable_fusionsound_shared = xyes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5
-$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;}
- fi
- if test x$have_loadso = xyes && \
- test x$enable_fusionsound_shared = xyes; then
-
-cat >>confdefs.h <<_ACEOF
-#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so"
-_ACEOF
-
- fusionsound_shared=yes
- SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
- else
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
- SUMMARY_audio="${SUMMARY_audio} fusionsound"
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5
-$as_echo "$fusionsound_shared" >&6; }
-
- have_audio=yes
- fi
- fi
-}
-
CheckDummyVideo()
{
# Check whether --enable-video-dummy was given.
@@ -23144,9 +23196,10 @@ case "$host" in
CheckESD
CheckNAS
CheckSNDIO
+ CheckFusionSound
+ CheckLibSampleRate
CheckX11
CheckDirectFB
- CheckFusionSound
CheckOpenGLX11
CheckOpenGLESX11
CheckMir
diff --git a/configure.in b/configure.in
index bf67b0a..47007c0 100644
--- a/configure.in
+++ b/configure.in
@@ -1049,6 +1049,58 @@ AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[
fi
}
+dnl Find FusionSound
+CheckFusionSound()
+{
+ AC_ARG_ENABLE(fusionsound,
+AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
+ , enable_fusionsound=no)
+ if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
+ fusionsound=no
+
+ FUSIONSOUND_REQUIRED_VERSION=1.1.1
+
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
+ if test x$PKG_CONFIG != xno; then
+ if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
+ FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
+ FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
+ fusionsound=yes
+ fi
+ fi
+ AC_MSG_RESULT($fusionsound)
+
+ if test x$fusionsound = xyes; then
+ AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
+ SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
+ EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
+
+ AC_ARG_ENABLE(fusionsound-shared,
+AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
+ , enable_fusionsound_shared=yes)
+ fusionsound_shared=no
+ AC_MSG_CHECKING(for FusionSound dynamic loading support)
+ if test x$have_loadso != xyes && \
+ test x$enable_fusionsound_shared = xyes; then
+ AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
+ fi
+ if test x$have_loadso = xyes && \
+ test x$enable_fusionsound_shared = xyes; then
+ AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
+ fusionsound_shared=yes
+ SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
+ else
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
+ SUMMARY_audio="${SUMMARY_audio} fusionsound"
+ fi
+ AC_MSG_RESULT($fusionsound_shared)
+
+ have_audio=yes
+ fi
+ fi
+}
+
dnl rcg07142001 See if the user wants the disk writer audio driver...
CheckDiskAudio()
{
@@ -1075,6 +1127,34 @@ AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=
fi
}
+dnl See if libsamplerate is available
+CheckLibSampleRate()
+{
+ AC_ARG_ENABLE(libsamplerate,
+AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]),
+ , enable_libsamplerate=yes)
+ if test x$enable_libsamplerate = xyes; then
+ AC_CHECK_HEADER(samplerate.h,
+ have_samplerate_h_hdr=yes,
+ have_samplerate_h_hdr=no)
+ if test x$have_samplerate_h_hdr = xyes; then
+ AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ])
+
+ AC_ARG_ENABLE(libsamplerate-shared,
+AC_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]),
+ , enable_libsamplerate_shared=yes)
+
+ if test x$enable_libsamplerate_shared = xyes; then
+ samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
+ if test x$samplerate_lib != x; then
+ echo "-- dynamic samplerate -> $samplerate_lib"
+ AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ])
+ fi
+ fi
+ fi
+ fi
+}
+
dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
CheckVisibilityHidden()
@@ -1904,58 +1984,6 @@ AC_MSG_WARN("directfb $directfb_lib")
fi
}
-dnl Find FusionSound
-CheckFusionSound()
-{
- AC_ARG_ENABLE(fusionsound,
-AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
- , enable_fusionsound=no)
- if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
- fusionsound=no
-
- FUSIONSOUND_REQUIRED_VERSION=1.1.1
-
- AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
- AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
- if test x$PKG_CONFIG != xno; then
- if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
- FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
- FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
- fusionsound=yes
- fi
- fi
- AC_MSG_RESULT($fusionsound)
-
- if test x$fusionsound = xyes; then
- AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
- SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
-
- AC_ARG_ENABLE(fusionsound-shared,
-AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
- , enable_fusionsound_shared=yes)
- fusionsound_shared=no
- AC_MSG_CHECKING(for FusionSound dynamic loading support)
- if test x$have_loadso != xyes && \
- test x$enable_fusionsound_shared = xyes; then
- AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
- fi
- if test x$have_loadso = xyes && \
- test x$enable_fusionsound_shared = xyes; then
- AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
- fusionsound_shared=yes
- SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
- else
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
- SUMMARY_audio="${SUMMARY_audio} fusionsound"
- fi
- AC_MSG_RESULT($fusionsound_shared)
-
- have_audio=yes
- fi
- fi
-}
-
dnl rcg04172001 Set up the Null video driver.
CheckDummyVideo()
{
@@ -2968,9 +2996,10 @@ case "$host" in
CheckESD
CheckNAS
CheckSNDIO
+ CheckFusionSound
+ CheckLibSampleRate
CheckX11
CheckDirectFB
- CheckFusionSound
CheckOpenGLX11
CheckOpenGLESX11
CheckMir
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index cfe5505..2c14504 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -83,6 +83,7 @@
#cmakedefine HAVE_DBUS_DBUS_H 1
#cmakedefine HAVE_IBUS_IBUS_H 1
#cmakedefine HAVE_FCITX_FRONTEND_H 1
+#cmakedefine HAVE_LIBSAMPLERATE_H 1
/* C library functions */
#cmakedefine HAVE_MALLOC 1
@@ -358,6 +359,8 @@
#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
+/* Enable dynamic libsamplerate support */
+#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@
/* Platform specific definitions */
#if !defined(__WIN32__)
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 5025d8d..8fbde7d 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -83,6 +83,7 @@
#undef HAVE_DBUS_DBUS_H
#undef HAVE_IBUS_IBUS_H
#undef HAVE_FCITX_FRONTEND_H
+#undef HAVE_LIBSAMPLERATE_H
/* C library functions */
#undef HAVE_MALLOC
@@ -363,4 +364,7 @@
/* Enable dynamic udev support */
#undef SDL_UDEV_DYNAMIC
+/* Enable dynamic libsamplerate support */
+#undef SDL_LIBSAMPLERATE_DYNAMIC
+
#endif /* SDL_config_h_ */
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index 7bc3ffe..2ad0706 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -29,7 +29,7 @@
#include "SDL_assert.h"
#include "../SDL_dataqueue.h"
-#ifdef HAVE_LIBSAMPLERATE
+#if HAVE_LIBSAMPLERATE_H
#include "samplerate.h"
#endif
@@ -633,7 +633,7 @@ struct SDL_AudioStream
SDL_CleanupAudioStreamResamplerFunc cleanup_resampler_func;
};
-#ifdef HAVE_LIBSAMPLERATE
+#ifdef HAVE_LIBSAMPLERATE_H
typedef struct
{
@@ -651,8 +651,8 @@ typedef struct
static SDL_bool
LoadLibSampleRate(SDL_AudioStreamResamplerState_SRC *state)
{
-#ifdef LIBSAMPLERATE_DYNAMIC
- state->SRC_lib = SDL_LoadObject(LIBSAMPLERATE_DYNAMIC);
+#ifdef SDL_LIBSAMPLERATE_DYNAMIC
+ state->SRC_lib = SDL_LoadObject(SDL_LIBSAMPLERATE_DYNAMIC);
if (!state->SRC_lib) {
return SDL_FALSE;
}
@@ -676,7 +676,7 @@ SDL_ResampleAudioStream_SRC(SDL_AudioStream *stream, const float *inbuf, const i
SRC_DATA data;
int result;
- data.data_in = inbuf;
+ data.data_in = (float *)inbuf; /* Older versions of libsamplerate had a non-const pointer, but didn't write to it */
data.input_frames = inbuflen / ( sizeof(float) * stream->pre_resample_channels );
data.input_frames_used = 0;
@@ -752,7 +752,7 @@ SetupLibSampleRateResampling(SDL_AudioStream *stream)
return SDL_TRUE;
}
-#endif /* HAVE_LIBSAMPLERATE */
+#endif /* HAVE_LIBSAMPLERATE_H */
typedef struct
{
@@ -873,7 +873,7 @@ SDL_AudioStream *SDL_NewAudioStream(const SDL_AudioFormat src_format,
return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */
}
-#ifdef HAVE_LIBSAMPLERATE
+#ifdef HAVE_LIBSAMPLERATE_H
SetupLibSampleRateResampling(retval);
#endif