From 99dfdc3f46ed7eeee1a5220ca0aaf2527e6357c4 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 27 Sep 2005 13:10:34 +0000 Subject: [PATCH] bug-fixes, compatibility-patches, ... see ChangeLog for details git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@9 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 51 ++++++++++ Makefile.am | 1 + README | 35 +++---- TODO | 2 + configure.in | 125 ++++++++++++++++++------- include/arp_and_chords_tab_widget.h | 4 +- include/audio_oss.h | 12 ++- include/knob.h | 3 - include/midi_mapper.h | 1 + include/midi_oss.h | 7 ++ include/oscillator.h | 4 + include/qt3support.h | 29 ++++++ include/templates.h | 17 ---- include/tooltip.h | 1 - src/audio/audio_alsa.cpp | 1 + src/audio/audio_jack.cpp | 26 ++++- src/audio/audio_oss.cpp | 19 ++-- src/audio/audio_sample_recorder.cpp | 2 +- src/audio/audio_sdl.cpp | 6 +- src/core/arp_and_chords_tab_widget.cpp | 24 +---- src/core/bb_editor.cpp | 16 +--- src/core/config_mgr.cpp | 2 +- src/core/envelope_and_lfo_widget.cpp | 1 + src/core/envelope_tab_widget.cpp | 9 +- src/core/main.cpp | 2 +- src/core/mixer.cpp | 14 ++- src/core/name_label.cpp | 9 +- src/core/piano_roll.cpp | 28 +++--- src/core/setup_dialog.cpp | 2 +- src/core/song_editor.cpp | 12 ++- src/core/timeline.cpp | 2 +- src/core/track.cpp | 4 +- src/core/track_container.cpp | 2 + src/lib/buffer_allocator.cpp | 4 + src/lib/embed.cpp | 11 ++- src/midi/midi_alsa_raw.cpp | 2 +- src/midi/midi_mapper.cpp | 48 ++++++++-- src/midi/midi_oss.cpp | 20 +++- src/tracks/bb_track.cpp | 13 ++- src/tracks/pattern.cpp | 3 +- src/widgets/group_box.cpp | 6 +- src/widgets/knob.cpp | 3 +- src/widgets/lcd_spinbox.cpp | 2 +- src/widgets/led_checkbox.cpp | 2 +- src/widgets/nstate_button.cpp | 2 +- src/widgets/side_bar_widget.cpp | 4 +- src/widgets/tab_bar.cpp | 4 +- src/widgets/tab_widget.cpp | 2 +- src/widgets/text_float.cpp | 2 +- src/widgets/tooltip.cpp | 7 -- 50 files changed, 414 insertions(+), 194 deletions(-) diff --git a/ChangeLog b/ChangeLog index 108326a14..72a9d57ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,54 @@ +2005-09-25 Tobias Doerffel + + * src/audio/audio_jack.cpp: + - decreased wait-time from 0.5 ms to 0.2 ms in writeBufferToDev(...) + - clear part of buffers that could not be filled for avoiding bad + noise in case there's no data from sound-render-thread, because it is + locked or got no cpu-time for some reason + + * src/core/timeline.cpp: + do not call update() in updatePosition, call paintEvent() directly + instead - hopefully fixes the "unexspected Xlib async replies" + which occured in some seldom cases because now there're no events + generated anymore + + * resources/source/songeditor.svg: + * resources/songeditor.png: + created a new song-editor-icon + + * src/core/song_editor.cpp: + do not save play-pos from previous play-mode when beginning to play + in different play-mode - fixes bug in timeline behaviour "back to start" + +2005-09-24 Tobias Doerffel + + * configure.in: + * include/audio_oss.h: + * include/midi_oss.h: + * src/audio/audio_oss.cpp: + * src/midi/midi_oss.cpp: + made LMMS compiling and working without OSS - configure detects + whether soundcard.h is available + + * include/gui_templates.h: + made template pointSize(...) platform-independent by not using x11- + specific qt-classes/-functions + + * include/templates.h: + moved pointSize-function with all the headers it depends on into + gui_templates.h + + * src/core/mixer.cpp: + - do not initialize member m_surroundSilence if surround is disabled + - free silence-buffers in dtor + + * src/tracks/bb_track.cpp: + when drawing gradient skip first and last line as a rect is painted + over it afterwards + + * src/core/track_container.cpp: + set modified-state for song when removing track + 2005-09-21 Tobias Doerffel * configure.in: diff --git a/Makefile.am b/Makefile.am index 240109e33..3d85f4c3a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -220,6 +220,7 @@ lmms_SOURCES = \ $(srcdir)/include/knob.h \ $(srcdir)/include/browser.h \ $(srcdir)/include/templates.h \ + $(srcdir)/include/gui_templates.h \ $(srcdir)/include/surround_area.h \ $(srcdir)/include/kmultitabbar.h \ $(srcdir)/include/side_bar.h \ diff --git a/README b/README index bed7ce9ac..46708f92b 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ -Linux MultiMedia Studio 0.1.0 -============================= +Linux MultiMedia Studio 0.1.2 +============================== -Copyright (c) 2004-2005 by Tobias Doerffel +Copyright (c) 2004-2005 by Tobias Doerffel and others The whole program is free software; you can redistribute it and/or modify @@ -41,25 +41,27 @@ Requirements ------------ The most important requirement is for sure a fast computer, so don't try to get -LMMS working on a pentium one with 60 MHz... ;-) So you should have at least +LMMS working on a pentium I with 60 MHz... ;-) So you should have at least 500 MHz, but for really enjoying LMMS less than 1 GHz makes no sense... (LMMS is currently developed on a PIII 450 MHz...!!) Required libraries are: - Qt 3.2 or higher (tested up to 4.0.0) with devel-files -- SDL_sound (tested with 0.1.5 & 1.0.1) with devel-files Optional, but strongly recommended: - libvorbis with devel-files - libalsa with devel-files +- SDL_sound (tested with 0.1.5 & 1.0.1) with devel-files - SDL with devel-files - libsamplerate with devel-files +- libsndfile with devel-files +- JACK with devel-files For compiling you should have an up to date GCC with g++. LMMS has been (successfully) tested under Debian Sarge 3.1, Fedora Core 2-4, and SuSE Linux 9.0-9.3 with Qt 3.[23].x and Qt 4.0.0. -It was compiled using GCC 3.3.x, GCC 3.4.x and GCC 4.0.0. +It was compiled using GCC 3.3.x, GCC 3.4.x and GCC 4.0.x. If you have problems with compiling or running LMMS, find any bug or have suggestions and so on, please feel free to e-mail me (for mail-address see @@ -68,30 +70,29 @@ below)! -Help developing LMMS --------------------- +Join LMMS-development +---------------------- If you are interested in LMMS, it's programming, artwork, testing, writing demo-songs, (and improving this f**** README...) or something like that, you're welcome to participate on the development of LMMS! -Just e-mail me: tobydox@users.sourceforge.net +The project-homepage of LMMS, mailingslists and a list of things you can do +can be found at -The project-homepage of LMMS and mailingslists can be found at http://lmms.sourceforge.net Before coding a new big feature, please always post your idea and suggestions about your feature and about the actual implementation to the -LMMS-devel-mailinglist (lmms-devel@lists.sourceforge.net) and wait for replies -or email me! Maybe there're different ideas, improvements, hints or maybe your -feature is not welcome/needed at the moment (but for sure this will be very -seldom). +LMMS-devel-mailinglist (lmms-devel@lists.sourceforge.net) and wait for replies! +Maybe there're different ideas, improvements, hints or maybe your feature is +not welcome/needed at the moment (but for sure this will be very seldom). If you coded your feature, make sure, that it is running properly with the newest available version of LMMS and that it also runs with different -configurations (e.g. different latency, disabled surround-support, missing -package(s) etc.). Important is also, that you comment your -source so that other people can fix bugs or improve your feature! +configurations (e.g. disabled surround-support, missing package(s) etc.). +Important is also, that you comment your source so that other people can fix +bugs or improve your feature! diff --git a/TODO b/TODO index 043e3f619..f06358739 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ +- add select-boxes for zooming in song-editor and piano-roll +- use own scrollview for capturing wheel-events - make usable with Qt4 - make LMMS an ALSA-sequencer-client - adchannel-toolbutton -> popup-menu with available soundgenerator-plugins diff --git a/configure.in b/configure.in index 2069236c8..b08224d8e 100644 --- a/configure.in +++ b/configure.in @@ -2,9 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) -AC_INIT(lmms, 0.1.1, tobydox@users.sourceforge.net) -#AC_INIT(acinclude.m4) -AM_INIT_AUTOMAKE(lmms, 0.1.1) +AC_INIT(lmms, 0.1.1-cvs20050927, tobydox@users.sourceforge.net) +AM_INIT_AUTOMAKE(lmms, 0.1.1-cvs20050927) AM_CONFIG_HEADER(config.h) @@ -54,7 +53,7 @@ done AH_TEMPLATE(SDL_SDL_H, [Define to location of SDL.h]) -AH_TEMPLATE(SDL_SDL_AUDIO_H, [Define to location of SD_audio.h]) +AH_TEMPLATE(SDL_SDL_AUDIO_H, [Define to location of SDL_audio.h]) AH_TEMPLATE(SDL_SDL_SOUND_H, [Define to location of SDL_sound.h]) OLD_LIBS="$LIBS" @@ -65,7 +64,7 @@ AC_ARG_WITH(sdl, AS_HELP_STRING([--without-sdl], [disable support for SDL-audio-output]), , [ with_sdlaudio=yes ]) -AH_TEMPLATE(HAVE_SDL_SDL_AUDIO_H, [Define to 1 if you have the $SDL_INC_PATH/SDL_audio.h header file.]) +AH_TEMPLATE(HAVE_SDL_SDL_AUDIO_H, [Define to 1 if you have the <$SDL_INC_PATH/SDL_audio.h> header file.]) if test "x$with_sdlaudio" = "xyes" -a ! -z "$SDL_INC_PATH"; then AC_CHECK_HEADER($SDL_INC_PATH/SDL_audio.h, HAVE_SDL_SDL_AUDIO_H="true") AC_CHECK_LIB([SDL], [SDL_OpenAudio], HAVE_LIBSDL="true", HAVE_SDL_SDL_AUDIO_H="") @@ -83,7 +82,7 @@ AC_ARG_WITH(sdlsound, AS_HELP_STRING([--without-sdlsound], [disable support for reading samples via SDL_sound]), , [ with_sdlsound=yes ]) -AH_TEMPLATE(HAVE_SDL_SDL_SOUND_H, [Define to 1 if you have the $SDL_INCL_PATH/SDL_sound.h header file.]) +AH_TEMPLATE(HAVE_SDL_SDL_SOUND_H, [Define to 1 if you have the <$SDL_INCL_PATH/SDL_sound.h> header file.]) if test "x$with_sdlsound" = "xyes" -a ! -z "$SDL_INC_PATH"; then AC_CHECK_HEADER($SDL_INC_PATH/SDL_sound.h, HAVE_SDL_SDL_SOUND_H="true") AC_CHECK_LIB([SDL_sound], [Sound_Init], HAVE_LIBSDL_SOUND="true", HAVE_SDL_SDL_SOUND_H="") @@ -103,7 +102,7 @@ AC_ARG_WITH(asound, AS_HELP_STRING([--without-asound], [disable support for ALSA-sound-output]), , [ with_asound=yes ]) -AH_TEMPLATE(HAVE_ALSA_ASOUNDLIB_H, [Define to 1 if you have the alsa/asoundlib.h header file.]) +AH_TEMPLATE(HAVE_ALSA_ASOUNDLIB_H, [Define to 1 if you have the header file.]) if test "x$with_asound" = "xyes" ; then AC_CHECK_HEADER(alsa/asoundlib.h, HAVE_ALSA_ASOUNDLIB_H="true") AC_CHECK_LIB([asound], [snd_pcm_open], HAVE_LIBASOUND="true", HAVE_ALSA_ASOUNDLIB_H="") @@ -114,12 +113,31 @@ fi AM_CONDITIONAL(HAVE_LIBASOUND, test ! -z "$HAVE_ALSA_ASOUNDLIB_H") +# check for OSS +AC_ARG_WITH(oss, + AS_HELP_STRING([--without-oss], + [disable support for OSS-sound-output]), , + [ with_oss=yes ]) +AH_TEMPLATE(HAVE_SYS_SOUNDCARD_H, [Define to 1 if you have the header file.]) +AH_TEMPLATE(HAVE_SOUNDCARD_H, [Define to 1 if you have the header file.]) +if test "x$with_oss" = "xyes" ; then + AC_CHECK_HEADER(sys/soundcard.h, HAVE_SYS_SOUNDCARD_H="true") + AC_CHECK_HEADER(soundcard.h, HAVE_SOUNDCARD_H="true") +fi +if test ! -z "$HAVE_SYS_SOUNDCARD_H" ; then + AC_DEFINE(HAVE_SYS_SOUNDCARD_H) +fi +if test ! -z "$HAVE_SOUNDCARD_H" ; then + AC_DEFINE(HAVE_SOUNDCARD_H) +fi + + # check for JACK AC_ARG_WITH(jack, AS_HELP_STRING([--without-jack], [disable support for JACK-transport]), , [ with_jack=yes ]) -AH_TEMPLATE(HAVE_JACK_JACK_H, [Define to 1 if you have the jack/jack.h header file.]) +AH_TEMPLATE(HAVE_JACK_JACK_H, [Define to 1 if you have the header file.]) AH_TEMPLATE(OLD_JACK, [Define to 1 if your JACK-version doesnt know about jack_client_open() etc.]) if test "x$with_jack" = "xyes" ; then AC_CHECK_HEADER(jack/jack.h, HAVE_JACK_JACK_H="true") @@ -140,9 +158,9 @@ AC_ARG_WITH(vorbis, AS_HELP_STRING([--without-vorbis], [disable support for exporting song to OGG-files]), , [ with_vorbis=yes ]) -AH_TEMPLATE(HAVE_VORBIS_CODEC_H, [Define to 1 if you have the vorbis/codec.h header file.]) -AH_TEMPLATE(HAVE_VORBIS_VORBISENC_H, [Define to 1 if you have the vorbis/vorbisenc.h header file.]) -AH_TEMPLATE(HAVE_VORBIS_VORBISFILE_H, [Define to 1 if you have the vorbis/vorbisfile.h header file.]) +AH_TEMPLATE(HAVE_VORBIS_CODEC_H, [Define to 1 if you have the header file.]) +AH_TEMPLATE(HAVE_VORBIS_VORBISENC_H, [Define to 1 if you have the header file.]) +AH_TEMPLATE(HAVE_VORBIS_VORBISFILE_H, [Define to 1 if you have the header file.]) if test "x$with_vorbis" = "xyes" ; then OGG_SUPPORT="true" AC_CHECK_HEADER(vorbis/codec.h, HAVE_VORBIS_CODEC_H="true",OGG_SUPPORT="") @@ -163,7 +181,7 @@ AC_ARG_WITH(src, 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.]) +AH_TEMPLATE(HAVE_SAMPLERATE_H, [Define to 1 if you have the 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="") @@ -179,7 +197,7 @@ AC_ARG_WITH(src, AS_HELP_STRING([--without-libsf], [disable support for importing files via libsndfile]), , [ with_libsf=yes ]) -AH_TEMPLATE(HAVE_SNDFILE_H, [Define to 1 if you have the sndfile.h header file.]) +AH_TEMPLATE(HAVE_SNDFILE_H, [Define to 1 if you have the header file.]) if test "x$with_libsf" = "xyes" ; then AC_CHECK_HEADER(sndfile.h, HAVE_SNDFILE_H="true") AC_CHECK_LIB([sndfile], [sf_command], HAVE_LIBSF="true", HAVE_SNDFILE_H="") @@ -283,6 +301,14 @@ AC_TRY_LINK([#include ], [ fabsf ], AC_DEFINE(fabsf, fabs) ) +AC_MSG_CHECKING([whether logf is known by compiler]) +AH_TEMPLATE(logf, [Define to lof if logf is not known]) +AC_TRY_LINK([#include ], [ logf ], + AC_MSG_RESULT(yes), + AC_MSG_RESULT([no - will use log instead]) + AC_DEFINE(logf, log) + ) + # check whether to enable debugging-code AC_MSG_CHECKING([whether to enable debugging-code]) @@ -356,21 +382,7 @@ with_warnings="false" echo echo - -if test -z "$OGG_SUPPORT" ; then - echo " ========================" - echo " === LMMS - WARNING =======================================================" - echo " ========================" - echo " =" - echo " = You don't seem to have libvorbis installed and/or libvorbis-development-" - echo " = package is missing. This will disable support for exporting songs to" - echo " = OGG-files! If also SDL_sound is missing, you'll not be able to use the " - echo " = samples coming with LMMS since libsndfile currently has no OGG-support!" - echo " = Consider installing the missing packages for using the full power of LMMS." - echo " =" - with_warnings="true" -fi - +PLUGINS_TO_BUILD="" if test -z "$HAVE_ALSA_ASOUNDLIB_H" ; then @@ -380,10 +392,11 @@ if test -z "$HAVE_ALSA_ASOUNDLIB_H" ; then echo " =" echo " = You don't seem to have ALSA-library installed and/or ALSA-lib-development-" echo " = package is missing. This will disable support for sound-output via ALSA!" - echo " = If you use ALSA-driver for your soundcard there will be no sound-output!" 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\* ALSA for audio- and MIDI-input/output" fi @@ -400,10 +413,32 @@ if test -z "$HAVE_JACK_JACK_H" ; then 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\* JACK for audio-input/output" fi + +if test -z "$HAVE_SOUNDCARD_H" -a -z "$HAVE_SYS_SOUNDCARD_H" ; then + echo " ========================" + echo " === LMMS - WARNING =======================================================" + echo " ========================" + echo " =" + echo " = You don't seem to have soundcard.h which is neccessary for outputting " + echo " = sound via OSS under Linux/BSD/Solaris." + echo " = This will also disable support for MIDI using OSS." + echo " = If you're building for a different platform or do not need OSS-support, you" + echo " = can ignore this warning." + echo " =" + with_warnings="true" +else + PLUGINS_TO_BUILD="$PLUGINS_TO_BUILD\n\t\* OSS for audio- and MIDI-input/output" +fi + + + + if test -z "$HAVE_SDL_SDL_AUDIO_H" ; then echo " ========================" echo " === LMMS - WARNING =======================================================" @@ -411,16 +446,35 @@ if test -z "$HAVE_SDL_SDL_AUDIO_H" ; then echo " =" echo " = You don't seem to have SDL-library installed and/or SDL-lib-development-" echo " = package is missing. This will disable support for sound-output via SDL, " - echo " = which is important, if you're using sound-daemons (arts, ESD, JACK etc.)" + echo " = which is important, if you're using sound-daemons (arts, ESD etc.)" echo " = When compiling without SDL, you'll always have to kill your sound-daemon" echo " = before using LMMS...!" 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\* SDL for audio-output" fi +if test -z "$OGG_SUPPORT" ; then + echo " ========================" + echo " === LMMS - WARNING =======================================================" + echo " ========================" + echo " =" + echo " = You don't seem to have libvorbis installed and/or libvorbis-development-" + echo " = package is missing. This will disable support for exporting songs to" + echo " = OGG-files! If SDL_sound is missing too, you'll not be able to use the " + echo " = samples coming with LMMS since libsndfile currently has no OGG-support!" + 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\* libvorbis for encoding/decoding OGG-files" +fi + + if test -z "$HAVE_SDL_SDL_SOUND_H" ; then echo " ========================" @@ -433,6 +487,8 @@ if test -z "$HAVE_SDL_SDL_SOUND_H" ; then 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\* SDL_sound for sample-decoding" fi @@ -450,6 +506,8 @@ if test -z "$HAVE_SNDFILE_H" ; then 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\* libsndfile for sample-decoding" fi @@ -467,11 +525,14 @@ if test -z "$HAVE_SAMPLERATE_H" ; then 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 - - +echo +echo +echo "LMMS will be able to use $PLUGINS_TO_BUILD" | sed -e "s/\\\n/\n/g" | sed -e "s/\\\t/\t/g" | sed -e "s/\\\\\*/\*/g" echo echo echo " ============================" diff --git a/include/arp_and_chords_tab_widget.h b/include/arp_and_chords_tab_widget.h index a431e0737..5f094eb1e 100644 --- a/include/arp_and_chords_tab_widget.h +++ b/include/arp_and_chords_tab_widget.h @@ -95,7 +95,6 @@ public: protected slots: -// void arpOffToggled( bool ); void arpUpToggled( bool ); void arpDownToggled( bool ); void arpUpAndDownToggled( bool ); @@ -127,7 +126,7 @@ private: knob * m_arpTimeKnob; knob * m_arpGateKnob; QLabel * m_arpDirectionLbl; - //pixmapButton * m_arpOffBtn; + pixmapButton * m_arpUpBtn; pixmapButton * m_arpDownBtn; pixmapButton * m_arpUpAndDownBtn; @@ -135,4 +134,5 @@ private: } ; + #endif diff --git a/include/audio_oss.h b/include/audio_oss.h index f15a3bde1..49c8bcf6b 100644 --- a/include/audio_oss.h +++ b/include/audio_oss.h @@ -25,10 +25,18 @@ #ifndef _AUDIO_OSS_H #define _AUDIO_OSS_H +#ifdef HAVE_CONFIG_H +#include +#endif + +#if defined HAVE_SYS_SOUNDCARD_H || defined HAVE_SOUNDCARD_H + +#define OSS_SUPPORT + + #include "audio_device.h" #include "tab_widget.h" -#define OSS_SUPPORT class lcdSpinBox; @@ -76,4 +84,6 @@ private: } ; +#endif + #endif diff --git a/include/knob.h b/include/knob.h index feff4061c..e1db04e58 100644 --- a/include/knob.h +++ b/include/knob.h @@ -42,9 +42,6 @@ #endif -#include "templates.h" - - class QPixmap; class textFloat; diff --git a/include/midi_mapper.h b/include/midi_mapper.h index ab595acd7..1696adfdd 100644 --- a/include/midi_mapper.h +++ b/include/midi_mapper.h @@ -34,6 +34,7 @@ #else +#include #include #include diff --git a/include/midi_oss.h b/include/midi_oss.h index c08b93fa9..d5335d1d1 100644 --- a/include/midi_oss.h +++ b/include/midi_oss.h @@ -25,6 +25,11 @@ #ifndef _MIDI_OSS_H #define _MIDI_OSS_H +#include "audio_oss.h" + +#ifdef OSS_SUPPORT + + #include #include @@ -75,5 +80,7 @@ private: } ; +#endif + #endif diff --git a/include/oscillator.h b/include/oscillator.h index a5ead6a4f..fa31918d4 100644 --- a/include/oscillator.h +++ b/include/oscillator.h @@ -104,7 +104,11 @@ public: } static inline float phase( float _sample ) { +#ifndef modff float t; +#else + double t; +#endif return( modff( _sample, &t ) ); //return( _sample - floorf( _sample ) ); } diff --git a/include/qt3support.h b/include/qt3support.h index f0846ff0d..5697ae892 100644 --- a/include/qt3support.h +++ b/include/qt3support.h @@ -170,6 +170,35 @@ typedef int csize; typedef unsigned int csize; +// some compat-stuff for older qt-versions... +#if QT_VERSION < 0x030100 + +#define wasCanceled wasCancelled + +#include + +// Qt 3.0.x doesn't have QMutexLocker, so we implement it on our own... +class QMutexLocker +{ +public: + QMutexLocker( QMutex * _m ) : + m_mutex( _m ) + { + m_mutex->lock(); + } + ~QMutexLocker() + { + m_mutex->unlock(); + } + +private: + QMutex * m_mutex; + +} ; + + +#endif + #endif diff --git a/include/templates.h b/include/templates.h index 455388671..fb49a8be0 100644 --- a/include/templates.h +++ b/include/templates.h @@ -30,14 +30,10 @@ #ifdef QT4 #include -#include -#include #else #include -#include -#include #endif @@ -86,17 +82,4 @@ inline T tLimit( const T & x, const T & x1, const T & x2 ) } -template -inline QFont pointSize( QFont _f ) -{ - const int DPI = 96; -#ifdef QT4 - _f.setPointSizeF( SIZE * DPI / QX11Info::appDpiX() ); -#else - _f.setPointSizeFloat( SIZE * DPI / QPaintDevice::x11AppDpiX() ); -#endif - return( _f ); -} - - #endif diff --git a/include/tooltip.h b/include/tooltip.h index 7bf2b65a1..c1c3dba3e 100644 --- a/include/tooltip.h +++ b/include/tooltip.h @@ -34,7 +34,6 @@ namespace toolTip { void add( QWidget * _w, const QString & _txt ); - //void remove( QWidget * _w ); } ; diff --git a/src/audio/audio_alsa.cpp b/src/audio/audio_alsa.cpp index ee979f930..83e3a6c41 100644 --- a/src/audio/audio_alsa.cpp +++ b/src/audio/audio_alsa.cpp @@ -48,6 +48,7 @@ #include "buffer_allocator.h" #include "config_mgr.h" #include "lcd_spinbox.h" +#include "gui_templates.h" #include "templates.h" diff --git a/src/audio/audio_jack.cpp b/src/audio/audio_jack.cpp index c5f3630ef..01e05d127 100644 --- a/src/audio/audio_jack.cpp +++ b/src/audio/audio_jack.cpp @@ -22,17 +22,17 @@ */ - #include "audio_jack.h" + +#ifdef JACK_SUPPORT + #ifdef HAVE_UNISTD_H // for usleep #include #endif -#ifdef JACK_SUPPORT - #ifdef QT4 #include @@ -46,14 +46,15 @@ #endif - #include "debug.h" #include "templates.h" +#include "gui_templates.h" #include "buffer_allocator.h" #include "config_mgr.h" #include "lcd_spinbox.h" + audioJACK::audioJACK( Uint32 _sample_rate, bool & _success_ful ) : audioDevice( _sample_rate, tLimit( configManager::inst()->value( "audiojack", "channels" ).toInt(), @@ -240,7 +241,7 @@ void audioJACK::writeBufferToDev( surroundSampleFrame * _ab, Uint32 _frames, #ifdef HAVE_UNISTD_H #ifdef HAVE_USLEEP // just wait and give cpu-time to other processes - usleep( 500 ); + usleep( 200 ); #endif #endif } @@ -309,6 +310,21 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata ) done += todo; _this->m_frameSync -= todo; } + + // we have to clear the part of the buffers, we could not fill because + // no usable data is left, otherwise there's baaaaaad noise... ;-) + if( done < _nframes ) + { + for( Uint8 ch = 0; ch < _this->channels(); ++ch ) + { + jack_default_audio_sample_t * b = outbufs[ch]; + for( Uint32 frame = done; frame < _nframes; ++frame ) + { + b[frame] = 0.0f; + } + } + } + _this->m_bufMutex.unlock(); return( 0 ); diff --git a/src/audio/audio_oss.cpp b/src/audio/audio_oss.cpp index 60a100e37..717674c0a 100644 --- a/src/audio/audio_oss.cpp +++ b/src/audio/audio_oss.cpp @@ -22,6 +22,11 @@ */ +#include "audio_oss.h" + + +#ifdef OSS_SUPPORT + #include "qt3support.h" #ifdef QT4 @@ -39,10 +44,10 @@ #endif -#include "audio_oss.h" #include "buffer_allocator.h" #include "endian_handling.h" #include "lcd_spinbox.h" +#include "gui_templates.h" #include "templates.h" @@ -63,12 +68,12 @@ #include #endif -#ifdef OSS_USE_SOUNDCARD_H -/* This is installed on some systems */ -#include -#else -/* This is recommended by OSS */ +#ifdef HAVE_SYS_SOUNDCARD_H +// This is recommended by OSS #include +#elif HAVE_SOUNDCARD_H +// This is installed on some systems +#include #endif @@ -327,3 +332,5 @@ void audioOSS::setupWidget::saveSettings( void ) } +#endif + diff --git a/src/audio/audio_sample_recorder.cpp b/src/audio/audio_sample_recorder.cpp index ee4bd9614..e617592f3 100644 --- a/src/audio/audio_sample_recorder.cpp +++ b/src/audio/audio_sample_recorder.cpp @@ -45,7 +45,7 @@ audioSampleRecorder::audioSampleRecorder( Uint32 _sample_rate, Uint32 _channels, audioSampleRecorder::~audioSampleRecorder() { - while( !m_buffers.isEmpty() ) + while( !m_buffers.empty() ) { bufferAllocator::free( m_buffers.front().first ); m_buffers.erase( m_buffers.begin() ); diff --git a/src/audio/audio_sdl.cpp b/src/audio/audio_sdl.cpp index 3e186ddb0..0d4e9f0ef 100644 --- a/src/audio/audio_sdl.cpp +++ b/src/audio/audio_sdl.cpp @@ -43,7 +43,7 @@ #include "buffer_allocator.h" #include "debug.h" #include "config_mgr.h" -#include "templates.h" +#include "gui_templates.h" @@ -58,7 +58,7 @@ audioSDL::audioSDL( Uint32 _sample_rate, bool & _success_ful ) : { _success_ful = FALSE; - // if device is set, we set AUDIODEV-environment-variable, so that +/* // if device is set, we set AUDIODEV-environment-variable, so that // SDL can evaluate and use it QString dev = configManager::inst()->value( "audiosdl", "device" ); if( dev != "" ) @@ -69,7 +69,7 @@ audioSDL::audioSDL( Uint32 _sample_rate, bool & _success_ful ) : #else ascii() ) ); #endif - } + }*/ if( SDL_Init( SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE ) < 0 ) diff --git a/src/core/arp_and_chords_tab_widget.cpp b/src/core/arp_and_chords_tab_widget.cpp index 0c6a666b0..4b501ee14 100644 --- a/src/core/arp_and_chords_tab_widget.cpp +++ b/src/core/arp_and_chords_tab_widget.cpp @@ -52,6 +52,7 @@ #include "pixmap_button.h" #include "knob.h" #include "tooltip.h" +#include "gui_templates.h" #ifdef HAVE_STDLIB_H @@ -324,28 +325,6 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track, m_arpDirectionLbl->setFont( pointSize<6>( m_arpDirectionLbl->font() ) ); -/* m_arpOffBtn = new pixmapButton( m_arpGroupBox ); - m_arpOffBtn->move( 10, 87 ); - m_arpOffBtn->setActiveGraphic( embed::getIconPixmap( "arp_off_on" ) ); - m_arpOffBtn->setInactiveGraphic( embed::getIconPixmap( - "arp_off_off" ) ); -#ifdef QT4 - m_arpOffBtn->setChecked( TRUE ); -#else - m_arpOffBtn->setOn( TRUE ); -#endif -#ifndef QT4 - m_arpOffBtn->setBackgroundMode( Qt::PaletteBackground ); -#endif -#ifdef QT4 - m_arpOffBtn->setToolTip( -#else - toolTip::add( m_arpOffBtn, -#endif - tr( "arpeggio direction = none = no arpeggio" ) ); - connect( m_arpOffBtn, SIGNAL( toggled( bool ) ), this, - SLOT( arpOffToggled( bool ) ) );*/ - m_arpUpBtn = new pixmapButton( m_arpGroupBox ); m_arpUpBtn->move( 80, 70 ); @@ -403,7 +382,6 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track, SLOT( arpRandomToggled( bool ) ) ); QButtonGroup * m_arpDirections_group = new QButtonGroup( this ); -// m_arpDirections_group->addButton( m_arpOffBtn ); m_arpDirections_group->addButton( m_arpUpBtn ); m_arpDirections_group->addButton( m_arpDownBtn ); m_arpDirections_group->addButton( m_arpUpAndDownBtn ); diff --git a/src/core/bb_editor.cpp b/src/core/bb_editor.cpp index fe3fbad95..ba5d0c46e 100644 --- a/src/core/bb_editor.cpp +++ b/src/core/bb_editor.cpp @@ -256,24 +256,17 @@ void bbEditor::closeEvent( QCloseEvent * _ce ) -/*void bbEditor::paintEvent( QPaintEvent * ) -{ -}*/ - - - - void bbEditor::keyPressEvent( QKeyEvent * _ke ) { if ( _ke->key() == Qt::Key_Space ) { if( songEditor::inst()->playing() ) { - stop (); + stop(); } else { - play (); + play(); } } else if ( _ke->key() == Qt::Key_Plus ) @@ -347,6 +340,7 @@ void bbEditor::updateBackground( void ) + void bbEditor::play( void ) { if( songEditor::inst()->playing() ) @@ -362,7 +356,7 @@ void bbEditor::play( void ) { songEditor::inst()->pause(); m_playButton->setInactiveGraphic( - embed::getIconPixmap("play") ); + embed::getIconPixmap( "play" ) ); } } else if( songEditor::inst()->paused() ) @@ -428,7 +422,7 @@ void bbEditor::createTCOsForBB( csize _bb ) trackVector tv = tracks(); for( trackVector::iterator it = tv.begin(); it != tv.end(); ++it ) { - while( ( *it )->numOfTCOs() < _bb+1 ) + while( ( *it )->numOfTCOs() < _bb + 1 ) { midiTime position = midiTime( ( *it )->numOfTCOs(), 0 ); trackContentObject * tco = ( *it )->addTCO( diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 9bef358a3..3ada40fe4 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -71,7 +71,7 @@ #include "config_mgr.h" #include "embed.h" -#include "templates.h" +#include "gui_templates.h" diff --git a/src/core/envelope_and_lfo_widget.cpp b/src/core/envelope_and_lfo_widget.cpp index 12d1790fd..5fb594e45 100644 --- a/src/core/envelope_and_lfo_widget.cpp +++ b/src/core/envelope_and_lfo_widget.cpp @@ -57,6 +57,7 @@ #include "oscillator.h" #include "debug.h" #include "tooltip.h" +#include "gui_templates.h" // how long should be each envelope-segment maximal (e.g. attack)? diff --git a/src/core/envelope_tab_widget.cpp b/src/core/envelope_tab_widget.cpp index c3cd6347c..8bd5fb236 100644 --- a/src/core/envelope_tab_widget.cpp +++ b/src/core/envelope_tab_widget.cpp @@ -51,7 +51,7 @@ #include "group_box.h" #include "tab_widget.h" #include "embed.h" -#include "templates.h" +#include "gui_templates.h" const int TARGETS_TABWIDGET_X = 4; @@ -71,7 +71,7 @@ const float RES_PRECISION = 1000.0f; // names for env- and lfo-targets - first is name being displayed to user // and second one is used internally, e.g. for saving/restoring settings -const QString targetNames[envelopeTabWidget::TARGET_COUNT][2] = +const char * targetNames[envelopeTabWidget::TARGET_COUNT][2] = { { envelopeTabWidget::tr( "VOLUME" ), "vol" }, /* envelopeTabWidget::tr( "Pan" ), @@ -512,7 +512,8 @@ void envelopeTabWidget::saveSettings( QDomDocument & _doc, { QDomElement target_de = _doc.createElement( m_envLFOWidgets[i]->nodeName() + - targetNames[i][1].toLower() ); + QString( + targetNames[i][1] ).toLower() ); m_envLFOWidgets[i]->saveSettings( _doc, target_de ); etw_de.appendChild( target_de ); } @@ -542,7 +543,7 @@ void envelopeTabWidget::loadSettings( const QDomElement & _this ) { if( node.nodeName() == m_envLFOWidgets[i]->nodeName() + - targetNames[i][1].toLower() ) + QString( targetNames[i][1] ).toLower() ) { m_envLFOWidgets[i]->loadSettings( node.toElement() ); diff --git a/src/core/main.cpp b/src/core/main.cpp index fc9392c56..f34bca727 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -45,7 +45,7 @@ #include "config_mgr.h" #include "export_project_dialog.h" #include "song_editor.h" -#include "templates.h" +#include "gui_templates.h" #if QT_VERSION >= 0x030100 diff --git a/src/core/mixer.cpp b/src/core/mixer.cpp index c8c05398b..a81bdcaea 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -111,9 +111,10 @@ mixer::mixer() : m_silence = bufferAllocator::alloc( m_framesPerAudioBuffer ); +#ifndef DISABLE_SURROUND m_surroundSilence = bufferAllocator::alloc( m_framesPerAudioBuffer ); - +#endif for( Uint32 frame = 0; frame < m_framesPerAudioBuffer; ++frame ) { for( Uint8 chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl ) @@ -151,6 +152,11 @@ mixer::~mixer() bufferAllocator::free( m_samplePackets[i].m_buffer ); } } + + bufferAllocator::free( m_silence ); +#ifndef DISABLE_SURROUND + bufferAllocator::free( m_surroundSilence ); +#endif } @@ -181,16 +187,16 @@ void mixer::run( void ) // remove all play-handles that have to be deleted and delete // them if they still exist... // maybe this algorithm could be optimized... - while( !m_playHandlesToRemove.isEmpty() ) + while( !m_playHandlesToRemove.empty() ) { playHandleVector::iterator it = m_playHandles.begin(); while( it != m_playHandles.end() ) { - if( *it == m_playHandlesToRemove.first() ) + if( *it == m_playHandlesToRemove.front() ) { m_playHandles.erase( it ); - delete m_playHandlesToRemove.first(); + delete m_playHandlesToRemove.front(); break; } ++it; diff --git a/src/core/name_label.cpp b/src/core/name_label.cpp index a2565b444..2934df78a 100644 --- a/src/core/name_label.cpp +++ b/src/core/name_label.cpp @@ -41,9 +41,8 @@ #include "rename_dialog.h" #include "bb_editor.h" #include "bb_track.h" -#include "templates.h" +#include "gui_templates.h" -#include "name_label.moc" nameLabel::nameLabel( const QString & _initial_name, QWidget * _parent, @@ -151,3 +150,9 @@ void nameLabel::mouseDoubleClickEvent( QMouseEvent * _me ) { rename(); } + + + + +#include "name_label.moc" + diff --git a/src/core/piano_roll.cpp b/src/core/piano_roll.cpp index 88e9c3a41..cd8815107 100644 --- a/src/core/piano_roll.cpp +++ b/src/core/piano_roll.cpp @@ -51,7 +51,7 @@ #include "crystal_button.h" #include "pixmap_button.h" #include "note_play_handle.h" -#include "templates.h" +#include "gui_templates.h" #include "timeline.h" #include "channel_track.h" #include "tooltip.h" @@ -469,7 +469,7 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern ) noteVector & notes = m_pattern->notes(); int central_key = 0; - if( notes.isEmpty() == FALSE ) + if( notes.empty() == FALSE ) { // determine the central key so that we can scroll to it int total_notes = 0; @@ -2202,15 +2202,15 @@ void pianoRoll::copySelectedNotes( void ) noteVector selected_notes; getSelectedNotes( selected_notes ); - if( selected_notes.isEmpty() == FALSE ) + if( selected_notes.empty() == FALSE ) { - midiTime start_pos( selected_notes.first()->pos().getTact(), + midiTime start_pos( selected_notes.front()->pos().getTact(), 0 ); for( noteVector::iterator it = selected_notes.begin(); it != selected_notes.end(); ++it ) { m_notesToCopy.push_back( new note( **it ) ); - m_notesToCopy.last()->setPos( m_notesToCopy.last()->pos( + m_notesToCopy.back()->setPos( m_notesToCopy.back()->pos( start_pos ) ); } } @@ -2237,22 +2237,22 @@ void pianoRoll::cutSelectedNotes( void ) noteVector selected_notes; getSelectedNotes( selected_notes ); - if( selected_notes.isEmpty() == FALSE ) + if( selected_notes.empty() == FALSE ) { songEditor::inst()->setModified(); - midiTime start_pos( selected_notes.first()->pos().getTact(), + midiTime start_pos( selected_notes.front()->pos().getTact(), 0 ); - while( selected_notes.isEmpty() == FALSE ) + while( selected_notes.empty() == FALSE ) { - note * new_note = new note( *selected_notes.first() ); + note * new_note = new note( *selected_notes.front() ); new_note->setPos( new_note->pos( start_pos ) ); m_notesToCopy.push_back( new_note ); // note (the memory of it) is also deleted by // pattern::removeNote(...) so we don't have to do that - m_pattern->removeNote( selected_notes.first() ); + m_pattern->removeNote( selected_notes.front() ); selected_notes.erase( selected_notes.begin() ); } } @@ -2271,7 +2271,7 @@ void pianoRoll::pasteNotes( void ) return; } - if( m_notesToCopy.isEmpty() == FALSE ) + if( m_notesToCopy.empty() == FALSE ) { for( noteVector::iterator it = m_notesToCopy.begin(); it != m_notesToCopy.end(); ++it ) @@ -2302,11 +2302,11 @@ void pianoRoll::deleteSelectedNotes( void ) noteVector selected_notes; getSelectedNotes( selected_notes ); - const bool update_after_delete = !selected_notes.isEmpty(); + const bool update_after_delete = !selected_notes.empty(); - while( selected_notes.isEmpty() == FALSE ) + while( selected_notes.empty() == FALSE ) { - m_pattern->removeNote( selected_notes.first() ); + m_pattern->removeNote( selected_notes.front() ); selected_notes.erase( selected_notes.begin() ); } diff --git a/src/core/setup_dialog.cpp b/src/core/setup_dialog.cpp index 68b3a8cd3..4112887e0 100644 --- a/src/core/setup_dialog.cpp +++ b/src/core/setup_dialog.cpp @@ -49,7 +49,7 @@ #include "tab_bar.h" #include "tab_button.h" #include "tab_widget.h" -#include "templates.h" +#include "gui_templates.h" #include "mixer.h" #include "config_mgr.h" #include "embed.h" diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index edc6d8193..3c0064f1a 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -736,13 +736,14 @@ int songEditor::masterPitch( void ) const void songEditor::doActions( void ) { - while( !m_actions.isEmpty() ) + while( !m_actions.empty() ) { - timeLine * tl = m_playPos[m_playMode].m_timeLine; switch( m_actions.front() ) { case ACT_STOP_PLAY: { + timeLine * tl = + m_playPos[m_playMode].m_timeLine; m_playing = FALSE; if( tl != NULL ) { @@ -825,11 +826,15 @@ void songEditor::doActions( void ) case ACT_PLAY_TRACK: case ACT_PLAY_BB: case ACT_PLAY_PATTERN: + { + timeLine * tl = + m_playPos[m_playMode].m_timeLine; if( tl != NULL ) { tl->savePos( m_playPos[m_playMode] ); } break; + } // keep GCC happy... default: @@ -891,7 +896,7 @@ void songEditor::processNextBuffer( void ) } - if( tv.isEmpty() == TRUE ) + if( tv.empty() == TRUE ) { return; } @@ -972,6 +977,7 @@ void songEditor::processNextBuffer( void ) m_playPos[m_playMode].currentFrame(); } + // loop through all tracks and play them if they're not muted for( trackVector::iterator it = tv.begin(); it != tv.end(); ++it ) { diff --git a/src/core/timeline.cpp b/src/core/timeline.cpp index cc6999ad8..29fb960a5 100644 --- a/src/core/timeline.cpp +++ b/src/core/timeline.cpp @@ -165,7 +165,7 @@ void timeLine::updatePosition( const midiTime & ) #ifndef QT4 qApp->lock(); #endif - update(); + paintEvent( NULL ); #ifndef QT4 qApp->unlock(); #endif diff --git a/src/core/track.cpp b/src/core/track.cpp index 40b4b2740..674288ac6 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -420,9 +420,9 @@ void trackContentWidget::removeTCO( trackContentObject * _tco, void trackContentWidget::removeAllTCOs( void ) { - while( !m_trackContentObjects.isEmpty() ) + while( !m_trackContentObjects.empty() ) { - delete m_trackContentObjects.first(); + delete m_trackContentObjects.front(); m_trackContentObjects.erase( m_trackContentObjects.begin() ); } } diff --git a/src/core/track_container.cpp b/src/core/track_container.cpp index 24c3a815f..e5d3be404 100644 --- a/src/core/track_container.cpp +++ b/src/core/track_container.cpp @@ -50,6 +50,7 @@ #include "bb_track.h" #include "lmms_main_win.h" #include "mixer.h" +#include "song_editor.h" @@ -215,6 +216,7 @@ void trackContainer::removeTrack( track * _track ) mixer::inst()->play(); realignTracks(); + songEditor::inst()->setModified(); } } diff --git a/src/lib/buffer_allocator.cpp b/src/lib/buffer_allocator.cpp index 97b262bd8..f49391937 100644 --- a/src/lib/buffer_allocator.cpp +++ b/src/lib/buffer_allocator.cpp @@ -96,7 +96,11 @@ const int BUFFER_ALIGN_MASK = BUFFER_ALIGN - 1; void bufferAllocator::cleanUp( Uint16 _level ) { // first insert all unused bufs into an array +#if QT_VERSION >= 0x030100 vvector bufsToRemove; +#else + vlist bufsToRemove; +#endif for( bufIt it = s_buffers.begin(); it != s_buffers.end(); ++it ) { if( ( *it ).free ) diff --git a/src/lib/embed.cpp b/src/lib/embed.cpp index eabc07d50..9bd9934bb 100644 --- a/src/lib/embed.cpp +++ b/src/lib/embed.cpp @@ -97,26 +97,31 @@ QString getText( const char * _name ) void loadTranslation( const QString & _tname ) { -#if QT_VERSION >= 0x030100 + QTranslator * t = new QTranslator( 0 ); QString name = _tname + ".qm"; + +#if QT_VERSION >= 0x030100 + #ifdef QT4 const embedDesc & e = findEmbeddedData( name.toAscii().constData() ); #else const embedDesc & e = findEmbeddedData( name.ascii() ); #endif - QTranslator * t = new QTranslator( 0 ); // not found? if( QString( e.name ) != name ) { +#endif // then look whether translation is in data-dir t->load( name, configManager::inst()->localeDir() ); +#if QT_VERSION >= 0x030100 } else { t->load( e.data, (int) e.size ); } - qApp->installTranslator( t ); #endif + + qApp->installTranslator( t ); } diff --git a/src/midi/midi_alsa_raw.cpp b/src/midi/midi_alsa_raw.cpp index a9062c591..8fc8a1b68 100644 --- a/src/midi/midi_alsa_raw.cpp +++ b/src/midi/midi_alsa_raw.cpp @@ -40,7 +40,7 @@ #include "midi_alsa_raw.h" #include "config_mgr.h" -#include "templates.h" +#include "gui_templates.h" #ifdef ALSA_SUPPORT diff --git a/src/midi/midi_mapper.cpp b/src/midi/midi_mapper.cpp index 46d82466e..a4f71773e 100644 --- a/src/midi/midi_mapper.cpp +++ b/src/midi/midi_mapper.cpp @@ -73,7 +73,14 @@ midiMapper::midiMapper( const QString & _map ) : continue; } QString line( buf ); +#if QT_VERSION >= 0x030100 line.replace( '\n', "" ); +#else + if( line.contains( '\n' ) ) + { + line = line.left( line.length() - 1 ); + } +#endif if( line.left( 6 ) == "DEFINE" ) { if( line.section( ' ', 1, 1 ) == "PATCHMAP" ) @@ -117,18 +124,28 @@ void midiMapper::readPatchMap( QFile & _f ) continue; } QString line( buf ); +#if QT_VERSION >= 0x030100 line.replace( '\n', "" ); +#else + if( line.contains( '\n' ) ) + { + line = line.left( line.length() - 1 ); + } +#endif if( line.left( 3 ) == "END" ) { return; } - if( QString( line ).replace( ' ', "" )[0] == '#' ) + if( line[0] == '#' ) { continue; } m_patchMap[prog_idx].first = line.section( '=', 1, 1 ).toInt(); - m_patchMap[prog_idx].second = line.section( '=', 0, 0 ). - replace( ' ', "" ); + m_patchMap[prog_idx].second = line.section( '=', 0, 0 ) +#if QT_VERSION >= 0x030100 + .replace( ' ', "" ) +#endif + ; ++prog_idx; } } @@ -148,12 +165,19 @@ void midiMapper::readDrumsetKeyMap( QFile & _f ) continue; } QString line( buf ); +#if QT_VERSION >= 0x030100 line.replace( '\n', "" ); +#else + if( line.contains( '\n' ) ) + { + line = line.left( line.length() - 1 ); + } +#endif if( line.left( 3 ) == "END" ) { return; } - if( QString( line ).replace( ' ', "" )[0] == '#' ) + if( line[0] == '#' ) { continue; } @@ -164,8 +188,11 @@ void midiMapper::readDrumsetKeyMap( QFile & _f ) m_drumsetKeyMap[key].second = line.mid( 4 ). section( '=', 0, 0 ). - section( ' ', 1, 1 ). - replace( ' ', "" ); + section( ' ', 1, 1 ) +#if QT_VERSION >= 0x030100 + .replace( ' ', "" ) +#endif + ; } ++key; } @@ -185,12 +212,19 @@ void midiMapper::readChannelMap( QFile & _f ) continue; } QString line( buf ); +#if QT_VERSION >= 0x030100 line.replace( '\n', "" ); +#else + if( line.contains( '\n' ) ) + { + line = line.left( line.length() - 1 ); + } +#endif if( line.left( 3 ) == "END" ) { return; } - if( QString( line ).replace( ' ', "" )[0] == '#' ) + if( line[0] == '#' ) { continue; } diff --git a/src/midi/midi_oss.cpp b/src/midi/midi_oss.cpp index 3efb32835..8d6c7fb2b 100644 --- a/src/midi/midi_oss.cpp +++ b/src/midi/midi_oss.cpp @@ -22,6 +22,11 @@ */ +#include "midi_oss.h" + +#ifdef OSS_SUPPORT + + #include "qt3support.h" #ifdef QT4 @@ -38,9 +43,8 @@ #endif -#include "midi_oss.h" #include "config_mgr.h" -#include "templates.h" +#include "gui_templates.h" @@ -72,9 +76,12 @@ midiOSS::midiOSS( channelTrack * _ct ) : midiOSS::~midiOSS() { - m_quit = TRUE; - wait( 500 ); - terminate(); + if( running() ) + { + m_quit = TRUE; + wait( 500 ); + terminate(); + } } @@ -162,3 +169,6 @@ void midiOSS::setupWidget::saveSettings( void ) } + +#endif + diff --git a/src/tracks/bb_track.cpp b/src/tracks/bb_track.cpp index ebfab85dd..ed6392f85 100644 --- a/src/tracks/bb_track.cpp +++ b/src/tracks/bb_track.cpp @@ -44,12 +44,11 @@ #include "bb_track.h" #include "song_editor.h" #include "bb_editor.h" -#include "templates.h" +#include "gui_templates.h" #include "name_label.h" #include "embed.h" #include "rename_dialog.h" -#include "bb_track.moc" QMap bbTrack::s_bbNums; @@ -164,10 +163,10 @@ void bbTCO::paintEvent( QPaintEvent * ) QPainter p( &pm ); // COOL gradient ;-) - for( int y = 0; y < height(); ++y ) + for( int y = 1; y < height() - 1; ++y ) { p.setPen( col.light( 130 - y * 60 / height() ) ); - p.drawLine( 0, y, width(), y ); + p.drawLine( 1, y, width() - 1, y ); } //pm.fill( col ); #endif @@ -507,3 +506,9 @@ void bbTrack::clickedTrackLabel( void ) bbEditor::inst()->setCurrentBB( s_bbNums[this].num ); bbEditor::inst()->show(); } + + + + +#include "bb_track.moc" + diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index c228da758..f2fbe353c 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -51,6 +51,7 @@ #include "pattern.h" #include "channel_track.h" #include "templates.h" +#include "gui_templates.h" #include "embed.h" #include "piano_roll.h" #include "track_container.h" @@ -748,7 +749,7 @@ note * pattern::addNote( const note & _new_note ) { note * new_note = new note( _new_note ); - if( m_notes.size() == 0 || m_notes.last()->pos() <= new_note->pos() ) + if( m_notes.size() == 0 || m_notes.back()->pos() <= new_note->pos() ) { m_notes.push_back( new_note ); } diff --git a/src/widgets/group_box.cpp b/src/widgets/group_box.cpp index 5da124577..0dbffb5b0 100644 --- a/src/widgets/group_box.cpp +++ b/src/widgets/group_box.cpp @@ -40,13 +40,17 @@ #endif +#ifndef __USE_XOPEN +#define __USE_XOPEN +#endif + #include #include "group_box.h" #include "embed.h" #include "spc_bg_hndl_widget.h" -#include "templates.h" +#include "gui_templates.h" QPixmap * groupBox::s_ledBg = NULL; diff --git a/src/widgets/knob.cpp b/src/widgets/knob.cpp index 0fd057fa2..3d581cdcc 100644 --- a/src/widgets/knob.cpp +++ b/src/widgets/knob.cpp @@ -65,10 +65,11 @@ #include "midi_device.h" #include "embed.h" #include "spc_bg_hndl_widget.h" -//#include "tooltip.h" #include "config_mgr.h" #include "text_float.h" #include "mixer.h" +#include "gui_templates.h" +#include "templates.h" const int WHEEL_DELTA = 120; diff --git a/src/widgets/lcd_spinbox.cpp b/src/widgets/lcd_spinbox.cpp index 61ba76704..9d7adfdd5 100644 --- a/src/widgets/lcd_spinbox.cpp +++ b/src/widgets/lcd_spinbox.cpp @@ -41,10 +41,10 @@ #include "lcd_spinbox.h" +#include "gui_templates.h" #include "templates.h" - lcdSpinBox::lcdSpinBox( int _min, int _max, int _num_digits, QWidget * _parent ) : QWidget( _parent ), diff --git a/src/widgets/led_checkbox.cpp b/src/widgets/led_checkbox.cpp index 117eb2ed9..04f9cc623 100644 --- a/src/widgets/led_checkbox.cpp +++ b/src/widgets/led_checkbox.cpp @@ -43,7 +43,7 @@ #include "led_checkbox.h" #include "embed.h" -#include "templates.h" +#include "gui_templates.h" #include "spc_bg_hndl_widget.h" diff --git a/src/widgets/nstate_button.cpp b/src/widgets/nstate_button.cpp index 258621455..b16ff1dd2 100644 --- a/src/widgets/nstate_button.cpp +++ b/src/widgets/nstate_button.cpp @@ -59,7 +59,7 @@ nStateButton::~nStateButton() { while( m_states.size() ) { - delete m_states.first().first; + delete m_states.front().first; m_states.erase( m_states.begin() ); } } diff --git a/src/widgets/side_bar_widget.cpp b/src/widgets/side_bar_widget.cpp index c7ac75969..e890cb6ad 100644 --- a/src/widgets/side_bar_widget.cpp +++ b/src/widgets/side_bar_widget.cpp @@ -41,12 +41,12 @@ #include "side_bar_widget.h" #include "types.h" -#include "templates.h" +#include "gui_templates.h" sideBarWidget::sideBarWidget( const QString & _title, const QPixmap & _icon, - QWidget * _parent ) : + QWidget * _parent ) : QWidget( _parent ), m_title( _title ), m_icon( _icon ) diff --git a/src/widgets/tab_bar.cpp b/src/widgets/tab_bar.cpp index be1e48b2c..319e772b0 100644 --- a/src/widgets/tab_bar.cpp +++ b/src/widgets/tab_bar.cpp @@ -24,7 +24,7 @@ #include "tab_bar.h" #include "tab_button.h" -#include "templates.h" +#include "gui_templates.h" #include "tooltip.h" #ifndef QT4 @@ -68,7 +68,7 @@ tabButton * tabBar::addTab( QWidget * _w, const QString & _text, int _id, // then remove it removeTab( _id ); } - QString caption = ( _text_is_tooltip ) ? "" : _text; + QString caption = ( _text_is_tooltip ) ? QString( "" ) : _text; // create tab-button tabButton * b = new tabButton( caption, _id, this ); connect( b, SIGNAL( clicked( int ) ), this, SLOT( tabClicked( int ) ) ); diff --git a/src/widgets/tab_widget.cpp b/src/widgets/tab_widget.cpp index 137f0c984..5b146a3a4 100644 --- a/src/widgets/tab_widget.cpp +++ b/src/widgets/tab_widget.cpp @@ -39,7 +39,7 @@ #include "tab_widget.h" -#include "templates.h" +#include "gui_templates.h" diff --git a/src/widgets/text_float.cpp b/src/widgets/text_float.cpp index d7ac19b57..923167f52 100644 --- a/src/widgets/text_float.cpp +++ b/src/widgets/text_float.cpp @@ -41,7 +41,7 @@ #include "text_float.h" -#include "templates.h" +#include "gui_templates.h" diff --git a/src/widgets/tooltip.cpp b/src/widgets/tooltip.cpp index 2adecd349..517b48c17 100644 --- a/src/widgets/tooltip.cpp +++ b/src/widgets/tooltip.cpp @@ -50,10 +50,3 @@ void toolTip::add( QWidget * _w, const QString & _txt ) } } - -/* -void toolTip::remove( QWidget * _w ) -{ - QToolTip::remove( _w ); -} -*/