diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 7434ee2023..752fef914b 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -16,3 +16,6 @@ if(projectSoundTouch) add_subdirectory(SoundTouch) endif(projectSoundTouch) + +# make liba52 +add_subdirectory(liba52) \ No newline at end of file diff --git a/3rdparty/liba52/CMakeLists.txt b/3rdparty/liba52/CMakeLists.txt new file mode 100644 index 0000000000..a7f3b77114 --- /dev/null +++ b/3rdparty/liba52/CMakeLists.txt @@ -0,0 +1,45 @@ +# a52 library + +# library name +set(a52Name a52) + +# Debug - Build +if(CMAKE_BUILD_TYPE STREQUAL Debug) + # add defines + add_definitions(-g -Wall) +endif(CMAKE_BUILD_TYPE STREQUAL Debug) + +# Devel - Build +if(CMAKE_BUILD_TYPE STREQUAL Devel) + # add defines + add_definitions(-O2 -Wall -g -Os) +endif(CMAKE_BUILD_TYPE STREQUAL Devel) + +# Release - Build +if(CMAKE_BUILD_TYPE STREQUAL Release) + # add defines + add_definitions(-O2 -Wall -g -Os) +endif(CMAKE_BUILD_TYPE STREQUAL Release) + +# variable with all sources of this library +set(a52Sources + bit_allocate.c + bitstream.c + downmix.c + imdct.c + parse.c) + +# variable with all headers of this library +set(a52Headers + a52.h + a52_internal.h + attributes.h + bitstream.h + config.h + inttypes.h + mm_accel.h + tables.h + tendra.h) + +# add library +add_library(${a52Name} STATIC ${a52Sources} ${a52Headers}) diff --git a/CMakeLists.txt b/CMakeLists.txt index d20fd26999..1c6108669f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,12 @@ project(Pcsx2) # need cmake version >=2.6 cmake_minimum_required(VERSION 2.6) +# set module path +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + # include modules -include(${PROJECT_SOURCE_DIR}/cmake/Pcsx2Utils.cmake) -include(${PROJECT_SOURCE_DIR}/cmake/SearchForStuff.cmake) +include(Pcsx2Utils) +include(SearchForStuff) set(CMAKE_BUILD_TYPE Devel) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 523f25f892..64892fe0c4 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -116,7 +116,7 @@ endif(BZIP2_FOUND) #------------------------------------------------------------ # Cg optional -include(${PROJECT_SOURCE_DIR}/cmake/FindCg.cmake) +include(FindCg) # found Cg if(CG_FOUND) @@ -127,7 +127,7 @@ endif(CG_FOUND) #------------------------------------------------------------ # GLEW optional -include(${PROJECT_SOURCE_DIR}/cmake/FindGlew.cmake) +include(FindGlew) # found GLEW if(GLEW_FOUND) @@ -149,7 +149,7 @@ endif(OPENGL_FOUND) #------------------------------------------------------------ # PortAudio optional -include(${PROJECT_SOURCE_DIR}/cmake/FindPortAudio.cmake) +include(FindPortAudio) # found PortAudio if(PORTAUDIO_FOUND) @@ -172,7 +172,7 @@ endif(SDL_FOUND) #------------------------------------------------------------ # SoundTouch optional -#include(${PROJECT_SOURCE_DIR}/cmake/FindSoundTouch.cmake) +#include(FindSoundTouch) # found SoundTouch #if(SOUNDTOUCH_FOUND) @@ -190,10 +190,6 @@ endif(SDL_FOUND) # Subversion optional find_package(Subversion) - -# Liba52 optional -# Must be fixed properly -set(A52_LIBRARIES liba52.so) # subversion found if(Subversion_FOUND) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 3499e5bead..95f2605661 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -81,9 +81,9 @@ if(SPU2null) endif(SPU2null) # make spu2-x -#if(spu2-x) -# add_subdirectory(spu2-x) -#endif(spu2-x) +if(spu2-x) + add_subdirectory(spu2-x) +endif(spu2-x) # make SSSPSXPAD #if(SSSPSXPAD) diff --git a/plugins/spu2-x/src/CMakeLists.txt b/plugins/spu2-x/src/CMakeLists.txt index 16beaae278..8ccfa59a43 100644 --- a/plugins/spu2-x/src/CMakeLists.txt +++ b/plugins/spu2-x/src/CMakeLists.txt @@ -108,7 +108,7 @@ set_target_properties(${spu2xName} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/plugins) # link target with project internal libraries -target_link_libraries(${spu2xName} Utilities x86emitter) +target_link_libraries(${spu2xName} Utilities x86emitter Utilities) # link target with ALSA target_link_libraries(${spu2xName} ${ALSA_LIBRARIES}) @@ -126,6 +126,5 @@ else(projectSoundTouch) endif(projectSoundTouch) # link target with A52 -target_link_libraries(${spu2xName} ${A52_LIBRARIES}) - -target_link_libraries(${spu2xName} -m32) \ No newline at end of file +target_link_libraries(${spu2xName} a52) +target_link_libraries(${spu2xName} -m32) diff --git a/plugins/spu2-x/src/Mixer.cpp b/plugins/spu2-x/src/Mixer.cpp index c8ea78eab5..65307e765e 100644 --- a/plugins/spu2-x/src/Mixer.cpp +++ b/plugins/spu2-x/src/Mixer.cpp @@ -46,9 +46,9 @@ static const s32 tbl_XA_Factor[5][2] = // precision. // #ifdef MSC_VER -__forceinline // gcc can't inline this function, presumably because of it's exceeding complexity? -#endif -s32 MulShr32( s32 srcval, s32 mulval ) + +// gcc can't inline this function, presumably because of it's exceeding complexity? +__forceinline s32 MulShr32( s32 srcval, s32 mulval ) { s64 tmp = ((s64)srcval * mulval ); @@ -58,6 +58,21 @@ s32 MulShr32( s32 srcval, s32 mulval ) return ((s32*)&tmp)[1]; } +#else + +// gcc can't inline this function, presumably because of it's exceeding complexity? +s32 MulShr32( s32 srcval, s32 mulval ) +{ + s32 tmp; + __asm__( + ".att_syntax\n" + "imull %2\n" // do eax*%2 -> edx contains high 32 bits and eax contains low 32 bits + ".att_syntax\n" : "=d" (tmp) : "a" (srcval), "g" (mulval) + ); + return tmp; +} +#endif + __forceinline s32 clamp_mix( s32 x, u8 bitshift ) { return GetClamped( x, -0x8000<