From 30c773266538fce0aa9805614130e835dd5c6aee Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 27 Oct 2008 21:25:46 +0000 Subject: [PATCH] various fixes for successfully building LMMS for win64 git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1804 0778d3d1-df1d-0410-868b-ea421aaaa00d --- CMakeLists.txt | 33 ++++- ChangeLog | 19 +++ cmake/modules/BuildPlugin.cmake | 2 +- cmake/modules/DetectMachine.cmake | 26 ++-- lmmsconfig.h.in | 1 + plugins/ladspa_effect/caps/CMakeLists.txt | 6 +- plugins/ladspa_effect/caps/dsp/windows.h | 4 + plugins/ladspa_effect/cmt/CMakeLists.txt | 2 +- plugins/ladspa_effect/swh/CMakeLists.txt | 2 +- plugins/ladspa_effect/tap/CMakeLists.txt | 2 +- plugins/midi_import/portsmf/allegro.h | 12 +- plugins/vst_base/CMakeLists.txt | 4 +- plugins/vst_base/basename.c | 166 ++++++++++++++++++++++ plugins/vst_base/remote_vst_plugin.cpp | 10 +- src/core/midi/midi_winmm.cpp | 2 +- src/core/mixer.cpp | 4 +- 16 files changed, 264 insertions(+), 31 deletions(-) create mode 100755 plugins/vst_base/basename.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 926053753..9ebc3a85e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,11 @@ ADD_DEFINITIONS(-D'LMMS_VERSION="${VERSION}"') INCLUDE(DetectMachine) +IF(LMMS_HOST_X86_64) + SET(STRIP /opt/mingw64/bin/x86_64-pc-mingw32-strip) +ELSE(LMMS_HOST_X86_64) + SET(STRIP /opt/mingw/bin/i586-mingw32-strip) +ENDIF(LMMS_HOST_X86_64) OPTION(WANT_ALSA "Include ALSA (Advanced Linux Sound Architecture) support" ON) OPTION(WANT_CAPS "Include C* Audio Plugin Suite (LADSPA plugins)" ON) @@ -366,8 +371,16 @@ QT4_WRAP_UI(lmms_UI_out ${lmms_UI}) # embedded resources stuff -ADD_EXECUTABLE(bin2res buildtools/bin2res.cpp) -GET_TARGET_PROPERTY(BIN2RES bin2res LOCATION) +IF(WIN32 OR WIN64) + # compile buildtools native + SET(BIN2RES_CPP ${CMAKE_SOURCE_DIR}/buildtools/bin2res.cpp) + SET(BIN2RES ${CMAKE_BINARY_DIR}/bin2res) + ADD_CUSTOM_COMMAND(OUTPUT ${BIN2RES} COMMAND g++ ARGS ${BIN2RES_CPP} -o ${BIN2RES} DEPENDS ${BIN2RES_CPP}) +ELSE(WIN32 OR WIN64) + ADD_EXECUTABLE(bin2res buildtools/bin2res.cpp) + GET_TARGET_PROPERTY(BIN2RES bin2res LOCATION) +ENDIF(WIN32 OR WIN64) + SET(LMMS_ER_H ${CMAKE_CURRENT_BINARY_DIR}/embedded_resources.h) # we somehow have to make LMMS-binary depend on MOC-files @@ -377,8 +390,13 @@ ADD_CUSTOM_COMMAND(OUTPUT ${LMMS_ER_H} COMMAND ${BIN2RES} ARGS ${lmms_EMBEDDED_R IF(WIN32) SET(WINRC "${CMAKE_BINARY_DIR}/lmmsrc.obj") + IF(LMMS_HOST_X86_64) + SET(WINDRES /opt/mingw64/bin/x86_64-pc-mingw32-windres) + ELSE(LMMS_HOST_X86_64) + SET(WINDRES /opt/mingw/bin/i586-mingw32-windres) + ENDIF(LMMS_HOST_X86_64) ADD_CUSTOM_COMMAND(OUTPUT ${WINRC} - COMMAND /opt/mingw/bin/i586-mingw32-windres + COMMAND ${WINDRES} -I${CMAKE_SOURCE_DIR} -o${CMAKE_BINARY_DIR}/lmmsrc.obj -i${CMAKE_BINARY_DIR}/lmms.rc @@ -410,9 +428,14 @@ ADD_EXECUTABLE(lmms ${lmms_SOURCES} ${lmms_INCLUDES} ${LIBSAMPLERATE_SOURCES} ${ IF(LMMS_BUILD_WIN32) SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -mwindows") - ADD_CUSTOM_COMMAND(TARGET lmms POST_BUILD COMMAND /opt/mingw/bin/i586-mingw32-strip ${CMAKE_BINARY_DIR}/lmms.exe) + ADD_CUSTOM_COMMAND(TARGET lmms POST_BUILD COMMAND ${STRIP} ${CMAKE_BINARY_DIR}/lmms.exe) + INSTALL(TARGETS lmms RUNTIME DESTINATION .) - INSTALL(FILES /opt/mingw/bin/QtCore4.dll /opt/mingw/bin/QtGui4.dll /opt/mingw/bin/QtXml4.dll /opt/mingw/bin/libz.dll /opt/mingw/bin/libsndfile-1.dll /opt/mingw/bin/libvorbis-0.dll /opt/mingw/bin/libvorbisenc-2.dll /opt/mingw/bin/libvorbisfile-3.dll /opt/mingw/bin/libogg-0.dll /opt/mingw/bin/libfluidsynth-1.dll /opt/mingw/bin/libfftw3f-3.dll /opt/mingw/bin/SDL.dll /opt/mingw/i586-mingw32/bin/mingwm10.dll DESTINATION .) + IF(LMMS_BUILD_WIN64) + INSTALL(FILES /opt/mingw64/bin/QtCore4.dll /opt/mingw64/bin/QtGui4.dll /opt/mingw64/bin/QtXml4.dll /opt/mingw64/bin/libz.dll /opt/mingw64/bin/libsndfile-1.dll /opt/mingw64/bin/libfluidsynth-1.dll /opt/mingw64/bin/SDL.dll DESTINATION .) + ELSE(LMMS_BUILD_WIN64) + INSTALL(FILES /opt/mingw/bin/QtCore4.dll /opt/mingw/bin/QtGui4.dll /opt/mingw/bin/QtXml4.dll /opt/mingw/bin/libz.dll /opt/mingw/bin/libsndfile-1.dll /opt/mingw/bin/libvorbis-0.dll /opt/mingw/bin/libvorbisenc-2.dll /opt/mingw/bin/libvorbisfile-3.dll /opt/mingw/bin/libogg-0.dll /opt/mingw/bin/libfluidsynth-1.dll /opt/mingw/bin/libfftw3f-3.dll /opt/mingw/bin/SDL.dll /opt/mingw/i586-mingw32/bin/mingwm10.dll DESTINATION .) + ENDIF(LMMS_BUILD_WIN64) ELSE(LMMS_BUILD_WIN32) INSTALL(TARGETS lmms RUNTIME DESTINATION bin) INSTALL(FILES ${CMAKE_BINARY_DIR}/lmms.1.gz DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1/ PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) diff --git a/ChangeLog b/ChangeLog index 9e34c1f33..0adc72a83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2008-10-27 Tobias Doerffel + + * cmake/modules/DetectMachine.cmake: + * cmake/modules/BuildPlugin.cmake: + * plugins/ladspa_effect/swh/CMakeLists.txt: + * plugins/ladspa_effect/cmt/CMakeLists.txt: + * plugins/ladspa_effect/tap/CMakeLists.txt: + * plugins/ladspa_effect/caps/CMakeLists.txt: + * plugins/ladspa_effect/caps/dsp/windows.h: + * plugins/vst_base/remote_vst_plugin.cpp: + * plugins/vst_base/basename.c: + * plugins/vst_base/CMakeLists.txt: + * plugins/midi_import/portsmf/allegro.h: + * src/core/midi/midi_winmm.cpp: + * src/core/mixer.cpp: + * lmmsconfig.h.in: + * CMakeLists.txt: + various fixes for successfully building LMMS for win64 + 2008-10-25 Tobias Doerffel * include/mixer.h: diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index acba52592..7d331874c 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -90,7 +90,7 @@ MACRO(BUILD_PLUGIN) ENDIF(LMMS_BUILD_APPLE) IF(LMMS_BUILD_WIN32) SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "") - ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND /opt/mingw/bin/i586-mingw32-strip ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_NAME}.dll) + ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_NAME}.dll) ENDIF(LMMS_BUILD_WIN32) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ER_H} ${plugin_MOC_out}") diff --git a/cmake/modules/DetectMachine.cmake b/cmake/modules/DetectMachine.cmake index decda4466..457a65d3a 100644 --- a/cmake/modules/DetectMachine.cmake +++ b/cmake/modules/DetectMachine.cmake @@ -9,22 +9,24 @@ ELSE(WIN32) ENDIF(WIN32) MESSAGE("PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") -EXEC_PROGRAM( uname ARGS "-m" OUTPUT_VARIABLE Machine ) +EXEC_PROGRAM( ${CMAKE_C_COMPILER} ARGS "-dumpmachine" OUTPUT_VARIABLE Machine ) MESSAGE("Machine: ${Machine}") SET(LMMS_HOST_X86 FALSE) SET(LMMS_HOST_X86_64 FALSE) - -IF(${Machine} MATCHES "i686" OR ${Machine} MATCHES "i386" ) - MESSAGE("-- This is an 32 bit machine") +STRING(REGEX MATCH "i.86" IS_X86 "${Machine}") +STRING(REGEX MATCH "86_64" IS_X86_64 "${Machine}") +IF(IS_X86) + MESSAGE("-- Target host is 32 bit") SET(LMMS_HOST_X86 TRUE) -ELSE(${Machine} MATCHES "i686" OR ${Machine} MATCHES "i386" ) - IF(${Machine} MATCHES "x86_64") - MESSAGE("-- This is an 64 bit machine") - SET(LMMS_HOST_X86_64 TRUE) - ELSE(${Machine} MATCHES "x86_64") - MESSAGE("Can't identify this machine. Assuming 32 bit platform ") - ENDIF(${Machine} MATCHES "x86_64") -ENDIF(${Machine} MATCHES "i686" OR ${Machine} MATCHES "i386" ) +ELSEIF(IS_X86_64) + MESSAGE("-- Target host is 64 bit") + SET(LMMS_HOST_X86_64 TRUE) + IF(WIN32) + SET(LMMS_BUILD_WIN64 1) + ENDIF(WIN32) +ELSE(IS_X86) + MESSAGE("Can't identify target host. Assuming 32 bit platform.") +ENDIF(IS_X86) IF(CMAKE_INSTALL_LIBDIR) SET(LIB_DIR "${CMAKE_INSTALL_LIBDIR}") diff --git a/lmmsconfig.h.in b/lmmsconfig.h.in index 4e0e6861d..4965d2433 100644 --- a/lmmsconfig.h.in +++ b/lmmsconfig.h.in @@ -1,5 +1,6 @@ #cmakedefine LMMS_BUILD_LINUX #cmakedefine LMMS_BUILD_WIN32 +#cmakedefine LMMS_BUILD_WIN64 #cmakedefine LMMS_BUILD_APPLE #cmakedefine LMMS_HOST_X86 diff --git a/plugins/ladspa_effect/caps/CMakeLists.txt b/plugins/ladspa_effect/caps/CMakeLists.txt index a6e613dee..9015163cf 100644 --- a/plugins/ladspa_effect/caps/CMakeLists.txt +++ b/plugins/ladspa_effect/caps/CMakeLists.txt @@ -2,7 +2,9 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include") FILE(GLOB SOURCES *.cc) ADD_LIBRARY(caps MODULE ${SOURCES}) INSTALL(TARGETS caps LIBRARY DESTINATION ${PLUGIN_DIR}/ladspa) - +IF(LMMS_BUILD_WIN64) +ADD_DEFINITIONS(-DLMMS_BUILD_WIN64) +ENDIF(LMMS_BUILD_WIN64) SET_TARGET_PROPERTIES(caps PROPERTIES PREFIX "") EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info) STRING(REGEX MATCH "4\\.1\\.[0-9]" _gcc_is_4_1_x "${_gcc_version_info}") @@ -15,7 +17,7 @@ ELSE(NO_O3) ENDIF(NO_O3) IF(LMMS_BUILD_WIN32) - ADD_CUSTOM_COMMAND(TARGET caps POST_BUILD COMMAND /opt/mingw/bin/i586-mingw32-strip ${CMAKE_CURRENT_BINARY_DIR}/caps.dll) + ADD_CUSTOM_COMMAND(TARGET caps POST_BUILD COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/caps.dll) ENDIF(LMMS_BUILD_WIN32) IF(LMMS_BUILD_APPLE) diff --git a/plugins/ladspa_effect/caps/dsp/windows.h b/plugins/ladspa_effect/caps/dsp/windows.h index 56cb19a45..84e445e66 100644 --- a/plugins/ladspa_effect/caps/dsp/windows.h +++ b/plugins/ladspa_effect/caps/dsp/windows.h @@ -147,8 +147,12 @@ kaiser (d_sample * s, int n, double beta) { double k = besseli ((beta * sqrt (1 - pow ((2 * i / (n - 1)), 2)))) / bb; +#if LMMS_BUILD_WIN64 + if (!isfinite (k)) +#else /* can you spell hack */ if (!finite (k)) +#endif k = 0; F (s[si], k); diff --git a/plugins/ladspa_effect/cmt/CMakeLists.txt b/plugins/ladspa_effect/cmt/CMakeLists.txt index b363ca16e..75df256ba 100644 --- a/plugins/ladspa_effect/cmt/CMakeLists.txt +++ b/plugins/ladspa_effect/cmt/CMakeLists.txt @@ -7,7 +7,7 @@ SET_TARGET_PROPERTIES(cmt PROPERTIES PREFIX "") SET_TARGET_PROPERTIES(cmt PROPERTIES COMPILE_FLAGS "-Wall -O3 -fno-strict-aliasing") IF(LMMS_BUILD_WIN32) - ADD_CUSTOM_COMMAND(TARGET cmt POST_BUILD COMMAND /opt/mingw/bin/i586-mingw32-strip ${CMAKE_CURRENT_BINARY_DIR}/cmt.dll) + ADD_CUSTOM_COMMAND(TARGET cmt POST_BUILD COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/cmt.dll) ELSE(LMMS_BUILD_WIN32) SET_TARGET_PROPERTIES(cmt PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -fPIC") ENDIF(LMMS_BUILD_WIN32) diff --git a/plugins/ladspa_effect/swh/CMakeLists.txt b/plugins/ladspa_effect/swh/CMakeLists.txt index d5a7b61c8..e0b484009 100644 --- a/plugins/ladspa_effect/swh/CMakeLists.txt +++ b/plugins/ladspa_effect/swh/CMakeLists.txt @@ -17,7 +17,7 @@ FOREACH(_item ${PLUGIN_SOURCES}) SET_TARGET_PROPERTIES(${_plugin} PROPERTIES PREFIX "") SET_TARGET_PROPERTIES(${_plugin} PROPERTIES COMPILE_FLAGS "-O3 -Wall -fomit-frame-pointer -fstrength-reduce -funroll-loops -ffast-math -c -fno-strict-aliasing") IF(LMMS_BUILD_WIN32) - ADD_CUSTOM_COMMAND(TARGET ${_plugin} POST_BUILD COMMAND /opt/mingw/bin/i586-mingw32-strip ${CMAKE_CURRENT_BINARY_DIR}/${_plugin}.dll) + ADD_CUSTOM_COMMAND(TARGET ${_plugin} POST_BUILD COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/${_plugin}.dll) ELSE(LMMS_BUILD_WIN32) SET_TARGET_PROPERTIES(${_plugin} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -fPIC -DPIC") ENDIF(LMMS_BUILD_WIN32) diff --git a/plugins/ladspa_effect/tap/CMakeLists.txt b/plugins/ladspa_effect/tap/CMakeLists.txt index aa054ff1e..ae4da0428 100644 --- a/plugins/ladspa_effect/tap/CMakeLists.txt +++ b/plugins/ladspa_effect/tap/CMakeLists.txt @@ -7,7 +7,7 @@ FOREACH(_item ${PLUGIN_SOURCES}) INSTALL(TARGETS ${_plugin} LIBRARY DESTINATION ${PLUGIN_DIR}/ladspa) SET_TARGET_PROPERTIES(${_plugin} PROPERTIES PREFIX "") IF(LMMS_BUILD_WIN32) - ADD_CUSTOM_COMMAND(TARGET ${_plugin} POST_BUILD COMMAND /opt/mingw/bin/i586-mingw32-strip ${CMAKE_CURRENT_BINARY_DIR}/${_plugin}.dll) + ADD_CUSTOM_COMMAND(TARGET ${_plugin} POST_BUILD COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/${_plugin}.dll) ENDIF(LMMS_BUILD_WIN32) IF(LMMS_BUILD_APPLE) SET_TARGET_PROPERTIES(${_plugin} PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -no-undefined -Bsymbolic -lm") diff --git a/plugins/midi_import/portsmf/allegro.h b/plugins/midi_import/portsmf/allegro.h index ab5f6ff1f..4a750ed94 100644 --- a/plugins/midi_import/portsmf/allegro.h +++ b/plugins/midi_import/portsmf/allegro.h @@ -50,6 +50,8 @@ #define __ALLEGRO__ #include +#include "lmmsconfig.h" + #define ALG_EPS 0.000001 // epsilon #define ALG_DEFAULT_BPM 100.0 // default tempo @@ -511,13 +513,17 @@ public: char *fence = buffer + len; assert(ptr < fence); while ((*ptr++ = *s++)) assert(ptr < fence); - assert((char *)(((long) (ptr + 7)) & ~7) <= fence); + // assert((char *)(((long) (ptr + 7)) & ~7) <= fence); pad(); } void set_int32(long v) { *((long *) ptr) = v; ptr += 4; } void set_double(double v) { *((double *) ptr) = v; ptr += 8; } void set_float(float v) { *((float *) ptr) = v; ptr += 4; } void set_char(char v) { *ptr++ = v; } +#ifdef LMMS_BUILD_WIN64 + void pad() { while (((long long) ptr) & 7) set_char(0); } +#else void pad() { while (((long) ptr) & 7) set_char(0); } +#endif void *to_heap(long *len) { *len = get_posn(); char *newbuf = new char[*len]; @@ -539,7 +545,11 @@ public: while (*ptr++) assert(ptr < fence); get_pad(); return s; } +#ifdef LMMS_BUILD_WIN64 + void get_pad() { while (((long long) ptr) & 7) ptr++; } +#else void get_pad() { while (((long) ptr) & 7) ptr++; } +#endif void check_input_buffer(long needed) { assert(get_posn() + needed <= len); } } *Serial_buffer_ptr; diff --git a/plugins/vst_base/CMakeLists.txt b/plugins/vst_base/CMakeLists.txt index 9233fe546..68a9eaf81 100644 --- a/plugins/vst_base/CMakeLists.txt +++ b/plugins/vst_base/CMakeLists.txt @@ -7,9 +7,9 @@ BUILD_PLUGIN(vstbase vst_base.cpp vst_plugin.cpp vst_plugin.h communication.h MO IF(LMMS_BUILD_WIN32) ADD_DEFINITIONS(-DPTW32_STATIC_LIB) - LINK_LIBRARIES(-lQtCore4 -lpthread -lgdi32 -lwsock32) + LINK_LIBRARIES(-lQtCore4 -lpthread -lgdi32 -lws2_32) ADD_EXECUTABLE(remote_vst_plugin ${CMAKE_CURRENT_SOURCE_DIR}/remote_vst_plugin.cpp) - ADD_CUSTOM_COMMAND(TARGET remote_vst_plugin POST_BUILD COMMAND /opt/mingw/bin/i586-mingw32-strip ${CMAKE_CURRENT_BINARY_DIR}/remote_vst_plugin.exe) + ADD_CUSTOM_COMMAND(TARGET remote_vst_plugin POST_BUILD COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/remote_vst_plugin.exe) INSTALL(TARGETS remote_vst_plugin RUNTIME DESTINATION ${PLUGIN_DIR}) ENDIF(LMMS_BUILD_WIN32) diff --git a/plugins/vst_base/basename.c b/plugins/vst_base/basename.c new file mode 100755 index 000000000..c8b4ee45c --- /dev/null +++ b/plugins/vst_base/basename.c @@ -0,0 +1,166 @@ +/* basename.c + * + * $Id: basename.c,v 1.2 2007/03/08 23:15:58 keithmarshall Exp $ + * + * Provides an implementation of the "basename" function, conforming + * to SUSv3, with extensions to accommodate Win32 drive designators, + * and suitable for use on native Microsoft(R) Win32 platforms. + * + * Written by Keith Marshall + * + * This is free software. You may redistribute and/or modify it as you + * see fit, without restriction of copyright. + * + * This software is provided "as is", in the hope that it may be useful, + * but WITHOUT WARRANTY OF ANY KIND, not even any implied warranty of + * MERCHANTABILITY, nor of FITNESS FOR ANY PARTICULAR PURPOSE. At no + * time will the author accept any form of liability for any damages, + * however caused, resulting from the use of this software. + * + */ + +#include +#include +#include +#include + +#ifndef __cdecl /* If compiling on any non-Win32 platform ... */ +#define __cdecl /* this may not be defined. */ +#endif + +__cdecl char *basename( char *path ) +{ + size_t len; + static char *retfail = NULL; + + /* to handle path names for files in multibyte character locales, + * we need to set up LC_CTYPE to match the host file system locale + */ + + char *locale = setlocale( LC_CTYPE, NULL ); + if( locale != NULL ) locale = strdup( locale ); + setlocale( LC_CTYPE, "" ); + + if( path && *path ) + { + /* allocate sufficient local storage space, + * in which to create a wide character reference copy of path + */ + + wchar_t refcopy[1 + (len = mbstowcs( NULL, path, 0 ))]; + + /* create the wide character reference copy of path, + * and step over the drive designator, if present ... + */ + + wchar_t *refpath = refcopy; + if( ((len = mbstowcs( refpath, path, len )) > 1) && (refpath[1] == L':') ) + { + /* FIXME: maybe should confirm *refpath is a valid drive designator */ + + refpath += 2; + } + + /* ensure that our wide character reference path is NUL terminated */ + + refcopy[ len ] = L'\0'; + + /* check again, just to ensure we still have a non-empty path name ... */ + + if( *refpath ) + { + /* and, when we do, process it in the wide character domain ... + * scanning from left to right, to the char after the final dir separator + */ + + wchar_t *refname; + for( refname = refpath ; *refpath ; ++refpath ) + { + if( (*refpath == L'/') || (*refpath == L'\\') ) + { + /* we found a dir separator ... + * step over it, and any others which immediately follow it + */ + + while( (*refpath == L'/') || (*refpath == L'\\') ) + ++refpath; + + /* if we didn't reach the end of the path string ... */ + + if( *refpath ) + + /* then we have a new candidate for the base name */ + + refname = refpath; + + /* otherwise ... + * strip off any trailing dir separators which we found + */ + + else while( (refpath > refname) + && ((*--refpath == L'/') || (*refpath == L'\\')) ) + *refpath = L'\0'; + } + } + + /* in the wide character domain ... + * refname now points at the resolved base name ... + */ + + if( *refname ) + { + /* if it's not empty, + * then we transform the full normalised path back into + * the multibyte character domain, and skip over the dirname, + * to return the resolved basename. + */ + + if( (len = wcstombs( path, refcopy, len )) != (size_t)(-1) ) + path[ len ] = '\0'; + *refname = L'\0'; + if( (len = wcstombs( NULL, refcopy, 0 )) != (size_t)(-1) ) + path += len; + } + + else + { + /* the basename is empty, so return the default value of "/", + * transforming from wide char to multibyte char domain, and + * returning it in our own buffer. + */ + + retfail = (char *) realloc( retfail, len = 1 + wcstombs( NULL, L"/", 0 )); + wcstombs( path = retfail, L"/", len ); + } + + /* restore the caller's locale, clean up, and return the result */ + + setlocale( LC_CTYPE, locale ); + free( locale ); + return( path ); + } + + /* or we had an empty residual path name, after the drive designator, + * in which case we simply fall through ... + */ + } + + /* and, if we get to here ... + * the path name is either NULL, or it decomposes to an empty string; + * in either case, we return the default value of "." in our own buffer, + * reloading it with the correct value, transformed from the wide char + * to the multibyte char domain, just in case the caller trashed it + * after a previous call. + */ + + retfail = (char *) realloc( retfail, len = 1 + wcstombs( NULL, L".", 0 )); + wcstombs( retfail, L".", len ); + + /* restore the caller's locale, clean up, and return the result */ + + setlocale( LC_CTYPE, locale ); + free( locale ); + return( retfail ); +} + +/* $RCSfile: basename.c,v $$Revision: 1.2 $: end of file */ diff --git a/plugins/vst_base/remote_vst_plugin.cpp b/plugins/vst_base/remote_vst_plugin.cpp index 8e606dad1..af83d929c 100644 --- a/plugins/vst_base/remote_vst_plugin.cpp +++ b/plugins/vst_base/remote_vst_plugin.cpp @@ -51,8 +51,11 @@ #include #ifdef LMMS_BUILD_WIN32 +#ifdef LMMS_BUILD_WIN64 +#include "basename.c" +#else #include - +#endif #endif @@ -724,8 +727,11 @@ VstIntPtr remoteVstPlugin::hostCallback( AEffect * _effect, VstInt32 _opcode, _timeInfo.timeSigDenominator = 4; _timeInfo.flags |= (/* kVstBarsValid|*/kVstTempoValid ); _timeInfo.flags |= kVstTransportPlaying; - +#ifdef LMMS_BUILD_WIN64 + return( (long long) &_timeInfo ); +#else return( (long) &_timeInfo ); +#endif case audioMasterProcessEvents: //SHOW_CALLBACK( "amc: audioMasterProcessEvents\n" ); diff --git a/src/core/midi/midi_winmm.cpp b/src/core/midi/midi_winmm.cpp index 4f79ec53e..114090ebc 100644 --- a/src/core/midi/midi_winmm.cpp +++ b/src/core/midi/midi_winmm.cpp @@ -304,7 +304,7 @@ void midiWinMM::openDevices( void ) MIDIINCAPS c; midiInGetDevCaps( i, &c, sizeof( c ) ); HMIDIIN hm = 0; - MMRESULT res = midiInOpen( &hm, i, (DWORD) &inputCallback, + MMRESULT res = midiInOpen( &hm, i, (DWORD_PTR) &inputCallback, (DWORD_PTR) this, CALLBACK_FUNCTION ); if( res == MMSYSERR_NOERROR ) diff --git a/src/core/mixer.cpp b/src/core/mixer.cpp index 78d696d6a..ffca00679 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -212,10 +212,10 @@ public: (fx_ch_t) it->effectChannelJob ); break; default: -fprintf( stderr, "invalid job item type %d at %ld in jobqueue(%ld:%ld)\n", +/*fprintf( stderr, "invalid job item type %d at %ld in jobqueue(%ld:%ld)\n", (int) it->type, (long int) it, (long int) s_jobQueue.items.begin(), - (long int) end_it ); + (long int) end_it );*/ break; } }