diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..2d3660912 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: cpp +compiler: gcc +before_install: sudo apt-get update +install: (sudo apt-get install libqt4-dev libsndfile-dev fftw3-dev libvorbis-dev libogg-dev libasound2-dev libjack-dev libsdl-dev libsamplerate0-dev libstk0-dev libfluidsynth-dev portaudio19-dev) && (sudo apt-get install wine-dev libc6-dev-amd64 || true) +before_script: mkdir build && cd build +script: cmake .. && make -j8 diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cf175850..65e5916d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,8 @@ CHECK_INCLUDE_FILES(string.h LMMS_HAVE_STRING_H) CHECK_INCLUDE_FILES(process.h LMMS_HAVE_PROCESS_H) CHECK_INCLUDE_FILES(locale.h LMMS_HAVE_LOCALE_H) +LIST(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) + # check for Qt4 SET(QT_MIN_VERSION "4.3.0" COMPONENTS QtCore QtGui QtXml) FIND_PACKAGE(Qt4 REQUIRED) @@ -397,22 +399,25 @@ IF(LMMS_BUILD_WIN32) SET(EXTRA_LIBRARIES "-lwinmm") ENDIF() -ADD_DEFINITIONS(-D'LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/"' -D'PLUGIN_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/lmms/"' ${PULSEAUDIO_DEFINITIONS} ${PORTAUDIO_DEFINITIONS}) +# Paths relative to lmms executable +FILE(RELATIVE_PATH LIB_DIR_RELATIVE /${BIN_DIR} /${LIB_DIR}) +FILE(RELATIVE_PATH PLUGIN_DIR_RELATIVE /${BIN_DIR} /${PLUGIN_DIR}) +ADD_DEFINITIONS(-D'LIB_DIR="${LIB_DIR_RELATIVE}/"' -D'PLUGIN_DIR="${PLUGIN_DIR_RELATIVE}/"' ${PULSEAUDIO_DEFINITIONS} ${PORTAUDIO_DEFINITIONS}) INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${SDL_INCLUDE_DIR} ${PORTAUDIO_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR} ${JACK_INCLUDE_DIRS} ${OGGVORBIS_INCLUDE_DIR} ${SAMPLERATE_INCLUDE_DIRS} ${SNDFILE_INCLUDE_DIRS}) -LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib ${ASOUND_LIBRARY_DIR} ${JACK_LIBRARY_DIRS} ${SAMPLERATE_LIBRARY_DIRS} ${SNDFILE_LIBRARY_DIRS}) -LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} ${ASOUND_LIBRARY} ${SDL_LIBRARY} ${PORTAUDIO_LIBRARIES} ${PULSEAUDIO_LIBRARIES} ${JACK_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${SNDFILE_LIBRARIES} ${EXTRA_LIBRARIES}) ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/lmms.1.gz COMMAND gzip -c ${CMAKE_SOURCE_DIR}/lmms.1 > ${CMAKE_BINARY_DIR}/lmms.1.gz DEPENDS ${CMAKE_SOURCE_DIR}/lmms.1 COMMENT "Generating lmms.1.gz") ADD_EXECUTABLE(lmms ${lmms_SOURCES} ${lmms_INCLUDES} ${LIBSAMPLERATE_SOURCES} ${LMMS_ER_H} ${lmms_UI_out} lmmsconfig.h lmmsversion.h ${WINRC} ${CMAKE_BINARY_DIR}/lmms.1.gz) +TARGET_LINK_LIBRARIES(lmms ${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} ${ASOUND_LIBRARY} ${SDL_LIBRARY} ${PORTAUDIO_LIBRARIES} ${PULSEAUDIO_LIBRARIES} ${JACK_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${SNDFILE_LIBRARIES} ${EXTRA_LIBRARIES}) + IF(LMMS_BUILD_WIN32) SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -mwindows") ADD_CUSTOM_COMMAND(TARGET lmms POST_BUILD COMMAND ${STRIP} ${CMAKE_BINARY_DIR}/lmms.exe) - INSTALL(TARGETS lmms RUNTIME DESTINATION .) + INSTALL(TARGETS lmms RUNTIME DESTINATION ${BIN_DIR}) INSTALL(FILES ${MINGW_PREFIX}/bin/QtCore4.dll ${MINGW_PREFIX}/bin/QtGui4.dll @@ -438,7 +443,7 @@ ELSE(LMMS_BUILD_WIN32) SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -Wl,-E") ENDIF(NOT LMMS_BUILD_APPLE) - INSTALL(TARGETS lmms RUNTIME DESTINATION bin) + INSTALL(TARGETS lmms RUNTIME DESTINATION ${BIN_DIR}) INSTALL(FILES ${CMAKE_BINARY_DIR}/lmms.1.gz DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1/ PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) ENDIF(LMMS_BUILD_WIN32) @@ -505,7 +510,7 @@ ADD_CUSTOM_TARGET(dist COMMAND mkdir -p ${TMP} COMMAND cp AUTHORS build_mingw32 build_mingw64 CMakeLists.txt configure COPYING INSTALL lmms.1 lmms.rc.in lmms.spec.in lmmsconfig.h.in lmmsversion.h.in README TODO ${TMP} COMMAND cp -r buildtools cmake data include plugins src ${TMP} - COMMAND rm -rf `find ${TMP} -type d -name ".svn"` `find ${TMP} -name cmake_install.cmake` `find ${TMP} -name Makefile` `find ${TMP} -type d -name CMakeFiles` ${TMP}/CMakeCache.txt + COMMAND rm -rf `find ${TMP} -name cmake_install.cmake` `find ${TMP} -name Makefile` `find ${TMP} -type d -name CMakeFiles` ${TMP}/CMakeCache.txt COMMAND tar cjf lmms-${VERSION}.tar.bz2 ${TMP} COMMAND rm -rf ${TMP}) diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index 2e21eb0ad..283c4ba79 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -54,7 +54,7 @@ MACRO(BUILD_PLUGIN) CAR(PLUGIN_NAME ${PLUGIN_DEFAULT_ARGS}) CDR(PLUGIN_SOURCES ${PLUGIN_DEFAULT_ARGS}) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/gui ${CMAKE_INSTALL_PREFIX}/include) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/gui) ADD_DEFINITIONS(-DPLUGIN_NAME=${PLUGIN_NAME}) diff --git a/cmake/modules/DetectMachine.cmake b/cmake/modules/DetectMachine.cmake index 9642da3c2..ccb8638be 100644 --- a/cmake/modules/DetectMachine.cmake +++ b/cmake/modules/DetectMachine.cmake @@ -44,10 +44,12 @@ ENDIF(CMAKE_INSTALL_LIBDIR) IF(LMMS_BUILD_WIN32) + SET(BIN_DIR .) SET(PLUGIN_DIR plugins) SET(DATA_DIR data) SET(LMMS_DATA_DIR data) ELSE(LMMS_BUILD_WIN32) + SET(BIN_DIR bin) SET(PLUGIN_DIR ${LIB_DIR}/lmms) SET(DATA_DIR share) SET(LMMS_DATA_DIR ${DATA_DIR}/lmms) diff --git a/data/themes/default/controller_bg.png b/data/themes/default/controller_bg.png index dc9c9f011..6d7830fff 100644 Binary files a/data/themes/default/controller_bg.png and b/data/themes/default/controller_bg.png differ diff --git a/data/themes/default/effect_plugin.png b/data/themes/default/effect_plugin.png index d510bebfe..567bc31ae 100644 Binary files a/data/themes/default/effect_plugin.png and b/data/themes/default/effect_plugin.png differ diff --git a/data/themes/default/fader_background.png b/data/themes/default/fader_background.png index ac7c91647..2c0d0dd49 100644 Binary files a/data/themes/default/fader_background.png and b/data/themes/default/fader_background.png differ diff --git a/data/themes/default/fader_knob.png b/data/themes/default/fader_knob.png index 7b21b8262..93daf87fc 100644 Binary files a/data/themes/default/fader_knob.png and b/data/themes/default/fader_knob.png differ diff --git a/data/themes/default/fader_leds.png b/data/themes/default/fader_leds.png index 522a45989..6c673cf36 100644 Binary files a/data/themes/default/fader_leds.png and b/data/themes/default/fader_leds.png differ diff --git a/data/themes/default/knob02.png b/data/themes/default/knob02.png index bd491a8d6..c4e84a314 100644 Binary files a/data/themes/default/knob02.png and b/data/themes/default/knob02.png differ diff --git a/data/themes/default/knob03.png b/data/themes/default/knob03.png index b663e9e38..d620272bf 100644 Binary files a/data/themes/default/knob03.png and b/data/themes/default/knob03.png differ diff --git a/data/themes/default/lfo_controller_artwork.png b/data/themes/default/lfo_controller_artwork.png index 812ee37ad..f1ddacec0 100644 Binary files a/data/themes/default/lfo_controller_artwork.png and b/data/themes/default/lfo_controller_artwork.png differ diff --git a/data/themes/default/main_slider.png b/data/themes/default/main_slider.png new file mode 100644 index 000000000..6f7b990a4 Binary files /dev/null and b/data/themes/default/main_slider.png differ diff --git a/data/themes/default/pause.png b/data/themes/default/pause.png index d133bdc5f..c9b45d7d9 100644 Binary files a/data/themes/default/pause.png and b/data/themes/default/pause.png differ diff --git a/data/themes/default/play.png b/data/themes/default/play.png index 2820368e8..eea2cf9b6 100644 Binary files a/data/themes/default/play.png and b/data/themes/default/play.png differ diff --git a/data/themes/default/record.png b/data/themes/default/record.png index 7f3eef114..125107958 100644 Binary files a/data/themes/default/record.png and b/data/themes/default/record.png differ diff --git a/data/themes/default/record_accompany.png b/data/themes/default/record_accompany.png index 1a58c2a12..0dbbb91b9 100644 Binary files a/data/themes/default/record_accompany.png and b/data/themes/default/record_accompany.png differ diff --git a/data/themes/default/stop.png b/data/themes/default/stop.png index 4ecbdf6ed..4e64f396c 100644 Binary files a/data/themes/default/stop.png and b/data/themes/default/stop.png differ diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 8a811f09f..0aed57e49 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -13,6 +13,17 @@ AutomationEditor { } +QLineEdit { + border-radius: 4px; + border: 2px inset rgba(91,101,113,128); + background: #49515b; + color: #e0e0e0; +} + +QLineEdit:focus { + border: 1px solid rgba(0,0,0, 128); +} + QToolTip { border-radius: 4px; @@ -91,11 +102,10 @@ trackOperationsWidget > QPushButton { max-width: 26px; min-height: 26px; min-width: 26px; - background-color: #c9c9c9; - border-radius: 2px; - border: 1px solid rgba(0,0,0,64); + background: none; + border:none; } - +/* trackOperationsWidget > QPushButton:hover { background: qlineargradient(spread:reflect, x1:0.5, y1:0.5, x2:0.5, y2:0, stop:0 rgba(224, 224, 224, 255), stop:1 rgba(201, 201, 201, 255)); border: 1px solid rgba(0,0,0,255); @@ -113,23 +123,27 @@ trackOperationsWidget > QPushButton:flat { border-radius: 2px; border: none; } - -trackOperationsWidget#automationDisabled > QPushButton::menu-indicator { - image: url(resources:track_op_menu_disabled.png); -} - -trackOperationsWidget#automationEnabled > QPushButton::menu-indicator { - image: url(resources:track_op_menu.png); -} +*/ trackOperationsWidget > QPushButton::menu-indicator { - subcontrol-origin: padding; - subcontrol-position: center; + image: url(resources:trackop.png); + subcontrol-origin: padding; + subcontrol-position: center; + position: relative; + top: 2px; } -trackOperationsWidget > QPushButton::menu-indicator:pressed { - position: relative; - top: 1px; +trackOperationsWidget > QPushButton::menu-indicator:hover { + image: url(resources:trackop_h.png); +} + + +trackOperationsWidget > QPushButton::menu-indicator:pressed, +trackOperationsWidget > QPushButton::menu-indicator:checked + { + image: url(resources:trackop_c.png); + position: relative; + top: 3px; } trackWidget { @@ -141,6 +155,47 @@ nameLabel, effectLabel, sf2InstrumentView > QLabel { } + +automatableSlider::groove:vertical { + background: rgba(0,0,0, 128); + border: 1px inset rgba(100,100,100, 64); + border-radius: 2px; + width: 2px; + margin: 2px 2px; +} + +automatableSlider::handle:vertical { + background: none; + border-image: url(resources:main_slider.png); + width: 26px; + height: 10px; + border-radius: 2px; + margin: -4px -12px -2px; +} + + +EffectSelectDialog QScrollArea { + background: #5b6571; +} + +EffectControlDialog QGroupBox { + background: #49515b; + margin-top: 1ex; + padding: 10px 2px 1px; + border-radius: 4px; + border: 1px solid rgba(0,0,0, 64); +} + +EffectControlDialog QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + background: #7b838d; + color: white; + border-radius: 2px; + border: 1px solid rgba(0,0,0, 64); + padding: 2px 1px; +} + QWidget#mainToolbar { background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #98a2a7, stop:1 #5b646f); } @@ -150,81 +205,78 @@ QToolBar { } QToolButton, toolButton { - padding: 2px 1px 1px 2px; + padding: 1px 1px 1px 1px; border-radius: 2px; - border: 1px solid rgba(0,0,0,64); - background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #c9c9c9, stop:0.5 #c0c0c0, stop:1 #747474 ); + border: 1px solid rgba(0,0,0,32); + background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #c9c9c9, stop:1 #969696 ); font-size:10px; color: black; } QToolButton:hover, toolButton:hover { - background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #e0e0e0, stop:0.5 #c9c9c9, stop:1 #747474 ); - border: 1px solid rgba(0,0,0,255); + background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #e0e0e0, stop:0.5 #c9c9c9, stop:1 #969696 ); + border: 1px solid rgba(0,0,0,128); color: white; } -QToolButton:pressed, ToolButton:pressed { - background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #c9c9c9, stop:0.5 #c0c0c0, stop:1 #747474 ); - padding: 3px 1px 0px 2px; - border: 1px solid rgba(0,0,0,255); +QToolButton:pressed, toolButton:pressed { + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #969696, stop:0.5 #c9c9c9, stop:1 #969696 ); + padding: 2px 1px 0px 1px; + border: 1px solid rgba(0,0,0,128); color: white; } -QToolButton:checked, ToolButton:checked { +QToolButton:checked, toolButton:checked { background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #e0e0e0, stop:0.8 #c9c9c9, stop:1 #c0c0c0 ); border-radius: 3px; - padding: 3px 1px 0px 2px; + padding: 2px 1px 0px 1px; border: 1px solid rgba(0,0,0,255); color: black; } trackLabelButton { - background-color: #5b6571; - color: #c9c9c9; - font-size: 10px; - font-weight: normal; - border-radius: 1px; - border: 1px solid rgba(0,0,0,64); + background-color: #5b6571; + color: #c9c9c9; + font-size: 10px; + font-weight: normal; + border-radius: 1px; + border: none; + padding: 2px 1px; } trackLabelButton:hover { - background-color: #7b838d; - color: white; - border: 1px solid black; + background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 #5b6571, stop:0.75 #7b838d, stop:1 #7b838d ); + color: white; + border: 1px solid rgba(0,0,0,64); + padding: 1px 0px; } trackLabelButton:pressed { - background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.5 #5b6571, stop:1 #6b7581 ); + background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.3 #5b6571, stop:1 #6b7581 ); color: white; - border: 1px solid black; + border: 1px solid rgba(0,0,0,64); + padding: 2px 0px 0px; font-weight: bold; } trackLabelButton:checked { - background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.5 #5b6571, stop:1 #6b7581 ); - color: #c9c9c9; - border: 1px solid rgba(0,0,0,64); + background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.3 #5b6571, stop:1 #6b7581 ); + color: white; + border: 1px solid rgba(0,0,0,128); + padding: 2px 0px 0px; font-weight: bold; } trackLabelButton:checked:hover { - background-color: #7b838d; - color: white; - border: 1px solid black; - font-weight: bold; + background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 #5b6571, stop:0.75 #7b838d, stop:1 #7b838d ); } trackLabelButton:checked:pressed { - background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.5 #5b6571, stop:1 #6b7581 ); - color: white; - border: 1px solid black; - font-weight: bold; + background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.3 #5b6571, stop:1 #6b7581 ); } - SideBar { background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop: 0 #98a2a7, stop: 1.0 #5b646f); } @@ -311,11 +363,11 @@ sf2InstrumentView knob { } opl2instrumentView knob { - color: rgb(128,128,128); - qproperty-outerColor: rgb(255,255,255); - qproperty-innerRadius: 2; - qproperty-outerRadius: 9; - qproperty-lineWidth: 2; + color: rgb(128,128,128); + qproperty-outerColor: rgb(255,255,255); + qproperty-innerRadius: 2; + qproperty-outerRadius: 9; + qproperty-lineWidth: 2; } /* palette information - each colour definition must be on a single line, and the line must begin with "palette:", with no leading whitespace @@ -329,7 +381,7 @@ palette:button {color: #c9c9c9} palette:shadow {color: #000000} palette:buttontext {color: #000000} palette:brighttext {color: #4afd85} -palette:highlight {color: #303030} +palette:highlight {color: #202020} palette:highlightedtext {color: #ffffff} /* Notes: diff --git a/data/themes/default/trackop.png b/data/themes/default/trackop.png new file mode 100644 index 000000000..dcb8036e2 Binary files /dev/null and b/data/themes/default/trackop.png differ diff --git a/data/themes/default/trackop_c.png b/data/themes/default/trackop_c.png new file mode 100644 index 000000000..fbd6343dd Binary files /dev/null and b/data/themes/default/trackop_c.png differ diff --git a/data/themes/default/trackop_h.png b/data/themes/default/trackop_h.png new file mode 100644 index 000000000..df1ad5642 Binary files /dev/null and b/data/themes/default/trackop_h.png differ diff --git a/include/AudioDevice.h b/include/AudioDevice.h index e1d354013..9b0b3dd18 100644 --- a/include/AudioDevice.h +++ b/include/AudioDevice.h @@ -1,7 +1,7 @@ /* * AudioDevice.h - base-class for audio-devices, used by LMMS-mixer * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -130,11 +130,11 @@ protected: // convert a given audio-buffer to a buffer in signed 16-bit samples // returns num of bytes in outbuf - Uint32 convertToS16( const surroundSampleFrame * _ab, - const fpp_t _frames, - const float _master_gain, - int_sample_t * _output_buffer, - const bool _convert_endian = FALSE ); + int convertToS16( const surroundSampleFrame * _ab, + const fpp_t _frames, + const float _master_gain, + int_sample_t * _output_buffer, + const bool _convert_endian = false ); // clear given signed-int-16-buffer void clearS16Buffer( int_sample_t * _outbuf, diff --git a/include/AudioDummy.h b/include/AudioDummy.h index 70d95e36b..44595c31b 100644 --- a/include/AudioDummy.h +++ b/include/AudioDummy.h @@ -1,7 +1,7 @@ /* * AudioDummy.h - dummy audio-device * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -95,19 +95,14 @@ private: while( true ) { timer.reset(); - const surroundSampleFrame * b = - mixer()->nextBuffer(); + const surroundSampleFrame* b = mixer()->nextBuffer(); if( !b ) { break; } delete[] b; - const Sint32 microseconds = static_cast( - mixer()->framesPerPeriod() * - 1000000.0f / - mixer()->processingSampleRate() - - timer.elapsed() ); + const int microseconds = static_cast( mixer()->framesPerPeriod() * 1000000.0f / mixer()->processingSampleRate() - timer.elapsed() ); if( microseconds > 0 ) { usleep( microseconds ); diff --git a/include/AudioFileDevice.h b/include/AudioFileDevice.h index 1049aff26..992c37362 100644 --- a/include/AudioFileDevice.h +++ b/include/AudioFileDevice.h @@ -2,7 +2,7 @@ * AudioFileDevice.h - base-class for audio-device-classes which write * their output into a file * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -51,7 +51,7 @@ public: protected: - Sint32 writeData( const void * _data, Sint32 _len ); + int writeData( const void* data, int len ); inline bool useVBR() const { diff --git a/include/AudioFileOgg.h b/include/AudioFileOgg.h index 888853693..e3be6740e 100644 --- a/include/AudioFileOgg.h +++ b/include/AudioFileOgg.h @@ -2,7 +2,7 @@ * AudioFileOgg.h - Audio-device which encodes wave-stream and writes it * into an OGG-file. This is used for song-export. * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -75,7 +75,7 @@ private: bool startEncoding(); void finishEncoding(); - inline Sint32 writePage(); + inline int writePage(); bool m_ok; @@ -86,7 +86,7 @@ private: bitrate_t m_minBitrate; bitrate_t m_maxBitrate; - Uint32 m_serialNo; + uint32_t m_serialNo; vorbis_comment * m_comments; diff --git a/include/AutomatableModel.h b/include/AutomatableModel.h index 2913d2efc..37fcf2c3c 100644 --- a/include/AutomatableModel.h +++ b/include/AutomatableModel.h @@ -1,7 +1,7 @@ /* * AutomatableModel.h - declaration of class AutomatableModel * - * Copyright (c) 2007-2009 Tobias Doerffel + * Copyright (c) 2007-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -39,9 +39,9 @@ return (type) modelname->value(); \ } \ public slots: \ - inline void setfunc( const type _val ) \ + inline void setfunc( const type val ) \ { \ - modelname->setValue( _val ); \ + modelname->setValue( val ); \ } #define mapPropertyFromModel(type,getfunc,setfunc,modelname) \ @@ -51,9 +51,9 @@ return (type) modelname.value(); \ } \ public slots: \ - inline void setfunc( const type _val ) \ + inline void setfunc( const type val ) \ { \ - modelname.setValue( (float) _val ); \ + modelname.setValue( (float) val ); \ } @@ -74,60 +74,59 @@ public: Bool } ; - AutomatableModel( DataType _type, - const float _val = 0, - const float _min = 0, - const float _max = 0, - const float _step = 0, - ::Model * _parent = NULL, - const QString & _display_name = QString(), - bool _default_constructed = false ); + AutomatableModel( DataType type, + const float val = 0, + const float min = 0, + const float max = 0, + const float step = 0, + Model* parent = NULL, + const QString& display_name = QString(), + bool default_constructed = false ); virtual ~AutomatableModel(); - static inline float copiedValue() + static float copiedValue() { - return __copiedValue; + return s_copiedValue; } bool isAutomated() const; - inline ControllerConnection * getControllerConnection() const + inline ControllerConnection* controllerConnection() const { return m_controllerConnection; } - void setControllerConnection( ControllerConnection * _c ); + void setControllerConnection( ControllerConnection* c ); template - static inline T castValue( const float _v ) + static inline T castValue( const float v ) { - return (T)( _v ); + return (T)( v ); } template - static inline bool castValue( const float _v ) + static inline bool castValue( const float v ) { - return ( qRound( _v ) != 0 ); + return ( qRound( v ) != 0 ); } template - inline T value( int _frameOffset = 0 ) const + inline T value( int frameOffset = 0 ) const { - if( unlikely( m_hasLinkedModels || - m_controllerConnection != NULL ) ) + if( unlikely( m_hasLinkedModels || m_controllerConnection != NULL ) ) { - return castValue( controllerValue( _frameOffset ) ); + return castValue( controllerValue( frameOffset ) ); } return castValue( m_value ); } - float controllerValue( int _frameOffset ) const; + float controllerValue( int frameOffset ) const; template @@ -136,6 +135,11 @@ public: return castValue( m_initValue ); } + bool isAtInitValue() const + { + return m_value == m_initValue; + } + template inline T minValue() const { @@ -155,14 +159,14 @@ public: } - void setInitValue( const float _value ); + void setInitValue( const float value ); - void setAutomatedValue( const float _value ); - void setValue( const float _value ); + void setAutomatedValue( const float value ); + void setValue( const float value ); - inline void incValue( int _steps ) + inline void incValue( int steps ) { - setValue( m_value + _steps * m_step ); + setValue( m_value + steps * m_step ); } inline float range() const @@ -170,24 +174,19 @@ public: return m_range; } - void setRange( const float _min, const float _max, - const float _step = 1 ); + void setRange( const float min, const float max, const float step = 1 ); - void setStep( const float _step ); + void setStep( const float step ); - static void linkModels( AutomatableModel * _m1, - AutomatableModel * _m2 ); - static void unlinkModels( AutomatableModel * _m1, - AutomatableModel * _m2 ); + static void linkModels( AutomatableModel* m1, AutomatableModel* m2 ); + static void unlinkModels( AutomatableModel* m1, AutomatableModel* m2 ); void unlinkAllModels(); - virtual void saveSettings( QDomDocument & _doc, - QDomElement & _this, - const QString & _name = QString( "value" ) ); + virtual void saveSettings( QDomDocument& doc, QDomElement& element, + const QString& name = QString( "value" ) ); - virtual void loadSettings( const QDomElement & _this, - const QString & _name = QString( "value" ) ); + virtual void loadSettings( const QDomElement& element, const QString& name = QString( "value" ) ); virtual QString nodeName() const { @@ -199,13 +198,13 @@ public: void addJournalEntryFromOldToCurVal(); - QString displayValue( const float _val ) const + QString displayValue( const float val ) const { switch( m_dataType ) { - case Float: return QString::number( castValue( _val ) ); - case Integer: return QString::number( castValue( _val ) ); - case Bool: return QString::number( castValue( _val ) ); + case Float: return QString::number( castValue( val ) ); + case Integer: return QString::number( castValue( val ) ); + case Bool: return QString::number( castValue( val ) ); } return "0"; } @@ -224,15 +223,15 @@ public slots: protected: - virtual void redoStep( JournalEntry & _je ); - virtual void undoStep( JournalEntry & _je ); + virtual void redoStep( JournalEntry& je ); + virtual void undoStep( JournalEntry& je ); - float fittedValue( float _value ) const; + float fittedValue( float value ) const; private: - void linkModel( AutomatableModel * _model ); - void unlinkModel( AutomatableModel * _model ); + void linkModel( AutomatableModel* model ); + void unlinkModel( AutomatableModel* model ); DataType m_dataType; @@ -253,15 +252,15 @@ private: bool m_hasLinkedModels; - ControllerConnection * m_controllerConnection; + ControllerConnection* m_controllerConnection; - static float __copiedValue; + static float s_copiedValue; signals: - void initValueChanged( float _val ); - void destroyed( jo_id_t _id ); + void initValueChanged( float val ); + void destroyed( jo_id_t id ); } ; @@ -270,9 +269,9 @@ signals: #define defaultTypedMethods(type) \ - inline type value( int _frameOffset = 0 ) const \ + inline type value( int frameOffset = 0 ) const \ { \ - return AutomatableModel::value( _frameOffset ); \ + return AutomatableModel::value( frameOffset ); \ } \ \ inline type initValue() const \ @@ -296,12 +295,11 @@ signals: class FloatModel : public AutomatableModel { public: - FloatModel( float _val = 0, float _min = 0, float _max = 0, - float _step = 0, ::Model * _parent = NULL, - const QString & _display_name = QString(), - bool _default_constructed = false ) : - AutomatableModel( Float, _val, _min, _max, _step, - _parent, _display_name, _default_constructed ) + FloatModel( float val = 0, float min = 0, float max = 0, float step = 0, + Model * parent = NULL, + const QString& displayName = QString(), + bool defaultConstructed = false ) : + AutomatableModel( Float, val, min, max, step, parent, displayName, defaultConstructed ) { } @@ -313,12 +311,11 @@ public: class IntModel : public AutomatableModel { public: - IntModel( int _val = 0, int _min = 0, int _max = 0, - ::Model * _parent = NULL, - const QString & _display_name = QString(), - bool _default_constructed = false ) : - AutomatableModel( Integer, _val, _min, _max, 1, - _parent, _display_name, _default_constructed ) + IntModel( int val = 0, int min = 0, int max = 0, + Model* parent = NULL, + const QString& displayName = QString(), + bool defaultConstructed = false ) : + AutomatableModel( Integer, val, min, max, 1, parent, displayName, defaultConstructed ) { } @@ -330,11 +327,11 @@ public: class BoolModel : public AutomatableModel { public: - BoolModel( const bool _val = false, ::Model * _parent = NULL, - const QString & _display_name = QString(), - bool _default_constructed = false ) : - AutomatableModel( Bool, _val, false, true, 1, - _parent, _display_name, _default_constructed ) + BoolModel( const bool val = false, + Model* parent = NULL, + const QString& displayName = QString(), + bool defaultConstructed = false ) : + AutomatableModel( Bool, val, false, true, 1, parent, displayName, defaultConstructed ) { } diff --git a/include/AutomationTrack.h b/include/AutomationTrack.h index bf8cb5697..834174ece 100644 --- a/include/AutomationTrack.h +++ b/include/AutomationTrack.h @@ -37,8 +37,7 @@ public: virtual ~AutomationTrack(); virtual bool play( const midiTime & _start, const fpp_t _frames, - const f_cnt_t _frame_base, - Sint16 _tco_num = -1 ); + const f_cnt_t _frame_base, int _tco_num = -1 ); virtual QString nodeName() const { diff --git a/include/ControllerRackView.h b/include/ControllerRackView.h index 43d047177..f7a3282be 100644 --- a/include/ControllerRackView.h +++ b/include/ControllerRackView.h @@ -69,7 +69,7 @@ private: QScrollArea * m_scrollArea; QPushButton * m_addButton; - Uint32 m_lastY; + int m_lastY; } ; diff --git a/include/Effect.h b/include/Effect.h index 34d2283bf..c2b070aab 100644 --- a/include/Effect.h +++ b/include/Effect.h @@ -2,7 +2,7 @@ * Effect.h - base class for effects * * Copyright (c) 2006-2007 Danny McRae - * Copyright (c) 2006-2009 Tobias Doerffel + * Copyright (c) 2006-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -101,11 +101,8 @@ public: inline f_cnt_t timeout() const { - const float samples = - engine::mixer()->processingSampleRate() * - m_autoQuitModel.value() / 1000.0f; - return 1 + ( static_cast( samples ) / - engine::mixer()->framesPerPeriod() ); + const float samples = engine::mixer()->processingSampleRate() * m_autoQuitModel.value() / 1000.0f; + return 1 + ( static_cast( samples ) / engine::mixer()->framesPerPeriod() ); } inline float wetLevel() const diff --git a/include/EffectRackView.h b/include/EffectRackView.h index b760f2ffe..11b57fdaa 100644 --- a/include/EffectRackView.h +++ b/include/EffectRackView.h @@ -2,7 +2,7 @@ * effect_rack_view.h - view for effectChain-model * * Copyright (c) 2006-2007 Danny McRae - * Copyright (c) 2008 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -43,15 +43,15 @@ class EffectRackView : public QWidget, public ModelView { Q_OBJECT public: - EffectRackView( EffectChain * _model, QWidget * _parent = NULL ); + EffectRackView( EffectChain* model, QWidget* parent = NULL ); virtual ~EffectRackView(); public slots: void clearViews(); - void moveUp( EffectView * _view ); - void moveDown( EffectView * _view ); - void deletePlugin( EffectView * _view ); + void moveUp( EffectView* view ); + void moveDown( EffectView* view ); + void deletePlugin( EffectView* view ); private slots: @@ -62,12 +62,12 @@ private slots: private: virtual void modelChanged(); - inline EffectChain * fxChain() + inline EffectChain* fxChain() { return castModel(); } - inline const EffectChain * fxChain() const + inline const EffectChain* fxChain() const { return castModel(); } @@ -75,11 +75,10 @@ private: QVector m_effectViews; - QVBoxLayout * m_mainLayout; - groupBox * m_effectsGroupBox; - QScrollArea * m_scrollArea; + groupBox* m_effectsGroupBox; + QScrollArea* m_scrollArea; - Uint32 m_lastY; + int m_lastY; } ; diff --git a/include/InlineAutomation.h b/include/InlineAutomation.h index 70cefbec9..22d2aa367 100644 --- a/include/InlineAutomation.h +++ b/include/InlineAutomation.h @@ -49,10 +49,24 @@ public: virtual float defaultValue() const = 0; - inline bool hasAutomation() const + bool hasAutomation() const { - return m_autoPattern != NULL && - m_autoPattern->getTimeMap().isEmpty() == false; + if( m_autoPattern != NULL && m_autoPattern->getTimeMap().isEmpty() == false ) + { + // prevent saving inline automation if there's just one value which equals value + // of model which is going to be saved anyways + if( isAtInitValue() && + m_autoPattern->getTimeMap().size() == 1 && + m_autoPattern->getTimeMap().keys().first() == 0 && + m_autoPattern->getTimeMap().values().first() == value() ) + { + return false; + } + + return true; + } + + return false; } AutomationPattern * automationPattern() diff --git a/include/InstrumentFunctions.h b/include/InstrumentFunctions.h index 8520acab5..b26460494 100644 --- a/include/InstrumentFunctions.h +++ b/include/InstrumentFunctions.h @@ -1,7 +1,7 @@ /* * InstrumentFunctions.h - models for instrument-functions-tab * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -45,7 +45,7 @@ public: static const int MAX_CHORD_POLYPHONY = 10; private: - typedef Sint8 ChordSemiTones [MAX_CHORD_POLYPHONY]; + typedef int8_t ChordSemiTones [MAX_CHORD_POLYPHONY]; public: ChordCreator( Model * _parent ); @@ -90,9 +90,9 @@ public: return size() == 0; } - bool hasSemiTone( Sint8 semi_tone ) const; + bool hasSemiTone( int8_t semiTone ) const; - Sint8 last() const + int8_t last() const { return m_semiTones[size() - 1]; } @@ -102,7 +102,7 @@ public: return m_name; } - Sint8 operator [] ( int n ) const + int8_t operator [] ( int n ) const { return m_semiTones[n]; } diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index af1c79288..7df268b82 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -26,8 +26,6 @@ #ifndef _INSTRUMENT_TRACK_H #define _INSTRUMENT_TRACK_H -#include - #include "AudioPort.h" #include "InstrumentFunctions.h" #include "InstrumentSoundShaping.h" @@ -120,8 +118,7 @@ public: // play everything in given frame-range - creates note-play-handles virtual bool play( const midiTime & _start, const fpp_t _frames, - const f_cnt_t _frame_base, - Sint16 _tco_num = -1 ); + const f_cnt_t _frame_base, int _tco_num = -1 ); // create new view for me virtual trackView * createView( TrackContainerView* tcv ); @@ -188,6 +185,11 @@ public: return &m_panningModel; } + IntModel* pitchRangeModel() + { + return &m_pitchRangeModel; + } + IntModel * effectChannelModel() { return &m_effectChannelModel; @@ -212,6 +214,7 @@ protected: protected slots: void updateBaseNote(); void updatePitch(); + void updatePitchRange(); private: @@ -229,6 +232,7 @@ private: FloatModel m_volumeModel; FloatModel m_panningModel; FloatModel m_pitchModel; + IntModel m_pitchRangeModel; IntModel m_effectChannelModel; @@ -386,13 +390,12 @@ private: InstrumentTrackView * m_itv; // widgets on the top of an instrument-track-window - tabWidget * m_generalSettingsWidget; QLineEdit * m_nameLineEdit; knob * m_volumeKnob; knob * m_panningKnob; knob * m_pitchKnob; + lcdSpinBox* m_pitchRangeSpinBox; lcdSpinBox * m_effectChannelNumber; - QPushButton * m_saveSettingsBtn; // tab-widget with all children diff --git a/include/LadspaBase.h b/include/LadspaBase.h index dc1a1a775..4b77083a7 100644 --- a/include/LadspaBase.h +++ b/include/LadspaBase.h @@ -2,7 +2,7 @@ * LadspaBase.h - basic declarations concerning LADSPA * * Copyright (c) 2006-2007 Danny McRae - * Copyright (c) 2006-2009 Tobias Doerffel + * Copyright (c) 2006-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -55,8 +55,8 @@ typedef struct PortDescription { QString name; ch_cnt_t proc; - Uint16 port_id; - Uint16 control_id; + uint16_t port_id; + uint16_t control_id; buffer_rate_t rate; buffer_data_t data_type; float scale; diff --git a/include/LadspaControl.h b/include/LadspaControl.h index bf8ccb1ff..1b0eae471 100644 --- a/include/LadspaControl.h +++ b/include/LadspaControl.h @@ -1,7 +1,7 @@ /* * LadspaControl.h - model for controlling a LADSPA port * - * Copyright (c) 2008 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * Copyright (c) 2006-2008 Danny McRae * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net @@ -72,8 +72,7 @@ public: virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent, const QString & _name ); - virtual void loadSettings( const QDomElement & _this, - const QString & _name ); + virtual void loadSettings( const QDomElement & _this, const QString & _name ); inline virtual QString nodeName() const { return "port"; @@ -81,8 +80,8 @@ public: signals: - void changed( Uint16 _port, LADSPA_Data _value ); - void linkChanged( Uint16 _port, bool _state ); + void changed( int _port, LADSPA_Data _value ); + void linkChanged( int _port, bool _state ); protected slots: diff --git a/include/MidiAlsaRaw.h b/include/MidiAlsaRaw.h index ea439eeeb..9c994356f 100644 --- a/include/MidiAlsaRaw.h +++ b/include/MidiAlsaRaw.h @@ -1,7 +1,7 @@ /* - * MidiAlsaRaw.h - midi-client for RawMIDI via ALSA + * MidiAlsaRaw.h - MIDI client for RawMIDI via ALSA * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -71,7 +71,7 @@ public: protected: - virtual void sendByte( const Uint8 _c ); + virtual void sendByte( const unsigned char c ); virtual void run(); diff --git a/include/MidiClient.h b/include/MidiClient.h index e92142b97..143a32775 100644 --- a/include/MidiClient.h +++ b/include/MidiClient.h @@ -1,7 +1,7 @@ /* * MidiClient.h - base-class for MIDI clients like ALSA-sequencer-client * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -140,7 +140,7 @@ protected: -const Uint8 RAW_MIDI_PARSE_BUF_SIZE = 16; +const int RAW_MIDI_PARSE_BUF_SIZE = 16; class MidiClientRaw : public MidiClient @@ -158,37 +158,35 @@ public: protected: // generic raw-MIDI-parser which generates appropriate MIDI-events - void parseData( const Uint8 _c ); + void parseData( const unsigned char c ); // to be implemented by actual client-implementation - virtual void sendByte( const Uint8 _c ) = 0; + virtual void sendByte( const unsigned char c ) = 0; private: // this does MIDI-event-process void processParsedEvent(); - virtual void processOutEvent( const midiEvent & _me, - const midiTime & _time, - const MidiPort * _port ); + virtual void processOutEvent( const midiEvent& event, const midiTime& time, const MidiPort* port ); // small helper function returning length of a certain event - this // is necessary for parsing raw-MIDI-data - static Uint8 eventLength( const Uint8 _event ); + static int eventLength( const unsigned char event ); // data being used for parsing struct midiParserData { - Uint8 m_status; // identifies the type of event, that + uint8_t m_status; // identifies the type of event, that // is currently received ('Noteon', // 'Pitch Bend' etc). - Uint8 m_channel; // The channel of the event that is + uint8_t m_channel; // The channel of the event that is // received (in case of a channel event) - Uint32 m_bytes; // How many bytes have been read for + uint32_t m_bytes; // How many bytes have been read for // the current event? - Uint32 m_bytesTotal; // How many bytes does the current + uint32_t m_bytesTotal; // How many bytes does the current // event type include? - Uint32 m_buffer[RAW_MIDI_PARSE_BUF_SIZE]; + uint32_t m_buffer[RAW_MIDI_PARSE_BUF_SIZE]; // buffer for incoming data midiEvent m_midiEvent; // midi-event } m_midiParseData; diff --git a/include/MidiDummy.h b/include/MidiDummy.h index 709789580..cba725fbb 100644 --- a/include/MidiDummy.h +++ b/include/MidiDummy.h @@ -71,7 +71,7 @@ public: protected: - virtual void sendByte( const Uint8 ) + virtual void sendByte( const unsigned char ) { } diff --git a/include/MidiOss.h b/include/MidiOss.h index 20f218288..07900961b 100644 --- a/include/MidiOss.h +++ b/include/MidiOss.h @@ -1,7 +1,7 @@ /* * MidiOss.h - OSS raw MIDI client * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -69,7 +69,7 @@ public: protected: - virtual void sendByte( const Uint8 _c ); + virtual void sendByte( const unsigned char c ); virtual void run(); diff --git a/include/SampleTrack.h b/include/SampleTrack.h index 7733d4dce..975ba2477 100644 --- a/include/SampleTrack.h +++ b/include/SampleTrack.h @@ -122,8 +122,7 @@ public: virtual ~SampleTrack(); virtual bool play( const midiTime & _start, const fpp_t _frames, - const f_cnt_t _frame_base, - Sint16 _tco_num = -1 ); + const f_cnt_t _frame_base, int _tco_num = -1 ); virtual trackView * createView( TrackContainerView* tcv ); virtual trackContentObject * createTCO( const midiTime & _pos ); diff --git a/include/bb_editor.h b/include/bb_editor.h index 200896718..a4bce6253 100644 --- a/include/bb_editor.h +++ b/include/bb_editor.h @@ -56,6 +56,8 @@ public slots: void stop(); void updatePosition(); void addAutomationTrack(); + void addSteps(); + void removeSteps(); private: virtual void keyPressEvent( QKeyEvent * _ke ); diff --git a/include/bb_track.h b/include/bb_track.h index 020a59df9..8b0dbff99 100644 --- a/include/bb_track.h +++ b/include/bb_track.h @@ -109,10 +109,8 @@ public: bbTrack( TrackContainer* tc ); virtual ~bbTrack(); - virtual bool play( const midiTime & _start, - const fpp_t _frames, - const f_cnt_t _frame_base, - Sint16 _tco_num = -1 ); + virtual bool play( const midiTime & _start, const fpp_t _frames, + const f_cnt_t _frame_base, int _tco_num = -1 ); virtual trackView * createView( TrackContainerView* tcv ); virtual trackContentObject * createTCO( const midiTime & _pos ); diff --git a/include/bb_track_container.h b/include/bb_track_container.h index 84d06f1fd..bc9bf7064 100644 --- a/include/bb_track_container.h +++ b/include/bb_track_container.h @@ -39,8 +39,7 @@ public: virtual ~bbTrackContainer(); virtual bool play( midiTime _start, const fpp_t _frames, - const f_cnt_t _frame_base, - Sint16 _tco_num = -1 ); + const f_cnt_t _frame_base, int _tco_num = -1 ); virtual void updateAfterTrackAdd(); diff --git a/include/cpuload_widget.h b/include/cpuload_widget.h index 7a2d27696..096307c76 100644 --- a/include/cpuload_widget.h +++ b/include/cpuload_widget.h @@ -2,7 +2,7 @@ * cpuload_widget.h - widget for displaying CPU-load (partly based on * Hydrogen's CPU-load-widget) * - * Copyright (c) 2005-2007 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -51,7 +51,7 @@ protected slots: private: - Uint8 m_currentLoad; + int m_currentLoad; QPixmap m_temp; QPixmap m_background; diff --git a/include/endian_handling.h b/include/endian_handling.h index 52be0ae31..01814266f 100644 --- a/include/endian_handling.h +++ b/include/endian_handling.h @@ -1,8 +1,8 @@ /* * endian_handling.h - handle endianess * - * Copyright (c) 2005-2008 Tobias Doerffel - * + * Copyright (c) 2005-2014 Tobias Doerffel + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -22,7 +22,6 @@ * */ - #ifndef _ENDIAN_HANDLING_H #define _ENDIAN_HANDLING_H @@ -37,18 +36,18 @@ inline bool isLittleEndian() } -inline Sint16 swap16IfBE( Sint16 _i ) +inline int16_t swap16IfBE( int16_t i ) { - return( isLittleEndian() ? _i : ( ( _i & 0xFF ) << 8) | ( ( _i >> 8 ) & 0xFF ) ); + return( isLittleEndian() ? i : ( ( i & 0xFF ) << 8) | ( ( i >> 8 ) & 0xFF ) ); } -inline Sint32 swap32IfBE( Sint32 _i ) +inline int32_t swap32IfBE( int32_t i ) { - return( isLittleEndian() ? _i : ( ( _i & 0xff000000 ) >> 24 ) | - ( ( _i & 0x00ff0000 ) >> 8 ) | - ( ( _i & 0x0000ff00 ) << 8 ) | - ( ( _i & 0x000000ff ) << 24 ) ); + return( isLittleEndian() ? i : ( ( i & 0xff000000 ) >> 24 ) | + ( ( i & 0x00ff0000 ) >> 8 ) | + ( ( i & 0x0000ff00 ) << 8 ) | + ( ( i & 0x000000ff ) << 24 ) ); } #endif diff --git a/include/ladspa_manager.h b/include/ladspa_manager.h index eeaecc440..b534a2def 100644 --- a/include/ladspa_manager.h +++ b/include/ladspa_manager.h @@ -73,10 +73,10 @@ enum ladspaPluginType typedef struct ladspaManagerStorage { LADSPA_Descriptor_Function descriptorFunction; - Uint32 index; + uint32_t index; ladspaPluginType type; - Uint16 inputChannels; - Uint16 outputChannels; + uint16_t inputChannels; + uint16_t outputChannels; } ladspaManagerDescription; @@ -123,20 +123,20 @@ public: /* This indicates the number of ports (input AND output) present on the plugin. */ - Uint32 getPortCount( const ladspa_key_t & _plugin ); + uint32_t getPortCount( const ladspa_key_t & _plugin ); /* Indicates that the port is an input. */ - bool isPortInput( const ladspa_key_t & _plugin, Uint32 _port ); + bool isPortInput( const ladspa_key_t & _plugin, uint32_t _port ); /* Indicates that the port is an output. */ - bool isPortOutput( const ladspa_key_t & _plugin, Uint32 _port ); + bool isPortOutput( const ladspa_key_t & _plugin, uint32_t _port ); /* Indicates that the port is an audio. */ - bool isPortAudio( const ladspa_key_t & _plugin, Uint32 _port ); + bool isPortAudio( const ladspa_key_t & _plugin, uint32_t _port ); /* Indicates that the port is an control. */ - bool isPortControl( const ladspa_key_t & _plugin, Uint32 _port ); + bool isPortControl( const ladspa_key_t & _plugin, uint32_t _port ); /* Indicates that any bounds specified should be interpreted as multiples of the sample rate. For instance, a frequency range from @@ -145,42 +145,42 @@ public: Hosts that support bounds at all must support this hint to retain meaning. */ bool areHintsSampleRateDependent( const ladspa_key_t & _plugin, - Uint32 _port ); + uint32_t _port ); /* Returns the lower boundary value for the given port. If no lower bound is provided by the plug-in, returns -999e-99. When areHintsSampleRateDependent() is also true then this value should be multiplied by the relevant sample rate. */ - float getLowerBound( const ladspa_key_t & _plugin, Uint32 _port ); + float getLowerBound( const ladspa_key_t & _plugin, uint32_t _port ); /* Returns the upper boundary value for the given port. If no upper bound is provided by the plug-in, returns -999e-99. When areHintsSampleRateDependent() is also true then this value should be multiplied by the relevant sample rate. */ - float getUpperBound( const ladspa_key_t & _plugin, Uint32 _port ); + float getUpperBound( const ladspa_key_t & _plugin, uint32_t _port ); /* Indicates whether the given port should be considered 0 or 1 boolean switch. */ - bool isPortToggled( const ladspa_key_t & _plugin, Uint32 _port ); + bool isPortToggled( const ladspa_key_t & _plugin, uint32_t _port ); /* Retrieves any default setting hints offered by the plug-in for the given port. */ - float getDefaultSetting( const ladspa_key_t & _plugin, Uint32 _port ); + float getDefaultSetting( const ladspa_key_t & _plugin, uint32_t _port ); /* Indicates that it is likely that the user will find it more intuitive to view values using a logarithmic scale. This is particularly useful for frequencies and gains. */ - bool isLogarithmic( const ladspa_key_t & _plugin, Uint32 _port ); + bool isLogarithmic( const ladspa_key_t & _plugin, uint32_t _port ); /* Indicates that a user interface would probably wish to provide a stepped control taking only integer values. Any bounds set should be slightly wider than the actual integer range required to avoid floating point rounding errors. For instance, the integer set {0,1,2,3} might be described as [-0.1, 3.1]. */ - bool isInteger( const ladspa_key_t & _plugin, Uint32 _port ); + bool isInteger( const ladspa_key_t & _plugin, uint32_t _port ); /* Returns the name of the port. */ - QString getPortName( const ladspa_key_t & _plugin, Uint32 _port ); + QString getPortName( const ladspa_key_t & _plugin, uint32_t _port ); /* This may be used by the plugin developer to pass any custom @@ -206,7 +206,7 @@ public: /* Returns a handle to an instantiation of the given plug-in. */ LADSPA_Handle instantiate( const ladspa_key_t & _plugin, - Uint32 _sample_rate ); + uint32_t _sample_rate ); /* This method calls a function pointer that connects a port on an instantiated plugin to a memory location at which a block of data @@ -227,7 +227,7 @@ public: run() or runAdding() is called. */ bool connectPort( const ladspa_key_t & _plugin, LADSPA_Handle _instance, - Uint32 _port, + uint32_t _port, LADSPA_Data * _data_location ); /* This method calls a function pointer that initialises a plugin @@ -264,7 +264,7 @@ public: activate() has been called again. */ bool run( const ladspa_key_t & _plugin, LADSPA_Handle _instance, - Uint32 _sample_count ); + uint32_t _sample_count ); /* This method calls a function pointer that runs an instance of a plugin for a block. This has identical behaviour to run() except @@ -281,7 +281,7 @@ public: the function setRunAddingGain() must be provided also. */ bool runAdding( const ladspa_key_t & _plugin, LADSPA_Handle _instance, - Uint32 _sample_count ); + uint32_t _sample_count ); /* This method calls a function pointer that sets the output gain for use when runAdding() is called (see above). If this function is @@ -325,8 +325,8 @@ public: private: void addPlugins( LADSPA_Descriptor_Function _descriptor_func, const QString & _file ); - Uint16 getPluginInputs( const LADSPA_Descriptor * _descriptor ); - Uint16 getPluginOutputs( const LADSPA_Descriptor * _descriptor ); + uint16_t getPluginInputs( const LADSPA_Descriptor * _descriptor ); + uint16_t getPluginOutputs( const LADSPA_Descriptor * _descriptor ); typedef QMap ladspaManagerMapType; diff --git a/include/lcd_spinbox.h b/include/lcd_spinbox.h index 43ce4a32d..757c301d8 100644 --- a/include/lcd_spinbox.h +++ b/include/lcd_spinbox.h @@ -46,6 +46,19 @@ public: update(); } + /*! Sets an offset which is always added to value of model so we can + display values in a user-friendly way if they internally start at 0 */ + void setDisplayOffset( int offset ) + { + m_displayOffset = offset; + } + + /*! \brief Returns internal offset for displaying values */ + int displayOffset() const + { + return m_displayOffset; + } + public slots: virtual void update(); @@ -60,6 +73,7 @@ protected: private: QPoint m_origMousePos; + int m_displayOffset; signals: diff --git a/include/lmms_basics.h b/include/lmms_basics.h index 37a1f487f..2805bb407 100644 --- a/include/lmms_basics.h +++ b/include/lmms_basics.h @@ -34,35 +34,26 @@ #include #endif -typedef unsigned char Uint8; -typedef signed char Sint8; -typedef unsigned short Uint16; -typedef signed short Sint16; -typedef unsigned int Uint32; -typedef signed int Sint32; - -typedef Uint32 minute_t; -typedef Sint8 second_t; -typedef Sint32 tact_t; -typedef Sint32 tick_t; -typedef Uint8 volume_t; -typedef Sint8 panning_t; +typedef int32_t tact_t; +typedef int32_t tick_t; +typedef uint8_t volume_t; +typedef int8_t panning_t; typedef float sample_t; // standard sample-type -typedef Sint16 int_sample_t; // 16-bit-int-sample +typedef int16_t int_sample_t; // 16-bit-int-sample -typedef Uint32 sample_rate_t; // sample-rate -typedef Sint16 fpp_t; // frames per period (0-16384) -typedef Sint32 f_cnt_t; // standard frame-count -typedef Uint8 ch_cnt_t; // channel-count (0-SURROUND_CHANNELS) -typedef Uint16 bpm_t; // tempo (MIN_BPM to MAX_BPM) -typedef Uint16 bitrate_t; // bitrate in kbps -typedef Sint8 fx_ch_t; // FX-channel (0 to MAX_EFFECT_CHANNEL) +typedef uint32_t sample_rate_t; // sample-rate +typedef int16_t fpp_t; // frames per period (0-16384) +typedef int32_t f_cnt_t; // standard frame-count +typedef uint8_t ch_cnt_t; // channel-count (0-SURROUND_CHANNELS) +typedef uint16_t bpm_t; // tempo (MIN_BPM to MAX_BPM) +typedef uint16_t bitrate_t; // bitrate in kbps +typedef uint16_t fx_ch_t; // FX-channel (0 to MAX_EFFECT_CHANNEL) -typedef Uint32 jo_id_t; // (unique) ID of a journalling object +typedef uint32_t jo_id_t; // (unique) ID of a journalling object // use for improved branch prediction #define likely(x) __builtin_expect((x),1) diff --git a/include/midi.h b/include/midi.h index 4452d8762..09a9afa1b 100644 --- a/include/midi.h +++ b/include/midi.h @@ -124,9 +124,9 @@ const int MidiMinPanning = -128; struct midiEvent { midiEvent( MidiEventTypes _type = MidiActiveSensing, - Sint8 _channel = 0, - Sint16 _param1 = 0, - Sint16 _param2 = 0, + int8_t _channel = 0, + int16_t _param1 = 0, + int16_t _param2 = 0, const void * _sourcePort = NULL ) : m_type( _type ), m_metaEvent( MidiMetaInvalid ), @@ -172,12 +172,12 @@ struct midiEvent return m_channel; } - inline Sint16 key() const + inline int16_t key() const { return m_data.m_param[0]; } - inline Sint16 & key() + inline int16_t & key() { return m_data.m_param[0]; } @@ -192,17 +192,17 @@ struct midiEvent return m_data.m_param[1]; } - inline Sint16 velocity() const + inline int16_t velocity() const { return m_data.m_param[1]; } - inline Sint16 & velocity() + inline int16_t & velocity() { return m_data.m_param[1]; } - inline Sint16 midiPanning() const + inline int16_t midiPanning() const { return m_data.m_param[1]; } @@ -237,12 +237,12 @@ struct midiEvent MidiEventTypes m_type; // MIDI event type MidiMetaEvents m_metaEvent; // Meta event (mostly unused) - Sint8 m_channel; // MIDI channel + int8_t m_channel; // MIDI channel union { - Sint16 m_param[2]; // first/second parameter (key/velocity) - Uint8 m_bytes[4]; // raw bytes - Sint32 m_sysExDataLen; // len of m_sysExData + int16_t m_param[2]; // first/second parameter (key/velocity) + uint8_t m_bytes[4]; // raw bytes + int32_t m_sysExDataLen; // len of m_sysExData } m_data; const char * m_sysExData; diff --git a/include/mmp.h b/include/mmp.h index 403f90f5e..d76a8f589 100644 --- a/include/mmp.h +++ b/include/mmp.h @@ -1,7 +1,7 @@ /* * mmp.h - class for reading and writing multimedia-project-files * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * Copyright (c) 2012-2013 Paul Giblock

* * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net @@ -104,10 +104,9 @@ private: } ; -const Uint8 MMP_MAJOR_VERSION = 1; -const Uint8 MMP_MINOR_VERSION = 0; -const QString MMP_VERSION_STRING = QString::number( MMP_MAJOR_VERSION ) + "." + - QString::number( MMP_MINOR_VERSION ); +const int MMP_MAJOR_VERSION = 1; +const int MMP_MINOR_VERSION = 0; +const QString MMP_VERSION_STRING = QString::number( MMP_MAJOR_VERSION ) + "." + QString::number( MMP_MINOR_VERSION ); #endif diff --git a/include/note_play_handle.h b/include/note_play_handle.h index 84ec7c20f..2c2b2e3f1 100644 --- a/include/note_play_handle.h +++ b/include/note_play_handle.h @@ -233,7 +233,6 @@ private: private: - DetuningHelper * m_detuning; float m_value; } ; diff --git a/include/pattern.h b/include/pattern.h index 2c937eaca..26b51849e 100644 --- a/include/pattern.h +++ b/include/pattern.h @@ -125,9 +125,6 @@ public: bool empty(); - void addSteps( int _n ); - void removeSteps( int _n ); - virtual trackContentObjectView * createView( trackView * _tv ); @@ -140,6 +137,8 @@ protected: protected slots: + void addSteps(); + void removeSteps(); void clear(); void freeze(); void unfreeze(); @@ -164,6 +163,7 @@ private: friend class patternView; friend class patternFreezeThread; + friend class bbEditor; } ; @@ -187,9 +187,6 @@ protected slots: void resetName(); void changeName(); - void addSteps( QAction * _item ); - void removeSteps( QAction * _item ); - protected: virtual void constructContextMenu( QMenu * ); diff --git a/include/piano_roll.h b/include/piano_roll.h index fa1e8466f..55e193b99 100644 --- a/include/piano_roll.h +++ b/include/piano_roll.h @@ -284,7 +284,7 @@ private: actions m_action; noteEditMode m_noteEditMode; - Uint32 m_selectStartTick; + int m_selectStartTick; int m_selectedTick; int m_selectStartKey; int m_selectedKeys; diff --git a/include/track.h b/include/track.h index e89e385ac..cbb5faaeb 100644 --- a/include/track.h +++ b/include/track.h @@ -2,7 +2,7 @@ * track.h - declaration of classes concerning tracks -> necessary for all * track-like objects (beat/bassline, sample-track...) * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -64,8 +64,8 @@ const int TRACK_OP_WIDTH_COMPACT = 60; * Tracks can be resized by shift-dragging anywhere inside the track * display. This sets the minimum size in pixels for a track. */ -const Uint16 MINIMAL_TRACK_HEIGHT = 8; -const Uint16 DEFAULT_TRACK_HEIGHT = 32; +const int MINIMAL_TRACK_HEIGHT = 8; +const int DEFAULT_TRACK_HEIGHT = 32; const int TCO_BORDER_WIDTH = 1; @@ -74,6 +74,7 @@ class trackContentObject : public Model, public JournallingObject { Q_OBJECT mapPropertyFromModel(bool,isMuted,setMuted,m_mutedModel); + mapPropertyFromModel(bool,isSolo,setSolo,m_soloModel); public: trackContentObject( track * _track ); virtual ~trackContentObject(); @@ -154,6 +155,7 @@ private: midiTime m_length; BoolModel m_mutedModel; + BoolModel m_soloModel; friend class trackContentObjectView; @@ -224,7 +226,7 @@ private: trackView * m_trackView; Actions m_action; bool m_autoResize; - Sint16 m_initialMouseX; + int m_initialMouseX; textFloat * m_hint; @@ -349,6 +351,7 @@ class EXPORT track : public Model, public JournallingObject { Q_OBJECT mapPropertyFromModel(bool,isMuted,setMuted,m_mutedModel); + mapPropertyFromModel(bool,isSolo,setSolo,m_soloModel); public: typedef QVector tcoVector; @@ -380,8 +383,7 @@ public: } virtual bool play( const midiTime & _start, const fpp_t _frames, - const f_cnt_t _frame_base, - Sint16 _tco_num = -1 ) = 0; + const f_cnt_t _frame_base, int _tco_num = -1 ) = 0; virtual trackView * createView( TrackContainerView * _view ) = 0; diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 41ad894f4..337d6e601 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -186,21 +186,18 @@ void audioFileProcessor::loadFile( const QString & _file ) QString audioFileProcessor::nodeName( void ) const { - return( audiofileprocessor_plugin_descriptor.name ); + return audiofileprocessor_plugin_descriptor.name; } -Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const +int audioFileProcessor::getBeatLen( notePlayHandle * _n ) const { const float freq_factor = BaseFreq / _n->frequency() * - engine::mixer()->processingSampleRate() / - engine::mixer()->baseSampleRate(); + engine::mixer()->processingSampleRate() / engine::mixer()->baseSampleRate(); - return( static_cast( floorf( ( m_sampleBuffer.endFrame() - - m_sampleBuffer.startFrame() ) * - freq_factor ) ) ); + return static_cast( floorf( ( m_sampleBuffer.endFrame() - m_sampleBuffer.startFrame() ) * freq_factor ) ); } @@ -208,7 +205,7 @@ Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const PluginView * audioFileProcessor::instantiateView( QWidget * _parent ) { - return( new AudioFileProcessorView( this, _parent ) ); + return new AudioFileProcessorView( this, _parent ); } diff --git a/plugins/audio_file_processor/audio_file_processor.h b/plugins/audio_file_processor/audio_file_processor.h index 2372f970a..fb8c5feec 100644 --- a/plugins/audio_file_processor/audio_file_processor.h +++ b/plugins/audio_file_processor/audio_file_processor.h @@ -56,11 +56,11 @@ public: virtual QString nodeName() const; - virtual Uint32 getBeatLen( notePlayHandle * _n ) const; + virtual int getBeatLen( notePlayHandle * _n ) const; virtual f_cnt_t desiredReleaseFrames() const { - return( 128 ); + return 128; } virtual PluginView * instantiateView( QWidget * _parent ); diff --git a/plugins/bass_booster/artwork.png b/plugins/bass_booster/artwork.png index e1d3407f4..23e2be7b3 100644 Binary files a/plugins/bass_booster/artwork.png and b/plugins/bass_booster/artwork.png differ diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index cef694f02..df588eeb4 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -287,7 +287,7 @@ void bitInvader::playNote( notePlayHandle * _n, for( fpp_t frame = 0; frame < frames; ++frame ) { const sample_t cur = ps->nextStringSample(); - for( Uint8 chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl ) + for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl ) { _working_buffer[frame][chnl] = cur; } diff --git a/plugins/flp_import/FlpImport.cpp b/plugins/flp_import/FlpImport.cpp index 2c8ccf851..ec53d7cff 100644 --- a/plugins/flp_import/FlpImport.cpp +++ b/plugins/flp_import/FlpImport.cpp @@ -721,7 +721,7 @@ bool FlpImport::tryImport( TrackContainer* tc ) // search for FLdt chunk while( 1 ) { - Sint32 id = readID(); + int32_t id = readID(); const int len = read32LE(); if( file().atEnd() ) { @@ -769,7 +769,7 @@ bool FlpImport::tryImport( TrackContainer* tc ) while( file().atEnd() == false ) { FLP_Events ev = static_cast( readByte() ); - Uint32 data = readByte(); + uint32_t data = readByte(); if( ev >= FLP_Word && ev < FLP_Text ) { @@ -786,7 +786,7 @@ bool FlpImport::tryImport( TrackContainer* tc ) if( ev >= FLP_Text ) { text_len = data & 0x7F; - Uint8 shift = 0; + uint8_t shift = 0; while( data & 0x80 ) { data = readByte(); @@ -1814,7 +1814,7 @@ void FlpImport::processPluginParams( FL_Channel * _ch ) int ws = Oscillator::UserDefinedWave; for( int i = 0; i < 3; ++i ) { - const Sint32 * d = (const Sint32 *) + const int32_t * d = (const int32_t *) ( _ch->pluginSettings + i * 28 ); QString is = QString::number( i ); de.setAttribute( "vol" + is, diff --git a/plugins/flp_import/FlpImport.h b/plugins/flp_import/FlpImport.h index df4be18d4..b965810ed 100644 --- a/plugins/flp_import/FlpImport.h +++ b/plugins/flp_import/FlpImport.h @@ -69,7 +69,7 @@ private: return( value ); } - inline Sint32 read32LE() + inline int32_t read32LE() { int value = readByte(); value |= readByte() << 8; @@ -77,14 +77,14 @@ private: value |= readByte() << 24; return( value ); } - inline Sint32 read16LE() + inline int32_t read16LE() { int value = readByte(); value |= readByte() << 8; return( value ); } - inline Sint32 readID() + inline int32_t readID() { return( read32LE() ); } diff --git a/plugins/ladspa_browser/ladspa_port_dialog.cpp b/plugins/ladspa_browser/ladspa_port_dialog.cpp index 71e3f1f80..3a3370df3 100644 --- a/plugins/ladspa_browser/ladspa_port_dialog.cpp +++ b/plugins/ladspa_browser/ladspa_port_dialog.cpp @@ -46,7 +46,7 @@ ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key ) vlayout->setSpacing( 0 ); vlayout->setMargin( 0 ); - Uint16 pc = manager->getPortCount( _key ); + int pc = manager->getPortCount( _key ); QTableWidget * settings = new QTableWidget( pc, 7, this ); @@ -60,31 +60,23 @@ ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key ) ports.append( tr( "SR Dependent" ) ); settings->setHorizontalHeaderLabels( ports ); - for( Uint16 row = 0; row < pc; row++ ) + for( int row = 0; row < pc; row++ ) { - for( Uint8 col = 0; col < 7; ++col ) + for( int col = 0; col < 7; ++col ) { QTableWidgetItem * item = new QTableWidgetItem; item->setFlags( 0 ); settings->setItem( row, col, item ); } - Uint8 col = 0; - settings->item( row, col++ )->setText( manager->getPortName( - _key, row ) ); + int col = 0; + settings->item( row, col++ )->setText( manager->getPortName( _key, row ) ); - settings->item( row, col++ )->setText( - manager->isPortAudio( _key, row ) ? - tr( "Audio" ) : tr( "Control" ) ); + settings->item( row, col++ )->setText( manager->isPortAudio( _key, row ) ? tr( "Audio" ) : tr( "Control" ) ); - settings->item( row, col++ )->setText( - manager->isPortInput( _key, row ) ? - tr( "Input" ) : tr( "Output" ) ); + settings->item( row, col++ )->setText( manager->isPortInput( _key, row ) ? tr( "Input" ) : tr( "Output" ) ); - settings->item( row, col++ )->setText( - manager->isPortToggled( _key, row ) ? tr( "Toggled" ) : - manager->isInteger( _key, row ) ? tr( "Integer" ) : - tr( "Float" ) ); + settings->item( row, col++ )->setText( manager->isPortToggled( _key, row ) ? tr( "Toggled" ) : manager->isInteger( _key, row ) ? tr( "Integer" ) : tr( "Float" ) ); float min = manager->getLowerBound( _key, row ); float max = manager->getUpperBound( _key, row ); diff --git a/plugins/ladspa_effect/LadspaControls.cpp b/plugins/ladspa_effect/LadspaControls.cpp index 1dd572188..f7b16d5f2 100644 --- a/plugins/ladspa_effect/LadspaControls.cpp +++ b/plugins/ladspa_effect/LadspaControls.cpp @@ -1,7 +1,7 @@ /* * LadspaControls.cpp - model for LADSPA plugin controls * - * Copyright (c) 2008-2010 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -46,26 +46,20 @@ LadspaControls::LadspaControls( LadspaEffect * _eff ) : control_list_t p; const bool linked_control = ( m_processors > 1 && proc == 0 ); - buffer_data_t last_port = NONE; - for( multi_proc_t::Iterator it = controls.begin(); - it != controls.end(); it++ ) + for( multi_proc_t::Iterator it = controls.begin(); it != controls.end(); it++ ) { if( (*it)->proc == proc ) { (*it)->control = new LadspaControl( this, *it, linked_control ); - last_port = (*it)->data_type; - p.append( (*it)->control ); if( linked_control ) { - connect( (*it)->control, - SIGNAL( linkChanged( Uint16, bool ) ), - this, - SLOT( linkPort( Uint16, bool ) ) ); + connect( (*it)->control, SIGNAL( linkChanged( int, bool ) ), + this, SLOT( linkPort( int, bool ) ) ); } } } @@ -143,7 +137,7 @@ void LadspaControls::loadSettings( const QDomElement & _this ) -void LadspaControls::linkPort( Uint16 _port, bool _state ) +void LadspaControls::linkPort( int _port, bool _state ) { LadspaControl * first = m_controls[0][_port]; if( _state ) @@ -170,18 +164,14 @@ void LadspaControls::updateLinkStatesFromGlobal() { if( m_stereoLinkModel.value() ) { - for( Uint16 port = 0; - port < m_controlCount / m_processors; - port++ ) + for( int port = 0; port < m_controlCount / m_processors; port++ ) { m_controls[0][port]->setLink( true ); } } else if( !m_noLink ) { - for( Uint16 port = 0; - port < m_controlCount / m_processors; - port++ ) + for( int port = 0; port < m_controlCount / m_processors; port++ ) { m_controls[0][port]->setLink( false ); } diff --git a/plugins/ladspa_effect/LadspaControls.h b/plugins/ladspa_effect/LadspaControls.h index 1d048aeba..a606f3a6c 100644 --- a/plugins/ladspa_effect/LadspaControls.h +++ b/plugins/ladspa_effect/LadspaControls.h @@ -1,7 +1,7 @@ /* * LadspaControls.h - model for LADSPA plugin controls * - * Copyright (c) 2008-2010 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -62,7 +62,7 @@ public: protected slots: void updateLinkStatesFromGlobal(); - void linkPort( Uint16 _port, bool _state ); + void linkPort( int _port, bool _state ); private: diff --git a/plugins/lb302/artwork.png b/plugins/lb302/artwork.png index c06f34804..36f4b8713 100644 Binary files a/plugins/lb302/artwork.png and b/plugins/lb302/artwork.png differ diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 4040a00e6..9856c0cfa 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -466,9 +466,8 @@ inline float GET_INC(float freq) { return freq/engine::mixer()->processingSampleRate(); // TODO: Use actual sampling rate. } -int lb302Synth::process(sampleFrame *outbuf, const Uint32 size) +int lb302Synth::process(sampleFrame *outbuf, const int size) { - unsigned int i; float w; float samp; @@ -500,7 +499,7 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size) // TODO: NORMAL RELEASE // vca_mode = 1; - for(i=0;i= ENVINC) { @@ -804,34 +803,34 @@ lb302SynthView::lb302SynthView( Instrument * _instrument, QWidget * _parent ) : m_vcfCutKnob = new knob( knobBright_26, this ); m_vcfCutKnob->move( 75, 130 ); m_vcfCutKnob->setHintText( tr( "Cutoff Freq:" ) + " ", "" ); - m_vcfCutKnob->setLabel( tr("CUT") ); + m_vcfCutKnob->setLabel( "" ); m_vcfResKnob = new knob( knobBright_26, this ); m_vcfResKnob->move( 120, 130 ); m_vcfResKnob->setHintText( tr( "Resonance:" ) + " ", "" ); - m_vcfResKnob->setLabel( tr("RES") ); + m_vcfResKnob->setLabel( "" ); m_vcfModKnob = new knob( knobBright_26, this ); m_vcfModKnob->move( 165, 130 ); m_vcfModKnob->setHintText( tr( "Env Mod:" ) + " ", "" ); - m_vcfModKnob->setLabel( tr("ENV MOD") ); + m_vcfModKnob->setLabel( "" ); m_vcfDecKnob = new knob( knobBright_26, this ); m_vcfDecKnob->move( 210, 130 ); m_vcfDecKnob->setHintText( tr( "Decay:" ) + " ", "" ); - m_vcfDecKnob->setLabel( tr("DEC") ); + m_vcfDecKnob->setLabel( "" ); - m_slideToggle = new ledCheckBox( "Slide", this ); + m_slideToggle = new ledCheckBox( "", this ); m_slideToggle->move( 10, 180 ); - m_accentToggle = new ledCheckBox( "Accent", this ); + m_accentToggle = new ledCheckBox( "", this ); m_accentToggle->move( 10, 200 ); m_accentToggle->setDisabled(true); - m_deadToggle = new ledCheckBox( "Dead", this ); + m_deadToggle = new ledCheckBox( "", this ); m_deadToggle->move( 10, 220 ); - m_db24Toggle = new ledCheckBox( "24dB/oct", this ); + m_db24Toggle = new ledCheckBox( "", this ); m_db24Toggle->setWhatsThis( tr( "303-es-que, 24dB/octave, 3 pole filter" ) ); m_db24Toggle->move( 10, 150); @@ -840,12 +839,12 @@ lb302SynthView::lb302SynthView( Instrument * _instrument, QWidget * _parent ) : m_slideDecKnob = new knob( knobBright_26, this ); m_slideDecKnob->move( 210, 75 ); m_slideDecKnob->setHintText( tr( "Slide Decay:" ) + " ", "" ); - m_slideDecKnob->setLabel( tr( "SLIDE")); + m_slideDecKnob->setLabel( ""); m_distKnob = new knob( knobBright_26, this ); m_distKnob->move( 210, 190 ); m_distKnob->setHintText( tr( "DIST:" ) + " ", "" ); - m_distKnob->setLabel( tr( "DIST")); + m_distKnob->setLabel( tr( "")); // Shapes diff --git a/plugins/lb302/lb302.h b/plugins/lb302/lb302.h index 140e3917f..a7721bb37 100644 --- a/plugins/lb302/lb302.h +++ b/plugins/lb302/lb302.h @@ -231,7 +231,7 @@ private: void recalcFilter(); - int process(sampleFrame *outbuf, const Uint32 size); + int process(sampleFrame *outbuf, const int size); friend class lb302SynthView; diff --git a/plugins/lb302/logo.png b/plugins/lb302/logo.png index 22c99d1e4..dcf20d155 100644 Binary files a/plugins/lb302/logo.png and b/plugins/lb302/logo.png differ diff --git a/plugins/lb303/artwork.png b/plugins/lb303/artwork.png index c124bcd7c..061e32735 100644 Binary files a/plugins/lb303/artwork.png and b/plugins/lb303/artwork.png differ diff --git a/plugins/midi_import/MidiImport.h b/plugins/midi_import/MidiImport.h index e1d5bc947..47ad49486 100644 --- a/plugins/midi_import/MidiImport.h +++ b/plugins/midi_import/MidiImport.h @@ -69,15 +69,15 @@ private: } while( --_bytes ); return( value ); } - inline Sint32 read32LE( void ) + inline int read32LE() { int value = readByte(); value |= readByte() << 8; value |= readByte() << 16; value |= readByte() << 24; - return( value ); + return value; } - inline int readVar( void ) + inline int readVar() { int c = readByte(); int value = c & 0x7f; @@ -103,9 +103,9 @@ private: return( !file().atEnd() ? value : -1 ); } - inline Sint32 readID( void ) + inline int readID() { - return( read32LE() ); + return read32LE(); } inline void skip( int _bytes ) { diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index 6fd9455bb..f13617567 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -190,7 +190,7 @@ void organicInstrument::playNote( notePlayHandle * _n, Oscillator * oscs_l[m_numOscillators]; Oscillator * oscs_r[m_numOscillators]; - for( Sint8 i = m_numOscillators - 1; i >= 0; --i ) + for( int i = m_numOscillators - 1; i >= 0; --i ) { m_osc[i]->m_phaseOffsetLeft = rand() diff --git a/plugins/patman/patman.cpp b/plugins/patman/patman.cpp index 269eb00f3..a5a588b21 100644 --- a/plugins/patman/patman.cpp +++ b/plugins/patman/patman.cpp @@ -2,7 +2,7 @@ * patman.cpp - a GUS-compatible patch instrument plugin * * Copyright (c) 2007-2008 Javier Serrano Polo - * Copyright (c) 2009-2013 Tobias Doerffel + * Copyright (c) 2009-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -564,7 +564,7 @@ void PatmanView::openFile( void ) void PatmanView::updateFilename( void ) { m_displayFilename = ""; - Uint16 idx = m_pi->m_patchFile.length(); + int idx = m_pi->m_patchFile.length(); QFontMetrics fm( pointSize<8>( font() ) ); diff --git a/plugins/peak_controller_effect/artwork.png b/plugins/peak_controller_effect/artwork.png index 51ab2be9f..1c5d5defb 100644 Binary files a/plugins/peak_controller_effect/artwork.png and b/plugins/peak_controller_effect/artwork.png differ diff --git a/plugins/peak_controller_effect/peak_controller_effect.cpp b/plugins/peak_controller_effect/peak_controller_effect.cpp index 0d62c3933..a9fa56286 100644 --- a/plugins/peak_controller_effect/peak_controller_effect.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect.cpp @@ -64,6 +64,7 @@ PeakControllerEffect::PeakControllerEffect( m_peakControls( this ), m_lastSample( 0 ), m_lastRMS( -1 ), + m_lastRMSavail(false), m_autoController( NULL ) { m_autoController = new PeakController( engine::getSong(), this ); @@ -83,13 +84,19 @@ PeakControllerEffect::~PeakControllerEffect() } } +//! returns 1.0f if val > 0.0f, -1.0 else +inline float my_sign(float val) { return -1.0f + 2.0f * (val > 0.0f); } +//! if val >= 0.0f, returns sqrtf(val), else: -sqrtf(-val) +inline float sqrt_neg(float val) { + return sqrtf(fabs(val)) * my_sign(val); +} bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames ) { PeakControllerEffectControls & c = m_peakControls; - + // This appears to be used for determining whether or not to continue processing // audio with this effect if( !isEnabled() || !isRunning() ) @@ -101,7 +108,12 @@ bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf, double sum = 0; for( int i = 0; i < _frames; ++i ) { - sum += _buf[i][0]*_buf[i][0] + _buf[i][1]*_buf[i][1]; + float sign_0 = (c.m_absModel.value()) + ? 1.0f : my_sign(_buf[i][0]); + float sign_1 = (c.m_absModel.value()) + ? 1.0f : my_sign(_buf[i][1]); + sum += _buf[i][0]*_buf[i][0]*sign_0 + + _buf[i][1]*_buf[i][1]*sign_1; } if( c.m_muteModel.value() ) @@ -112,19 +124,22 @@ bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf, } } - float curRMS = sqrtf( sum / _frames ); + float curRMS = sqrt_neg( sum / _frames ); const float origRMS = curRMS; - if( m_lastRMS < 0 ) + + if( !m_lastRMSavail ) { + m_lastRMSavail = true; m_lastRMS = curRMS; } const float v = ( curRMS >= m_lastRMS ) ? c.m_attackModel.value() : c.m_decayModel.value(); - const float a = sqrtf( sqrtf( v ) ); + const float a = sqrt_neg( sqrt_neg( v ) ); curRMS = (1-a)*curRMS + a*m_lastRMS; - m_lastSample = c.m_baseModel.value() + c.m_amountModel.value()*curRMS; + const float amount = c.m_amountModel.value() * c.m_amountMultModel.value(); + m_lastSample = c.m_baseModel.value() + amount*curRMS; m_lastRMS = curRMS; // on greater buffer sizes our LP is updated less frequently, therfore @@ -138,6 +153,16 @@ bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf, //checkGate( out_sum / _frames ); + // finally, mute the output if wanted + // TODO: avoid clips? + if( c.m_muteOutputModel.value() ) + { + for( int i = 0; i < _frames; ++i ) + { + _buf[i][0] = _buf[i][1] = 0.0f; + } + } + return isRunning(); } diff --git a/plugins/peak_controller_effect/peak_controller_effect.h b/plugins/peak_controller_effect/peak_controller_effect.h index 56a81c58a..06e241f21 100644 --- a/plugins/peak_controller_effect/peak_controller_effect.h +++ b/plugins/peak_controller_effect/peak_controller_effect.h @@ -55,6 +55,7 @@ private: float m_lastSample; float m_lastRMS; + bool m_lastRMSavail; Controller * m_autoController; diff --git a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp index b16f666e7..4db7acbe1 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp @@ -44,13 +44,12 @@ PeakControllerEffectControlDialog::PeakControllerEffectControlDialog( pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); - setFixedSize( 144, 110 ); QVBoxLayout * tl = new QVBoxLayout( this ); - tl->addSpacing( 25 ); + tl->setContentsMargins( 5, 30, 8, 8 ); QHBoxLayout * l = new QHBoxLayout; - + l->setSpacing( 4 ); m_baseKnob = new knob( knobBright_26, this ); m_baseKnob->setLabel( tr( "BASE" ) ); m_baseKnob->setModel( &_controls->m_baseModel ); @@ -61,8 +60,13 @@ PeakControllerEffectControlDialog::PeakControllerEffectControlDialog( m_amountKnob->setModel( &_controls->m_amountModel ); m_amountKnob->setHintText( tr( "Modulation amount:" ) + " ", "" ); + m_amountMultKnob = new knob( knobBright_26, this ); + m_amountMultKnob->setLabel( tr( "MULT" ) ); + m_amountMultKnob->setModel( &_controls->m_amountMultModel ); + m_amountMultKnob->setHintText( tr( "Amount Multiplicator:" ) + " ", "" ); + m_attackKnob = new knob( knobBright_26, this ); - m_attackKnob->setLabel( tr( "ATTACK" ) ); + m_attackKnob->setLabel( tr( "ATTCK" ) ); m_attackKnob->setModel( &_controls->m_attackModel ); m_attackKnob->setHintText( tr( "Attack:" ) + " ", "" ); @@ -73,15 +77,28 @@ PeakControllerEffectControlDialog::PeakControllerEffectControlDialog( l->addWidget( m_baseKnob ); l->addWidget( m_amountKnob ); + l->addWidget( m_amountMultKnob ); l->addWidget( m_attackKnob ); l->addWidget( m_decayKnob ); + l->addStretch(); // expand, so other widgets have minimum width tl->addLayout( l ); - m_muteLed = new ledCheckBox( "Mute", this ); + QVBoxLayout * l2 = new QVBoxLayout; // = 2nd vbox + + m_muteLed = new ledCheckBox( "Mute Effect", this ); m_muteLed->setModel( &_controls->m_muteModel ); - tl->addSpacing( 5 ); - tl->addWidget( m_muteLed ); + m_absLed = new ledCheckBox( "Abs Value", this ); + m_absLed->setModel( &_controls->m_absModel ); + + m_muteOutputLed = new ledCheckBox( "Mute Output", this ); + m_muteOutputLed->setModel( &_controls->m_muteOutputModel ); + + l2->addWidget( m_muteLed ); + l2->addWidget( m_absLed ); + l2->addWidget( m_muteOutputLed ); + l2->addStretch(); // expand, so other widgets have minimum height + tl->addLayout( l2 ); setLayout( tl ); } diff --git a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h index 5e95bd654..40e7abc1f 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h +++ b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h @@ -50,6 +50,10 @@ protected: knob * m_decayKnob; ledCheckBox * m_muteLed; + ledCheckBox * m_absLed; + knob * m_amountMultKnob; + ledCheckBox * m_muteOutputLed; + } ; diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp index a07d52358..69c8f15b9 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp @@ -39,7 +39,10 @@ PeakControllerEffectControls( PeakControllerEffect * _eff ) : m_amountModel( 1.0, -1.0, 1.0, 0.005, this, tr( "Modulation amount" ) ), m_attackModel( 0, 0, 0.999, 0.001, this, tr( "Attack" ) ), m_decayModel( 0, 0, 0.999, 0.001, this, tr( "Release" ) ), - m_muteModel( false, this, tr( "Mute output" ) ) + m_muteModel( false, this, tr( "Mute output" ) ), + m_absModel( true, this, tr("Abs Value") ), + m_amountMultModel( 1.0, 0, 32, 0.2, this, tr("Amount Multiplicator") ), + m_muteOutputModel( false, this, tr("Mute Output") ) { } @@ -54,6 +57,10 @@ void PeakControllerEffectControls::loadSettings( const QDomElement & _this ) m_attackModel.loadSettings( _this, "attack" ); m_decayModel.loadSettings( _this, "decay" ); + m_absModel.loadSettings( _this, "abs" ); + m_amountMultModel.loadSettings( _this, "amountmult" ); + m_muteOutputModel.loadSettings( _this, "muteout" ); + int effectId = _this.attribute( "effectId" ).toInt(); if( effectId > PeakController::s_lastEffectId ) { @@ -82,6 +89,10 @@ void PeakControllerEffectControls::saveSettings( QDomDocument & _doc, m_attackModel.saveSettings( _doc, _this, "attack" ); m_decayModel.saveSettings( _doc, _this, "decay" ); + + m_absModel.saveSettings( _doc, _this, "abs" ); + m_amountMultModel.saveSettings( _doc, _this, "amountmult" ); + m_muteOutputModel.saveSettings( _doc, _this, "muteout" ); } diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.h b/plugins/peak_controller_effect/peak_controller_effect_controls.h index 7a8111795..4a4de0401 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_controls.h +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.h @@ -66,6 +66,9 @@ private: FloatModel m_attackModel; FloatModel m_decayModel; BoolModel m_muteModel; + BoolModel m_absModel; + FloatModel m_amountMultModel; + BoolModel m_muteOutputModel; friend class PeakControllerEffectControlDialog; friend class PeakControllerEffect; diff --git a/plugins/sid/artwork.png b/plugins/sid/artwork.png index 06b4ab786..c1dbaaddd 100644 Binary files a/plugins/sid/artwork.png and b/plugins/sid/artwork.png differ diff --git a/plugins/stk/mallets/mallets.cpp b/plugins/stk/mallets/mallets.cpp index 338736ab3..1b2513bfd 100644 --- a/plugins/stk/mallets/mallets.cpp +++ b/plugins/stk/mallets/mallets.cpp @@ -232,7 +232,7 @@ void malletsInstrument::playNote( notePlayHandle * _n, m_stickModel.value(), m_vibratoFreqModel.value(), p, - (Uint8) m_spreadModel.value(), + (uint8_t) m_spreadModel.value(), engine::mixer()->processingSampleRate() ); } else if( p == 9 ) @@ -245,7 +245,7 @@ void malletsInstrument::playNote( notePlayHandle * _n, m_crossfadeModel.value(), m_lfoSpeedModel.value(), m_adsrModel.value(), - (Uint8) m_spreadModel.value(), + (uint8_t) m_spreadModel.value(), engine::mixer()->processingSampleRate() ); } else @@ -258,7 +258,7 @@ void malletsInstrument::playNote( notePlayHandle * _n, p - 10, m_strikeModel.value() * 128.0, m_velocityModel.value(), - (Uint8) m_spreadModel.value(), + (uint8_t) m_spreadModel.value(), engine::mixer()->processingSampleRate() ); } m.unlock(); @@ -522,7 +522,7 @@ malletsSynth::malletsSynth( const StkFloat _pitch, const StkFloat _control8, const StkFloat _control11, const int _control16, - const Uint8 _delay, + const uint8_t _delay, const sample_rate_t _sample_rate ) { try @@ -551,7 +551,7 @@ malletsSynth::malletsSynth( const StkFloat _pitch, m_delay = new StkFloat[256]; m_delayRead = 0; m_delayWrite = _delay; - for( Uint16 i = 0; i < 256; i++ ) + for( int i = 0; i < 256; i++ ) { m_delay[i] = 0.0; } @@ -569,7 +569,7 @@ malletsSynth::malletsSynth( const StkFloat _pitch, const StkFloat _control4, const StkFloat _control11, const StkFloat _control128, - const Uint8 _delay, + const uint8_t _delay, const sample_rate_t _sample_rate ) { try @@ -596,7 +596,7 @@ malletsSynth::malletsSynth( const StkFloat _pitch, m_delay = new StkFloat[256]; m_delayRead = 0; m_delayWrite = _delay; - for( Uint16 i = 0; i < 256; i++ ) + for( int i = 0; i < 256; i++ ) { m_delay[i] = 0.0; } @@ -614,7 +614,7 @@ malletsSynth::malletsSynth( const StkFloat _pitch, const int _control16, const StkFloat _control64, const StkFloat _control128, - const Uint8 _delay, + const uint8_t _delay, const sample_rate_t _sample_rate ) { try @@ -643,7 +643,7 @@ malletsSynth::malletsSynth( const StkFloat _pitch, m_delay = new StkFloat[256]; m_delayRead = 0; m_delayWrite = _delay; - for( Uint16 i = 0; i < 256; i++ ) + for( int i = 0; i < 256; i++ ) { m_delay[i] = 0.0; } diff --git a/plugins/stk/mallets/mallets.h b/plugins/stk/mallets/mallets.h index f40d89152..46388681f 100644 --- a/plugins/stk/mallets/mallets.h +++ b/plugins/stk/mallets/mallets.h @@ -55,7 +55,7 @@ public: const StkFloat _control8, const StkFloat _control11, const int _control16, - const Uint8 _delay, + const uint8_t _delay, const sample_rate_t _sample_rate ); // TubeBell @@ -67,7 +67,7 @@ public: const StkFloat _control4, const StkFloat _control11, const StkFloat _control128, - const Uint8 _delay, + const uint8_t _delay, const sample_rate_t _sample_rate ); // BandedWG @@ -79,7 +79,7 @@ public: const int _control16, const StkFloat _control64, const StkFloat _control128, - const Uint8 _delay, + const uint8_t _delay, const sample_rate_t _sample_rate ); inline ~malletsSynth() @@ -124,8 +124,8 @@ protected: Instrmnt * m_voice; StkFloat * m_delay; - Uint8 m_delayRead; - Uint8 m_delayWrite; + uint8_t m_delayRead; + uint8_t m_delayWrite; }; diff --git a/plugins/triple_oscillator/TripleOscillator.cpp b/plugins/triple_oscillator/TripleOscillator.cpp index 37146c1ff..ae8510bab 100644 --- a/plugins/triple_oscillator/TripleOscillator.cpp +++ b/plugins/triple_oscillator/TripleOscillator.cpp @@ -304,7 +304,7 @@ void TripleOscillator::playNote( notePlayHandle * _n, Oscillator * oscs_l[NUM_OF_OSCILLATORS]; Oscillator * oscs_r[NUM_OF_OSCILLATORS]; - for( Sint8 i = NUM_OF_OSCILLATORS - 1; i >= 0; --i ) + for( int i = NUM_OF_OSCILLATORS - 1; i >= 0; --i ) { // the last oscs needs no sub-oscs... diff --git a/plugins/vestige/CMakeLists.txt b/plugins/vestige/CMakeLists.txt index 79006428a..2e459c36d 100644 --- a/plugins/vestige/CMakeLists.txt +++ b/plugins/vestige/CMakeLists.txt @@ -6,7 +6,6 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../vst_base) LINK_LIBRARIES(vstbase) BUILD_PLUGIN(vestige vestige.cpp vestige.h MOCFILES vestige.h EMBEDDED_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.png) -SET_TARGET_PROPERTIES(vestige PROPERTIES COMPILE_FLAGS "-D_FORTIFY_SOURCE=0") ENDIF(LMMS_SUPPORT_VST) diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 2a073253a..0cee1a4aa 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -1,7 +1,7 @@ /* * vestige.cpp - instrument-plugin for hosting VST-instruments * - * Copyright (c) 2005-2013 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -135,8 +135,7 @@ void vestigeInstrument::loadSettings( const QDomElement & _this ) knobFModel[i] = new FloatModel( 0.0f, 0.0f, 1.0f, 0.01f, this, QString::number(i) ); knobFModel[i]->loadSettings( _this, paramStr ); - if( !( knobFModel[ i ]->isAutomated() || - knobFModel[ i ]->getControllerConnection() ) ) + if( !( knobFModel[ i ]->isAutomated() || knobFModel[ i ]->controllerConnection() ) ) { knobFModel[ i ]->setValue( ( s_dumpValues.at( 2 )).toFloat() ); knobFModel[ i ]->setInitValue( ( s_dumpValues.at( 2 )).toFloat() ); @@ -190,7 +189,7 @@ void vestigeInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this ) char paramStr[35]; for( int i = 0; i < paramCount; i++ ) { - if (knobFModel[i]->isAutomated() || knobFModel[i]->getControllerConnection()) { + if (knobFModel[i]->isAutomated() || knobFModel[i]->controllerConnection()) { sprintf( paramStr, "param%d", i); knobFModel[i]->saveSettings( _doc, _this, paramStr ); } @@ -200,7 +199,7 @@ void vestigeInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this ) me.setAttribute( "value", knobFModel[i]->value() ); _this.appendChild( me ); - ControllerConnection * m_controllerConnection = knobFModel[i]->getControllerConnection(); + ControllerConnection * m_controllerConnection = knobFModel[i]->controllerConnection(); if (m_controllerConnection) { QDomElement controller_element; QDomNode node = _this.namedItem( "connection" ); @@ -1016,8 +1015,7 @@ void manageVestigeInstrumentView::syncPlugin( void ) { // only not automated knobs are synced from VST // those auto-setted values are not jurnaled, tracked for undo / redo - if( !( m_vi->knobFModel[ i ]->isAutomated() || - m_vi->knobFModel[ i ]->getControllerConnection() ) ) + if( !( m_vi->knobFModel[ i ]->isAutomated() || m_vi->knobFModel[ i ]->controllerConnection() ) ) { sprintf( paramStr, "param%d", i ); s_dumpValues = dump[ paramStr ].split( ":" ); @@ -1038,8 +1036,7 @@ void manageVestigeInstrumentView::displayAutomatedOnly( void ) for( int i = 0; i< m_vi->paramCount; i++ ) { - if( !( m_vi->knobFModel[ i ]->isAutomated() || - m_vi->knobFModel[ i ]->getControllerConnection() ) ) + if( !( m_vi->knobFModel[ i ]->isAutomated() || m_vi->knobFModel[ i ]->controllerConnection() ) ) { if( m_vi->vstKnobs[ i ]->isVisible() == true && isAuto ) { diff --git a/plugins/vibed/nine_button_selector.cpp b/plugins/vibed/nine_button_selector.cpp index 8035030e2..3c88604f4 100644 --- a/plugins/vibed/nine_button_selector.cpp +++ b/plugins/vibed/nine_button_selector.cpp @@ -50,8 +50,8 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, QPixmap _button7_off, QPixmap _button8_on, QPixmap _button8_off, - Uint8 _default, - Uint32 _x, Uint32 _y, + int _default, + int _x, int _y, QWidget * _parent ): QWidget( _parent ), IntModelView( new nineButtonSelectorModel(0, 8, _default, NULL, @@ -148,7 +148,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, nineButtonSelector::~ nineButtonSelector() { - for( Uint8 i = 0; i < 9; i++ ) + for( int i = 0; i < 9; i++ ) { delete m_buttons[i]; } @@ -231,13 +231,13 @@ void nineButtonSelector::modelChanged() updateButton( model()->value() ); } -void nineButtonSelector::setSelected( Uint8 _new_button ) +void nineButtonSelector::setSelected( int _new_button ) { model()->setValue(_new_button); updateButton( _new_button ); } -void nineButtonSelector::updateButton( Uint8 _new_button ) +void nineButtonSelector::updateButton( int _new_button ) { m_lastBtn->setChecked( false ); m_lastBtn->update(); diff --git a/plugins/vibed/nine_button_selector.h b/plugins/vibed/nine_button_selector.h index 3532abd50..bd8eacbc2 100644 --- a/plugins/vibed/nine_button_selector.h +++ b/plugins/vibed/nine_button_selector.h @@ -51,17 +51,17 @@ public: QPixmap _button7_off, QPixmap _button8_on, QPixmap _button8_off, - Uint8 _default, - Uint32 _x, Uint32 _y, + int _default, + int _x, int _y, QWidget * _parent); virtual ~nineButtonSelector(); -// inline Uint8 getSelected() { +// inline int getSelected() { // return( castModel()->value() ); // }; protected: - void setSelected( Uint8 _new_button ); + void setSelected( int _new_button ); public slots: void button0Clicked(); @@ -77,11 +77,11 @@ public slots: void displayHelp(); signals: - void nineButtonSelection( Uint8 ); + void nineButtonSelection( int ); private: virtual void modelChanged(); - void updateButton( Uint8 ); + void updateButton( int ); QList m_buttons; pixmapButton * m_button; diff --git a/plugins/vibed/string_container.cpp b/plugins/vibed/string_container.cpp index 14532e87e..089c63e94 100644 --- a/plugins/vibed/string_container.cpp +++ b/plugins/vibed/string_container.cpp @@ -27,13 +27,13 @@ stringContainer::stringContainer(const float _pitch, const sample_rate_t _sample_rate, - const Uint32 _buffer_length, - const Uint8 _strings ) : + const int _buffer_length, + const int _strings ) : m_pitch( _pitch ), m_sampleRate( _sample_rate ), m_bufferLength( _buffer_length ) { - for( Uint8 i = 0; i < _strings; i++ ) + for( int i = 0; i < _strings; i++ ) { m_exists.append( false ); } @@ -42,16 +42,16 @@ stringContainer::stringContainer(const float _pitch, -void stringContainer::addString(Uint8 _harm, +void stringContainer::addString(int _harm, const float _pick, const float _pickup, const float * _impulse, const float _randomize, const float _string_loss, const float _detune, - const Uint8 _oversample, + const int _oversample, const bool _state, - const Uint8 _id ) + const int _id ) { float harm; switch( _harm ) diff --git a/plugins/vibed/string_container.h b/plugins/vibed/string_container.h index 8d2c98992..2a217be21 100644 --- a/plugins/vibed/string_container.h +++ b/plugins/vibed/string_container.h @@ -35,44 +35,44 @@ class stringContainer public: stringContainer(const float _pitch, const sample_rate_t _sample_rate, - const Uint32 _buffer_length, - const Uint8 _strings = 9 ); + const int _buffer_length, + const int _strings = 9 ); - void addString( Uint8 _harm, + void addString( int _harm, const float _pick, const float _pickup, const float * _impluse, const float _randomize, const float _string_loss, const float _detune, - const Uint8 _oversample, + const int _oversample, const bool _state, - const Uint8 _id ); + const int _id ); - inline bool exists( Uint8 _id ) + bool exists( int _id ) const { - return( m_exists[_id] ); + return m_exists[_id]; } - inline ~stringContainer() + ~stringContainer() { - Uint32 strings = m_strings.count(); - for( Uint32 i = 0; i < strings; i++ ) + int strings = m_strings.count(); + for( int i = 0; i < strings; i++ ) { delete m_strings[i]; } } - inline float getStringSample( Uint8 _string ) + float getStringSample( int _string ) { - return( m_strings[_string]->nextSample() ); + return m_strings[_string]->nextSample(); } private: QVector m_strings; const float m_pitch; const sample_rate_t m_sampleRate; - const Uint32 m_bufferLength; + const int m_bufferLength; QVector m_exists; } ; diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index 2ace7a171..7464e1daa 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -71,7 +71,7 @@ vibed::vibed( InstrumentTrack * _instrumentTrack ) : nineButtonSelectorModel * harmonic; graphModel * graphTmp; - for( Uint8 harm = 0; harm < 9; harm++ ) + for( int harm = 0; harm < 9; harm++ ) { knob = new FloatModel( DefaultVolume, MinVolume, MaxVolume, 1.0f, this, tr( "String %1 volume" ).arg( harm+1 ) ); @@ -142,7 +142,7 @@ void vibed::saveSettings( QDomDocument & _doc, QDomElement & _this ) // Save plugin version _this.setAttribute( "version", "0.1" ); - for( Uint8 i = 0; i < 9; i++ ) + for( int i = 0; i < 9; i++ ) { name = "active" + QString::number( i ); _this.setAttribute( name, QString::number( @@ -199,7 +199,7 @@ void vibed::loadSettings( const QDomElement & _this ) QString name; - for( Uint8 i = 0; i < 9; i++ ) + for( int i = 0; i < 9; i++ ) { name = "active" + QString::number( i ); m_powerButtons[i]->setValue( _this.attribute( name ).toInt() ); @@ -280,7 +280,7 @@ void vibed::playNote( notePlayHandle * _n, sampleFrame * _working_buffer ) engine::mixer()->processingSampleRate(), __sampleLength ); - for( Uint8 i = 0; i < 9; ++i ) + for( int i = 0; i < 9; ++i ) { if( m_powerButtons[i]->value() ) { @@ -309,18 +309,14 @@ void vibed::playNote( notePlayHandle * _n, sampleFrame * _working_buffer ) { _working_buffer[i][0] = 0.0f; _working_buffer[i][1] = 0.0f; - Uint8 s = 0; - for( Uint8 string = 0; string < 9; ++string ) + int s = 0; + for( int string = 0; string < 9; ++string ) { if( ps->exists( string ) ) { // pan: 0 -> left, 1 -> right - const float pan = ( - m_panKnobs[string]->value() + 1 ) / - 2.0f; - const sample_t sample = - ps->getStringSample( s ) * - m_volumeKnobs[string]->value() / 100.0f; + const float pan = ( m_panKnobs[string]->value() + 1 ) / 2.0f; + const sample_t sample = ps->getStringSample( s ) * m_volumeKnobs[string]->value() / 100.0f; _working_buffer[i][0] += ( 1.0f - pan ) * sample; _working_buffer[i][1] += pan * sample; s++; @@ -547,8 +543,8 @@ vibedView::vibedView( Instrument * _instrument, "vibrating strings. The LED in the lower right corner of the " "waveform editor indicates whether the selected string is active." ) ); - connect( m_stringSelector, SIGNAL( nineButtonSelection( Uint8 ) ), - this, SLOT( showString( Uint8 ) ) ); + connect( m_stringSelector, SIGNAL( nineButtonSelection( int ) ), + this, SLOT( showString( int ) ) ); showString( 0 ); @@ -668,7 +664,7 @@ void vibedView::modelChanged() -void vibedView::showString( Uint8 _string ) +void vibedView::showString( int _string ) { vibed * v = castModel(); diff --git a/plugins/vibed/vibed.h b/plugins/vibed/vibed.h index 91ecb27b8..4846b4ae0 100644 --- a/plugins/vibed/vibed.h +++ b/plugins/vibed/vibed.h @@ -90,7 +90,7 @@ public: virtual ~vibedView() {}; public slots: - void showString( Uint8 _string ); + void showString( int _string ); void contextMenuEvent( QContextMenuEvent * ); void displayHelp(); diff --git a/plugins/vibed/vibrating_string.cpp b/plugins/vibed/vibrating_string.cpp index fc91a9036..704de66c1 100644 --- a/plugins/vibed/vibrating_string.cpp +++ b/plugins/vibed/vibrating_string.cpp @@ -34,9 +34,9 @@ vibratingString::vibratingString( float _pitch, float _pick, float _pickup, float * _impulse, - Uint32 _len, + int _len, sample_rate_t _sample_rate, - Uint8 _oversample, + int _oversample, float _randomize, float _string_loss, float _detune, @@ -64,7 +64,7 @@ vibratingString::vibratingString( float _pitch, else { m_impulse = new float[_len]; - for( Uint32 i = 0; i < _len; i++ ) + for( int i = 0; i < _len; i++ ) { m_impulse[i] = _impulse[i]; } diff --git a/plugins/vibed/vibrating_string.h b/plugins/vibed/vibrating_string.h index d266d2639..d75fe1d1d 100644 --- a/plugins/vibed/vibrating_string.h +++ b/plugins/vibed/vibrating_string.h @@ -37,9 +37,9 @@ public: float _pick, float _pickup, float * impluse, - Uint32 _len, + int _len, sample_rate_t _sample_rate, - Uint8 _oversample, + int _oversample, float _randomize, float _string_loss, float _detune, @@ -57,7 +57,7 @@ public: { sample_t ym0; sample_t ypM; - for( Uint8 i = 0; i < m_oversample; i++) + for( int i = 0; i < m_oversample; i++) { // Output at pickup position m_outsamp[i] = fromBridgeAccess( m_fromBridge, @@ -94,7 +94,7 @@ private: delayLine * m_fromBridge; delayLine * m_toBridge; int m_pickupLoc; - Uint8 m_oversample; + int m_oversample; float m_randomize; float m_stringLoss; diff --git a/plugins/vst_base/CMakeLists.txt b/plugins/vst_base/CMakeLists.txt index 6412121a0..313b3a2d5 100644 --- a/plugins/vst_base/CMakeLists.txt +++ b/plugins/vst_base/CMakeLists.txt @@ -24,7 +24,14 @@ IF(LMMS_BUILD_LINUX AND NOT WANT_VST_NOWINE) IF(LMMS_HOST_X86_64) SET(EXTRA_FLAGS -m32) + + # workaround for broken wineg++ in WINE 1.4 (shipped e.g. with Ubuntu Precise) + EXEC_PROGRAM( wineg++ ARGS "-v -m32 /dev/zero" OUTPUT_VARIABLE WINEBUILD_OUTPUT) + if("${WINEBUILD_OUTPUT}" MATCHES ".*x86_64-linux-gnu/wine/libwinecrt0.a.*") + SET(EXTRA_FLAGS ${EXTRA_FLAGS} -nodefaultlibs /usr/lib/i386-linux-gnu/wine/libwinecrt0.a -luser32 -lkernel32 -lgdi32) + ENDIF() ENDIF(LMMS_HOST_X86_64) + ADD_CUSTOM_COMMAND( SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp COMMAND wineg++ diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index 122dda3bc..9100de316 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -1,7 +1,7 @@ /* * RemoteVstPlugin.cpp - LMMS VST Support Layer (RemotePlugin client) * - * Copyright (c) 2005-2012 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -297,7 +297,7 @@ private: AEffect * m_plugin; HWND m_window; - Sint32 m_windowID; + intptr_t m_windowID; int m_windowWidth; int m_windowHeight; @@ -689,7 +689,7 @@ void RemoteVstPlugin::initEditor() UpdateWindow( m_window ); #ifdef LMMS_BUILD_LINUX - m_windowID = (Sint32) GetProp( m_window, "__wine_x11_whole_window" ); + m_windowID = (intptr_t) GetProp( m_window, "__wine_x11_whole_window" ); #endif } diff --git a/plugins/vst_base/VstPlugin.h b/plugins/vst_base/VstPlugin.h index 16b31e25a..2c8635bbf 100644 --- a/plugins/vst_base/VstPlugin.h +++ b/plugins/vst_base/VstPlugin.h @@ -1,7 +1,7 @@ /* * VstPlugin.h - declaration of VstPlugin class * - * Copyright (c) 2005-2012 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -61,7 +61,7 @@ public: return m_name; } - inline Sint32 version() const + inline int version() const { return m_version; } @@ -137,7 +137,7 @@ private: bool m_badDllFormat; QString m_name; - Sint32 m_version; + int m_version; QString m_vendorString; QString m_productString; QString m_currentProgramName; diff --git a/plugins/vst_effect/VstEffectControls.cpp b/plugins/vst_effect/VstEffectControls.cpp index 0dd31ed10..5c80cd4d4 100644 --- a/plugins/vst_effect/VstEffectControls.cpp +++ b/plugins/vst_effect/VstEffectControls.cpp @@ -1,7 +1,7 @@ /* * VstEffectControls.cpp - controls for VST effect plugins * - * Copyright (c) 2008-2009 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -88,7 +88,7 @@ void VstEffectControls::loadSettings( const QDomElement & _this ) knobFModel[i]->loadSettings( _this, paramStr ); if( !( knobFModel[ i ]->isAutomated() || - knobFModel[ i ]->getControllerConnection() ) ) + knobFModel[ i ]->controllerConnection() ) ) { knobFModel[ i ]->setValue( (s_dumpValues.at( 2 ) ).toFloat() ); knobFModel[ i ]->setInitValue( (s_dumpValues.at( 2 ) ).toFloat() ); @@ -133,7 +133,7 @@ void VstEffectControls::saveSettings( QDomDocument & _doc, QDomElement & _this ) char paramStr[35]; for( int i = 0; i < paramCount; i++ ) { - if (knobFModel[i]->isAutomated() || knobFModel[i]->getControllerConnection()) { + if (knobFModel[i]->isAutomated() || knobFModel[i]->controllerConnection()) { sprintf( paramStr, "param%d", i); knobFModel[i]->saveSettings( _doc, _this, paramStr ); } @@ -443,7 +443,7 @@ void manageVSTEffectView::syncPlugin( void ) // only not automated knobs are synced from VST // those auto-setted values are not jurnaled, tracked for undo / redo if( !( m_vi2->knobFModel[ i ]->isAutomated() || - m_vi2->knobFModel[ i ]->getControllerConnection() ) ) + m_vi2->knobFModel[ i ]->controllerConnection() ) ) { sprintf( paramStr, "param%d", i ); s_dumpValues = dump[ paramStr ].split( ":" ); @@ -464,7 +464,7 @@ void manageVSTEffectView::displayAutomatedOnly( void ) { if( !( m_vi2->knobFModel[ i ]->isAutomated() || - m_vi2->knobFModel[ i ]->getControllerConnection() ) ) + m_vi2->knobFModel[ i ]->controllerConnection() ) ) { if( m_vi2->vstKnobs[ i ]->isVisible() == true && isAuto ) { diff --git a/plugins/zynaddsubfx/CMakeLists.txt b/plugins/zynaddsubfx/CMakeLists.txt index 4b41ef239..046194979 100644 --- a/plugins/zynaddsubfx/CMakeLists.txt +++ b/plugins/zynaddsubfx/CMakeLists.txt @@ -108,7 +108,8 @@ ENDIF(LMMS_BUILD_WIN32) # FLTK needs X IF(LMMS_BUILD_LINUX) - FIND_PACKAGE(X11) + FIND_PACKAGE(X11 REQUIRED) + SET(FREETYPE_INCLUDE_DIRS foo) # fix broken FindFreetype.cmake in older versions of FreeType2 FIND_PACKAGE(Freetype REQUIRED) TARGET_LINK_LIBRARIES(RemoteZynAddSubFx -ldl ${X11_LIBRARIES} ${X11_Xft_LIB} ${X11_Xinerama_LIB} ${FREETYPE_LIBRARY} -lfontconfig) ENDIF(LMMS_BUILD_LINUX) @@ -126,6 +127,10 @@ ELSEIF(LMMS_BUILD_WIN32) SET(FLTK_EXTRA_FLAGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/modules/Win32Toolchain.cmake") ENDIF(LMMS_BUILD_WIN64) +IF(NOT FREETYPE_INCLUDE_DIR_freetype2) + SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR_ft2build}/freetype2) +ENDIF() + ADD_CUSTOM_TARGET(libfltk COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/fltk && cd ${CMAKE_CURRENT_BINARY_DIR}/fltk && ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/fltk ${FLTK_EXTRA_FLAGS} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/cmake/modules/ -DFLTK_USE_SYSTEM_ZLIB:BOOL=ON -DFLTK_USE_SYSTEM_JPEG:BOOL=ON -DFLTK_USE_SYSTEM_PNG:BOOL=ON -DOPTION_BUILD_EXAMPLES:BOOL=OFF -DCMAKE_BUILD_TYPE=release -DFREETYPE_PATH="${FREETYPE_INCLUDE_DIR_freetype2}\;${FREETYPE_INCLUDE_DIR_ft2build}" && ${CMAKE_BUILD_TOOL}) ADD_DEPENDENCIES(RemoteZynAddSubFx libfltk) diff --git a/src/core/AutomatableModel.cpp b/src/core/AutomatableModel.cpp index 895e2342d..54024af53 100644 --- a/src/core/AutomatableModel.cpp +++ b/src/core/AutomatableModel.cpp @@ -1,7 +1,7 @@ /* * AutomatableModel.cpp - some implementations of AutomatableModel-class * - * Copyright (c) 2008-2012 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -29,33 +29,28 @@ #include "ControllerConnection.h" -float AutomatableModel::__copiedValue = 0; +float AutomatableModel::s_copiedValue = 0; -AutomatableModel::AutomatableModel( DataType _type, - const float _val, - const float _min, - const float _max, - const float _step, - ::Model * _parent, - const QString & _display_name, - bool _default_constructed ) : - Model( _parent, _display_name, _default_constructed ), - m_dataType( _type ), - m_value( _val ), - m_initValue( _val ), - m_minValue( _min ), - m_maxValue( _max ), - m_step( _step ), - m_range( _max - _min ), +AutomatableModel::AutomatableModel( DataType type, + const float val, const float min, const float max, const float step, + Model* parent, const QString & displayName, bool defaultConstructed ) : + Model( parent, displayName, defaultConstructed ), + m_dataType( type ), + m_value( val ), + m_initValue( val ), + m_minValue( min ), + m_maxValue( max ), + m_step( step ), + m_range( max - min ), m_journalEntryReady( false ), m_setValueDepth( 0 ), m_hasLinkedModels( false ), m_controllerConnection( NULL ) { - setInitValue( _val ); + setInitValue( val ); } @@ -88,55 +83,54 @@ bool AutomatableModel::isAutomated() const -void AutomatableModel::saveSettings( QDomDocument & _doc, QDomElement & _this, - const QString & _name ) +void AutomatableModel::saveSettings( QDomDocument& doc, QDomElement& element, const QString& name ) { if( isAutomated() ) { - QDomElement me = _doc.createElement( _name ); + QDomElement me = doc.createElement( name ); me.setAttribute( "id", id() ); me.setAttribute( "value", m_value ); - _this.appendChild( me ); + element.appendChild( me ); } else { - _this.setAttribute( _name, m_value ); + element.setAttribute( name, m_value ); } if( m_controllerConnection ) { - QDomElement controller_element; - QDomNode node = _this.namedItem( "connection" ); + QDomElement controllerElement; + QDomNode node = element.namedItem( "connection" ); if( node.isElement() ) { - controller_element = node.toElement(); + controllerElement = node.toElement(); } else { - controller_element = _doc.createElement( "connection" ); - _this.appendChild( controller_element ); + controllerElement = doc.createElement( "connection" ); + element.appendChild( controllerElement ); } - QDomElement element = _doc.createElement( _name ); - m_controllerConnection->saveSettings( _doc, element ); - controller_element.appendChild( element ); + + QDomElement element = doc.createElement( name ); + m_controllerConnection->saveSettings( doc, element ); + + controllerElement.appendChild( element ); } } -void AutomatableModel::loadSettings( const QDomElement & _this, - const QString & _name ) +void AutomatableModel::loadSettings( const QDomElement& element, const QString& name ) { // compat code - QDomNode node = _this.namedItem( AutomationPattern::classNodeName() ); + QDomNode node = element.namedItem( AutomationPattern::classNodeName() ); if( node.isElement() ) { - node = node.namedItem( _name ); + node = node.namedItem( name ); if( node.isElement() ) { - AutomationPattern * p = AutomationPattern:: - globalAutomationPattern( this ); + AutomationPattern * p = AutomationPattern::globalAutomationPattern( this ); p->loadSettings( node.toElement() ); setValue( p->valueAt( 0 ) ); // in older projects we sometimes have odd automations @@ -149,7 +143,7 @@ void AutomatableModel::loadSettings( const QDomElement & _this, } } - node = _this.namedItem( _name ); + node = element.namedItem( name ); if( node.isElement() ) { changeID( node.toElement().attribute( "id" ).toInt() ); @@ -157,10 +151,10 @@ void AutomatableModel::loadSettings( const QDomElement & _this, return; } - node = _this.namedItem( "connection" ); + node = element.namedItem( "connection" ); if( node.isElement() ) { - node = node.namedItem( _name ); + node = node.namedItem( name ); if( node.isElement() ) { setControllerConnection( new ControllerConnection( (Controller*)NULL ) ); @@ -169,35 +163,37 @@ void AutomatableModel::loadSettings( const QDomElement & _this, } } - setInitValue( _this.attribute( _name ).toFloat() ); + if( element.hasAttribute( name ) ) + { + setInitValue( element.attribute( name ).toFloat() ); + } + else + { + reset(); + } } -void AutomatableModel::setValue( const float _value ) +void AutomatableModel::setValue( const float value ) { ++m_setValueDepth; const float old_val = m_value; - m_value = fittedValue( _value ); + m_value = fittedValue( value ); if( old_val != m_value ) { // add changes to history so user can undo it addJournalEntry( JournalEntry( 0, m_value - old_val ) ); // notify linked models - for( AutoModelVector::Iterator it = - m_linkedModels.begin(); - it != m_linkedModels.end(); ++it ) + for( AutoModelVector::Iterator it = m_linkedModels.begin(); it != m_linkedModels.end(); ++it ) { - if( (*it)->m_setValueDepth < 1 && - (*it)->fittedValue( _value ) != - (*it)->m_value ) + if( (*it)->m_setValueDepth < 1 && (*it)->fittedValue( value ) != (*it)->m_value ) { - bool journalling = (*it)->testAndSetJournalling( - isJournalling() ); - (*it)->setValue( _value ); + bool journalling = (*it)->testAndSetJournalling( isJournalling() ); + (*it)->setValue( value ); (*it)->setJournalling( journalling ); } } @@ -213,13 +209,13 @@ void AutomatableModel::setValue( const float _value ) -void AutomatableModel::setAutomatedValue( const float _value ) +void AutomatableModel::setAutomatedValue( const float value ) { ++m_setValueDepth; - const float old_val = m_value; + const float oldValue = m_value; - m_value = fittedValue( _value ); - if( old_val != m_value ) + m_value = fittedValue( value ); + if( oldValue != m_value ) { // notify linked models for( AutoModelVector::Iterator it = m_linkedModels.begin(); @@ -240,19 +236,20 @@ void AutomatableModel::setAutomatedValue( const float _value ) -void AutomatableModel::setRange( const float _min, const float _max, - const float _step ) +void AutomatableModel::setRange( const float min, const float max, + const float step ) { - if( ( m_maxValue != _max ) || ( m_minValue != _min ) ) + if( ( m_maxValue != max ) || ( m_minValue != min ) ) { - m_minValue = _min; - m_maxValue = _max; + m_minValue = min; + m_maxValue = max; if( m_minValue > m_maxValue ) { qSwap( m_minValue, m_maxValue ); } m_range = m_maxValue - m_minValue; - setStep( _step ); + + setStep( step ); // re-adjust value setInitValue( value() ); @@ -264,11 +261,11 @@ void AutomatableModel::setRange( const float _min, const float _max, -void AutomatableModel::setStep( const float _step ) +void AutomatableModel::setStep( const float step ) { - if( m_step != _step ) + if( m_step != step ) { - m_step = _step; + m_step = step; emit propertiesChanged(); } } @@ -276,63 +273,61 @@ void AutomatableModel::setStep( const float _step ) -float AutomatableModel::fittedValue( float _value ) const +float AutomatableModel::fittedValue( float value ) const { - _value = tLimit( _value, m_minValue, m_maxValue ); + value = tLimit( value, m_minValue, m_maxValue ); if( m_step != 0 ) { - _value = roundf( _value / m_step ) * m_step; + value = roundf( value / m_step ) * m_step; } else { - _value = m_minValue; + value = m_minValue; } // correct rounding error at the border - if( qAbs( _value - m_maxValue ) < - typeInfo::minEps() * qAbs( m_step ) ) + if( qAbs( value - m_maxValue ) < typeInfo::minEps() * qAbs( m_step ) ) { - _value = m_maxValue; + value = m_maxValue; } // correct rounding error if value = 0 - if( qAbs( _value ) < typeInfo::minEps() * - qAbs( m_step ) ) + if( qAbs( value ) < typeInfo::minEps() * qAbs( m_step ) ) { - _value = 0; + value = 0; } - if( _value < m_minValue ) + if( value < m_minValue ) { return m_minValue; } - else if( _value > m_maxValue ) + else if( value > m_maxValue ) { return m_maxValue; } - return _value; + return value; } -void AutomatableModel::redoStep( JournalEntry & _je ) +void AutomatableModel::redoStep( JournalEntry& je ) { bool journalling = testAndSetJournalling( false ); - setValue( value() + (float) _je.data().toDouble() ); + setValue( value() + (float) je.data().toDouble() ); setJournalling( journalling ); } -void AutomatableModel::undoStep( JournalEntry & _je ) +void AutomatableModel::undoStep( JournalEntry& je ) { - JournalEntry je( _je.actionID(), -_je.data().toDouble() ); - redoStep( je ); + JournalEntry inv( je.actionID(), -je.data().toDouble() ); + redoStep( inv ); } @@ -355,8 +350,7 @@ void AutomatableModel::addJournalEntryFromOldToCurVal() restoreJournallingState(); if( value() != m_oldValue ) { - addJournalEntry( JournalEntry( 0, value() - - m_oldValue ) ); + addJournalEntry( JournalEntry( 0, value() - m_oldValue ) ); } m_journalEntryReady = false; } @@ -365,16 +359,16 @@ void AutomatableModel::addJournalEntryFromOldToCurVal() -void AutomatableModel::linkModel( AutomatableModel * _model ) +void AutomatableModel::linkModel( AutomatableModel* model ) { - if( !m_linkedModels.contains( _model ) ) + if( !m_linkedModels.contains( model ) ) { - m_linkedModels.push_back( _model ); + m_linkedModels.push_back( model ); m_hasLinkedModels = true; - if( !_model->m_hasLinkedModels ) + + if( !model->hasLinkedModels() ) { - QObject::connect( this, SIGNAL( dataChanged() ), - _model, SIGNAL( dataChanged() ) ); + QObject::connect( this, SIGNAL( dataChanged() ), model, SIGNAL( dataChanged() ) ); } } } @@ -382,10 +376,9 @@ void AutomatableModel::linkModel( AutomatableModel * _model ) -void AutomatableModel::unlinkModel( AutomatableModel * _model ) +void AutomatableModel::unlinkModel( AutomatableModel* model ) { - AutoModelVector::Iterator it = - qFind( m_linkedModels.begin(), m_linkedModels.end(), _model ); + AutoModelVector::Iterator it = qFind( m_linkedModels.begin(), m_linkedModels.end(), model ); if( it != m_linkedModels.end() ) { m_linkedModels.erase( it ); @@ -398,21 +391,19 @@ void AutomatableModel::unlinkModel( AutomatableModel * _model ) -void AutomatableModel::linkModels( AutomatableModel * _model1, - AutomatableModel * _model2 ) +void AutomatableModel::linkModels( AutomatableModel* model1, AutomatableModel* model2 ) { - _model1->linkModel( _model2 ); - _model2->linkModel( _model1 ); + model1->linkModel( model2 ); + model2->linkModel( model1 ); } -void AutomatableModel::unlinkModels( AutomatableModel * _model1, - AutomatableModel * _model2 ) +void AutomatableModel::unlinkModels( AutomatableModel* model1, AutomatableModel* model2 ) { - _model1->unlinkModel( _model2 ); - _model2->unlinkModel( _model1 ); + model1->unlinkModel( model2 ); + model2->unlinkModel( model1 ); } @@ -431,41 +422,37 @@ void AutomatableModel::unlinkAllModels() -void AutomatableModel::setControllerConnection( ControllerConnection * _c ) +void AutomatableModel::setControllerConnection( ControllerConnection* c ) { - m_controllerConnection = _c; - if( _c ) + m_controllerConnection = c; + if( c ) { - QObject::connect( m_controllerConnection, - SIGNAL( valueChanged() ), - this, SIGNAL( dataChanged() ) ); - QObject::connect( m_controllerConnection, - SIGNAL( destroyed() ), - this, SLOT( unlinkControllerConnection() ) ); + QObject::connect( m_controllerConnection, SIGNAL( valueChanged() ), this, SIGNAL( dataChanged() ) ); + QObject::connect( m_controllerConnection, SIGNAL( destroyed() ), this, SLOT( unlinkControllerConnection() ) ); emit dataChanged(); } } -float AutomatableModel::controllerValue( int _frameOffset ) const +float AutomatableModel::controllerValue( int frameOffset ) const { if( m_controllerConnection ) { - const float v = m_minValue + - ( m_range * m_controllerConnection->currentValue( - _frameOffset ) ); + const float v = minValue() + ( range() * controllerConnection()->currentValue( frameOffset ) ); if( typeInfo::isEqual( m_step, 1 ) ) { return qRound( v ); } return v; } - AutomatableModel * lm = m_linkedModels.first(); - if( lm->m_controllerConnection ) + + AutomatableModel* lm = m_linkedModels.first(); + if( lm->controllerConnection() ) { - return lm->controllerValue( _frameOffset ); + return lm->controllerValue( frameOffset ); } + return lm->m_value; } @@ -485,13 +472,13 @@ void AutomatableModel::unlinkControllerConnection() -void AutomatableModel::setInitValue( const float _value ) +void AutomatableModel::setInitValue( const float value ) { - m_initValue = fittedValue( _value ); + m_initValue = fittedValue( value ); bool journalling = testAndSetJournalling( false ); - setValue( _value ); + setValue( value ); setJournalling( journalling ); - emit initValueChanged( _value ); + emit initValueChanged( value ); } @@ -507,7 +494,7 @@ void AutomatableModel::reset() void AutomatableModel::copyValue() { - __copiedValue = value(); + s_copiedValue = value(); } @@ -515,7 +502,7 @@ void AutomatableModel::copyValue() void AutomatableModel::pasteValue() { - setValue( __copiedValue ); + setValue( copiedValue() ); } diff --git a/src/core/AutomationPattern.cpp b/src/core/AutomationPattern.cpp index 25f4114b8..4babc3c50 100644 --- a/src/core/AutomationPattern.cpp +++ b/src/core/AutomationPattern.cpp @@ -102,10 +102,10 @@ void AutomationPattern::addObject( AutomatableModel * _obj, bool _search_dup ) if( addIt ) { - // been empty before? - if( m_objects.isEmpty() && hasAutomation() == false ) + // been empty before and model's current value is not its init value? + if( m_objects.isEmpty() && hasAutomation() == false && _obj->isAtInitValue() == false ) { - // then initialize default value + // then initialize first value putValue( 0, _obj->value(), false ); } @@ -449,31 +449,29 @@ trackContentObjectView * AutomationPattern::createView( trackView * _tv ) bool AutomationPattern::isAutomated( const AutomatableModel * _m ) { - TrackContainer::TrackList l = engine::getSong()->tracks() + - engine::getBBTrackContainer()->tracks(); + TrackContainer::TrackList l; + l += engine::getSong()->tracks(); + l += engine::getBBTrackContainer()->tracks(); l += engine::getSong()->globalAutomationTrack(); - for( TrackContainer::TrackList::const_iterator it = l.begin(); - it != l.end(); ++it ) + + for( TrackContainer::TrackList::ConstIterator it = l.begin(); it != l.end(); ++it ) { if( ( *it )->type() == track::AutomationTrack || ( *it )->type() == track::HiddenAutomationTrack ) { const track::tcoVector & v = ( *it )->getTCOs(); - for( track::tcoVector::const_iterator j = v.begin(); - j != v.end(); ++j ) + for( track::tcoVector::ConstIterator j = v.begin(); j != v.end(); ++j ) { - const AutomationPattern * a = - dynamic_cast( *j ); + const AutomationPattern * a = dynamic_cast( *j ); if( a && a->hasAutomation() ) { - for( objectVector::const_iterator k = a->m_objects.begin(); - k != a->m_objects.end(); ++k ) - { - if( *k == _m ) - { - return true; - } - } + for( objectVector::const_iterator k = a->m_objects.begin(); k != a->m_objects.end(); ++k ) + { + if( *k == _m ) + { + return true; + } + } } } } diff --git a/src/core/Controller.cpp b/src/core/Controller.cpp index 82fc5f578..41bff4dcc 100644 --- a/src/core/Controller.cpp +++ b/src/core/Controller.cpp @@ -203,7 +203,7 @@ bool Controller::hasModel( const Model * m ) return true; } - ControllerConnection * cc = am->getControllerConnection(); + ControllerConnection * cc = am->controllerConnection(); if( cc != NULL ) { if( cc->getController()->hasModel( m ) ) diff --git a/src/core/InstrumentFunctions.cpp b/src/core/InstrumentFunctions.cpp index 4f9261a4e..f6ef44715 100644 --- a/src/core/InstrumentFunctions.cpp +++ b/src/core/InstrumentFunctions.cpp @@ -1,7 +1,7 @@ /* * InstrumentFunctions.cpp - models for instrument-function-tab * - * Copyright (c) 2004-2013 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -153,12 +153,14 @@ ChordCreator::Chord::Chord( const char * n, const ChordSemiTones & semi_tones ) -bool ChordCreator::Chord::hasSemiTone( Sint8 semi_tone ) const +bool ChordCreator::Chord::hasSemiTone( int8_t semi_tone ) const { for( int i = 0; i < size(); ++i ) { if( semi_tone == m_semiTones[i] ) + { return true; + } } return false; } diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index 5a28a5e8c..bb2c80f9d 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -360,7 +360,7 @@ Mixer::Mixer() : m_workingBuf = (sampleFrame*) aligned_malloc( m_framesPerPeriod * sizeof( sampleFrame ) ); - for( Uint8 i = 0; i < 3; i++ ) + for( int i = 0; i < 3; i++ ) { m_readBuf = (surroundSampleFrame*) aligned_malloc( m_framesPerPeriod * @@ -412,7 +412,7 @@ Mixer::~Mixer() delete m_audioDev; delete m_midiClient; - for( Uint8 i = 0; i < 3; i++ ) + for( int i = 0; i < 3; i++ ) { aligned_free( m_bufferPool[i] ); } @@ -1008,20 +1008,6 @@ AudioDevice * Mixer::tryAudioDevices() #endif -#ifdef LMMS_HAVE_PORTAUDIO - if( dev_name == AudioPortAudio::name() || dev_name == "" ) - { - dev = new AudioPortAudio( success_ful, this ); - if( success_ful ) - { - m_audioDevName = AudioPortAudio::name(); - return dev; - } - delete dev; - } -#endif - - #ifdef LMMS_HAVE_PULSEAUDIO if( dev_name == AudioPulseAudio::name() || dev_name == "" ) { @@ -1077,6 +1063,21 @@ AudioDevice * Mixer::tryAudioDevices() } #endif + +#ifdef LMMS_HAVE_PORTAUDIO + if( dev_name == AudioPortAudio::name() || dev_name == "" ) + { + dev = new AudioPortAudio( success_ful, this ); + if( success_ful ) + { + m_audioDevName = AudioPortAudio::name(); + return dev; + } + delete dev; + } +#endif + + // add more device-classes here... //dev = new audioXXXX( SAMPLE_RATES[m_qualityLevel], success_ful, this ); //if( sucess_ful ) diff --git a/src/core/audio/AudioDevice.cpp b/src/core/audio/AudioDevice.cpp index 52ee44d5c..a6e4094e3 100644 --- a/src/core/audio/AudioDevice.cpp +++ b/src/core/audio/AudioDevice.cpp @@ -1,7 +1,7 @@ /* * AudioDevice.cpp - base-class for audio-devices used by LMMS-mixer * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -193,23 +193,20 @@ void AudioDevice::resample( const surroundSampleFrame * _src, -Uint32 AudioDevice::convertToS16( const surroundSampleFrame * _ab, - const fpp_t _frames, - const float _master_gain, - int_sample_t * _output_buffer, - const bool _convert_endian ) +int AudioDevice::convertToS16( const surroundSampleFrame * _ab, + const fpp_t _frames, + const float _master_gain, + int_sample_t * _output_buffer, + const bool _convert_endian ) { if( _convert_endian ) { - Uint16 temp; + int_sample_t temp; for( fpp_t frame = 0; frame < _frames; ++frame ) { for( ch_cnt_t chnl = 0; chnl < channels(); ++chnl ) { - temp = static_cast( - Mixer::clip( _ab[frame][chnl] * - _master_gain ) * - OUTPUT_SAMPLE_MULTIPLIER ); + temp = static_cast( Mixer::clip( _ab[frame][chnl] * _master_gain ) * OUTPUT_SAMPLE_MULTIPLIER ); ( _output_buffer + frame * channels() )[chnl] = ( temp & 0x00ff ) << 8 | diff --git a/src/core/audio/AudioFileDevice.cpp b/src/core/audio/AudioFileDevice.cpp index dd0324308..2a87db554 100644 --- a/src/core/audio/AudioFileDevice.cpp +++ b/src/core/audio/AudioFileDevice.cpp @@ -2,7 +2,7 @@ * AudioFileDevice.cpp - base-class for audio-device-classes which write * their output into a file * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -75,15 +75,13 @@ AudioFileDevice::~AudioFileDevice() -Sint32 AudioFileDevice::writeData( const void * _data, Sint32 _len ) +int AudioFileDevice::writeData( const void* data, int len ) { if( m_outputFile.isOpen() ) { - return m_outputFile.write( (const char *) _data, _len ); + return m_outputFile.write( (const char *) data, len ); } + return -1; } - - - diff --git a/src/core/audio/AudioFileOgg.cpp b/src/core/audio/AudioFileOgg.cpp index fc25c1355..24148bc26 100644 --- a/src/core/audio/AudioFileOgg.cpp +++ b/src/core/audio/AudioFileOgg.cpp @@ -5,7 +5,7 @@ * This file is based on encode.c from vorbis-tools-source, for more information * see below. * - * Copyright (c) 2004-2013 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -63,9 +63,9 @@ AudioFileOgg::~AudioFileOgg() -inline Sint32 AudioFileOgg::writePage() +inline int AudioFileOgg::writePage() { - Sint32 written = writeData( m_og.header, m_og.header_len ); + int written = writeData( m_og.header, m_og.header_len ); written += writeData( m_og.body, m_og.body_len ); return written; } @@ -78,7 +78,7 @@ bool AudioFileOgg::startEncoding() vorbis_comment vc; const char * comments = "Cool=This song has been made using Linux " "MultiMedia Studio"; - Sint32 comment_length = strlen( comments ); + int comment_length = strlen( comments ); char * user_comments = new char[comment_length + 1]; strcpy( user_comments, comments ); @@ -166,7 +166,7 @@ bool AudioFileOgg::startEncoding() { break; } - Sint32 ret = writePage(); + int ret = writePage(); if( ret != m_og.header_len + m_og.body_len ) { // clean up diff --git a/src/core/audio/AudioPulseAudio.cpp b/src/core/audio/AudioPulseAudio.cpp index 668e5cc87..db7481c9f 100644 --- a/src/core/audio/AudioPulseAudio.cpp +++ b/src/core/audio/AudioPulseAudio.cpp @@ -1,7 +1,7 @@ /* * AudioPulseAudio.cpp - device-class which implements PulseAudio-output * - * Copyright (c) 2008-2011 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -249,7 +249,7 @@ void AudioPulseAudio::streamWriteCallback( pa_stream *s, size_t length ) { const fpp_t fpp = mixer()->framesPerPeriod(); surroundSampleFrame * temp = new surroundSampleFrame[fpp]; - Sint16 * pcmbuf = (Sint16*)pa_xmalloc( fpp * channels() * sizeof(Sint16) ); + int_sample_t* pcmbuf = (int_sample_t *)pa_xmalloc( fpp * channels() * sizeof(int_sample_t) ); size_t fd = 0; while( fd < length/4 && m_quit == false ) diff --git a/src/core/bb_track_container.cpp b/src/core/bb_track_container.cpp index 58e58517d..d199f8454 100644 --- a/src/core/bb_track_container.cpp +++ b/src/core/bb_track_container.cpp @@ -55,13 +55,12 @@ bbTrackContainer::~bbTrackContainer() bool bbTrackContainer::play( midiTime _start, fpp_t _frames, - f_cnt_t _offset, - Sint16 _tco_num ) + f_cnt_t _offset, int _tco_num ) { bool played_a_note = false; if( lengthOfBB( _tco_num ) <= 0 ) { - return( false ); + return false; } _start = _start % ( lengthOfBB( _tco_num ) * midiTime::ticksPerTact() ); @@ -75,7 +74,7 @@ bool bbTrackContainer::play( midiTime _start, fpp_t _frames, } } - return( played_a_note ); + return played_a_note; } @@ -109,7 +108,7 @@ tact_t bbTrackContainer::lengthOfBB( int _bb ) ( *it )->getTCO( _bb )->length() ); } - return( max_length.nextFullTact() ); + return max_length.nextFullTact(); } @@ -117,7 +116,7 @@ tact_t bbTrackContainer::lengthOfBB( int _bb ) int bbTrackContainer::numOfBBs() const { - return( engine::getSong()->countTracks( track::BBTrack ) ); + return engine::getSong()->countTracks( track::BBTrack ); } diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index e8d121692..653c14d5d 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -63,7 +63,7 @@ configManager::configManager() : m_pluginDir( qApp->applicationDirPath() + QDir::separator() + "plugins" + QDir::separator() ), #else - m_pluginDir( QString( PLUGIN_DIR ) ), + m_pluginDir( qApp->applicationDirPath() + '/' + PLUGIN_DIR ), #endif m_vstDir( m_workingDir + "vst" + QDir::separator() ), m_flDir( QDir::home().absolutePath() ) @@ -347,7 +347,7 @@ void configManager::loadConfigFile() #ifdef LMMS_BUILD_WIN32 m_ladDir = m_pluginDir + "ladspa" + QDir::separator(); #else - m_ladDir = QString( LIB_DIR ) + "/ladspa/"; + m_ladDir = qApp->applicationDirPath() + '/' + LIB_DIR + "/ladspa/"; #endif } diff --git a/src/core/ladspa_2_lmms.cpp b/src/core/ladspa_2_lmms.cpp index 7aa11d3c7..d3d36c66f 100644 --- a/src/core/ladspa_2_lmms.cpp +++ b/src/core/ladspa_2_lmms.cpp @@ -111,8 +111,8 @@ QString ladspa2LMMS::getShortName( const ladspa_key_t & _key ) } if( name.length() > 40 ) { - Uint8 i = 40; - while( name[i] != ' ' && i != 0 ) + int i = 40; + while( name[i] != ' ' && i > 0 ) { i--; } @@ -123,6 +123,6 @@ QString ladspa2LMMS::getShortName( const ladspa_key_t & _key ) name = "LADSPA Plugin"; } - return( name ); + return name; } diff --git a/src/core/ladspa_manager.cpp b/src/core/ladspa_manager.cpp index 605a56ad4..4d78ebc5d 100644 --- a/src/core/ladspa_manager.cpp +++ b/src/core/ladspa_manager.cpp @@ -3,7 +3,7 @@ * of ladspa plugins * * Copyright (c) 2005-2008 Danny McRae - * Copyright (c) 2011 Tobias Doerffel + * Copyright (c) 2011-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -24,6 +24,7 @@ * */ +#include #include #include #include @@ -44,7 +45,7 @@ ladspaManager::ladspaManager() ladspaDirectories.push_back( configManager::inst()->pluginDir() + "ladspa" ); #ifndef LMMS_BUILD_WIN32 - ladspaDirectories.push_back( QString( LIB_DIR ) + "ladspa" ); + ladspaDirectories.push_back( qApp->applicationDirPath() + '/' + LIB_DIR + "ladspa" ); ladspaDirectories.push_back( "/usr/lib/lmms/ladspa" ); ladspaDirectories.push_back( "/usr/local/lib/lmms/ladspa" ); ladspaDirectories.push_back( "/usr/lib/ladspa" ); @@ -181,12 +182,12 @@ void ladspaManager::addPlugins( -Uint16 ladspaManager::getPluginInputs( +uint16_t ladspaManager::getPluginInputs( const LADSPA_Descriptor * _descriptor ) { - Uint16 inputs = 0; + uint16_t inputs = 0; - for( Uint16 port = 0; port < _descriptor->PortCount; port++ ) + for( uint16_t port = 0; port < _descriptor->PortCount; port++ ) { if( LADSPA_IS_PORT_INPUT( _descriptor->PortDescriptors[port] ) && @@ -207,12 +208,12 @@ Uint16 ladspaManager::getPluginInputs( -Uint16 ladspaManager::getPluginOutputs( +uint16_t ladspaManager::getPluginOutputs( const LADSPA_Descriptor * _descriptor ) { - Uint16 outputs = 0; + uint16_t outputs = 0; - for( Uint16 port = 0; port < _descriptor->PortCount; port++ ) + for( uint16_t port = 0; port < _descriptor->PortCount; port++ ) { if( LADSPA_IS_PORT_OUTPUT( _descriptor->PortDescriptors[port] ) && @@ -383,7 +384,7 @@ QString ladspaManager::getCopyright( const ladspa_key_t & _plugin ) -Uint32 ladspaManager::getPortCount( const ladspa_key_t & _plugin ) +uint32_t ladspaManager::getPortCount( const ladspa_key_t & _plugin ) { if( m_ladspaManagerMap.contains( _plugin ) ) { @@ -404,7 +405,7 @@ Uint32 ladspaManager::getPortCount( const ladspa_key_t & _plugin ) bool ladspaManager::isPortInput( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -428,7 +429,7 @@ bool ladspaManager::isPortInput( const ladspa_key_t & _plugin, bool ladspaManager::isPortOutput( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -452,7 +453,7 @@ bool ladspaManager::isPortOutput( const ladspa_key_t & _plugin, bool ladspaManager::isPortAudio( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -476,7 +477,7 @@ bool ladspaManager::isPortAudio( const ladspa_key_t & _plugin, bool ladspaManager::isPortControl( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -501,7 +502,7 @@ bool ladspaManager::isPortControl( const ladspa_key_t & _plugin, bool ladspaManager::areHintsSampleRateDependent( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -525,7 +526,7 @@ bool ladspaManager::areHintsSampleRateDependent( float ladspaManager::getLowerBound( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -555,7 +556,7 @@ float ladspaManager::getLowerBound( const ladspa_key_t & _plugin, -float ladspaManager::getUpperBound( const ladspa_key_t & _plugin, Uint32 _port ) +float ladspaManager::getUpperBound( const ladspa_key_t & _plugin, uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -586,7 +587,7 @@ float ladspaManager::getUpperBound( const ladspa_key_t & _plugin, Uint32 bool ladspaManager::isPortToggled( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -610,7 +611,7 @@ bool ladspaManager::isPortToggled( const ladspa_key_t & _plugin, float ladspaManager::getDefaultSetting( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -697,7 +698,7 @@ float ladspaManager::getDefaultSetting( const ladspa_key_t & _plugin, bool ladspaManager::isLogarithmic( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -721,7 +722,7 @@ bool ladspaManager::isLogarithmic( const ladspa_key_t & _plugin, bool ladspaManager::isInteger( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -745,7 +746,7 @@ bool ladspaManager::isInteger( const ladspa_key_t & _plugin, QString ladspaManager::getPortName( const ladspa_key_t & _plugin, - Uint32 _port ) + uint32_t _port ) { if( m_ladspaManagerMap.contains( _plugin ) && _port < getPortCount( _plugin ) ) @@ -811,7 +812,7 @@ const LADSPA_Descriptor * ladspaManager::getDescriptor( LADSPA_Handle ladspaManager::instantiate( const ladspa_key_t & _plugin, - Uint32 _sample_rate ) + uint32_t _sample_rate ) { if( m_ladspaManagerMap.contains( _plugin ) ) { @@ -834,7 +835,7 @@ LADSPA_Handle ladspaManager::instantiate( bool ladspaManager::connectPort( const ladspa_key_t & _plugin, LADSPA_Handle _instance, - Uint32 _port, + uint32_t _port, LADSPA_Data * _data_location ) { if( m_ladspaManagerMap.contains( _plugin ) @@ -882,7 +883,7 @@ bool ladspaManager::activate( const ladspa_key_t & _plugin, bool ladspaManager::run( const ladspa_key_t & _plugin, LADSPA_Handle _instance, - Uint32 _sample_count ) + uint32_t _sample_count ) { if( m_ladspaManagerMap.contains( _plugin ) ) { @@ -905,7 +906,7 @@ bool ladspaManager::run( const ladspa_key_t & _plugin, bool ladspaManager::runAdding( const ladspa_key_t & _plugin, LADSPA_Handle _instance, - Uint32 _sample_count ) + uint32_t _sample_count ) { if( m_ladspaManagerMap.contains( _plugin ) ) { diff --git a/src/core/midi/MidiAlsaRaw.cpp b/src/core/midi/MidiAlsaRaw.cpp index 7d8fcbad7..a55669204 100644 --- a/src/core/midi/MidiAlsaRaw.cpp +++ b/src/core/midi/MidiAlsaRaw.cpp @@ -1,7 +1,7 @@ /* - * MidiAlsaRaw.cpp - midi-client for RawMIDI via ALSA + * MidiAlsaRaw.cpp - MIDI client for RawMIDI via ALSA * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -95,9 +95,9 @@ QString MidiAlsaRaw::probeDevice() -void MidiAlsaRaw::sendByte( Uint8 _c ) +void MidiAlsaRaw::sendByte( unsigned char c ) { - snd_rawmidi_write( m_output, &_c, sizeof( _c ) ); + snd_rawmidi_write( m_output, &c, sizeof( c ) ); } @@ -105,7 +105,7 @@ void MidiAlsaRaw::sendByte( Uint8 _c ) void MidiAlsaRaw::run() { - Uint8 buf[128]; + unsigned char buf[128]; //int cnt = 0; while( m_quit == false ) { diff --git a/src/core/midi/MidiAlsaSeq.cpp b/src/core/midi/MidiAlsaSeq.cpp index bd79888a7..9cd02d01b 100644 --- a/src/core/midi/MidiAlsaSeq.cpp +++ b/src/core/midi/MidiAlsaSeq.cpp @@ -1,7 +1,7 @@ /* * MidiAlsaSeq.cpp - ALSA sequencer client * - * Copyright (c) 2005-2013 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -174,8 +174,7 @@ void MidiAlsaSeq::processOutEvent( const midiEvent & _me, snd_seq_ev_set_source( &ev, ( m_portIDs[p][1] != -1 ) ? m_portIDs[p][1] : m_portIDs[p][0] ); snd_seq_ev_set_subs( &ev ); - snd_seq_ev_schedule_tick( &ev, m_queueID, 1, - static_cast( _time ) ); + snd_seq_ev_schedule_tick( &ev, m_queueID, 1, static_cast( _time ) ); ev.queue = m_queueID; switch( _me.m_type ) { diff --git a/src/core/midi/MidiClient.cpp b/src/core/midi/MidiClient.cpp index 744a280f7..8e3895d24 100644 --- a/src/core/midi/MidiClient.cpp +++ b/src/core/midi/MidiClient.cpp @@ -1,7 +1,7 @@ /* * MidiClient.cpp - base-class for MIDI-clients like ALSA-sequencer-client * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * This file partly contains code from Fluidsynth, Peter Hanappe * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net @@ -110,7 +110,7 @@ MidiClientRaw::~MidiClientRaw() -void MidiClientRaw::parseData( const Uint8 _c ) +void MidiClientRaw::parseData( const unsigned char c ) { /*********************************************************************/ /* 'Process' system real-time messages */ @@ -120,9 +120,9 @@ void MidiClientRaw::parseData( const Uint8 _c ) * Real-time range: 0xF8 .. 0xFF * Note: Real-time does not affect (running) status. */ - if( _c >= 0xF8 ) + if( c >= 0xF8 ) { - if( _c == MidiSystemReset ) + if( c == MidiSystemReset ) { m_midiParseData.m_midiEvent.m_type = MidiSystemReset; m_midiParseData.m_status = 0; @@ -137,7 +137,7 @@ void MidiClientRaw::parseData( const Uint8 _c ) /* There are no system common messages that are of interest here. * System common range: 0xF0 .. 0xF7 */ - if( _c > 0xF0 ) + if( c > 0xF0 ) { /* MIDI spec say: To ignore a non-real-time message, just discard all * data up to the next status byte. And our parser will ignore data @@ -157,14 +157,13 @@ void MidiClientRaw::parseData( const Uint8 _c ) * as soon as a byte >= 0x80 comes in, we are dealing with a status byte * and start a new event. */ - if( _c & 0x80 ) + if( c & 0x80 ) { - m_midiParseData.m_channel = _c & 0x0F; - m_midiParseData.m_status = _c & 0xF0; + m_midiParseData.m_channel = c & 0x0F; + m_midiParseData.m_status = c & 0xF0; /* The event consumes x bytes of data... (subtract 1 for the status byte) */ - m_midiParseData.m_bytesTotal = eventLength( - m_midiParseData.m_status ) - 1; + m_midiParseData.m_bytesTotal = eventLength( m_midiParseData.m_status ) - 1; /* of which we have read 0 at this time. */ m_midiParseData.m_bytes = 0; return; @@ -185,7 +184,7 @@ void MidiClientRaw::parseData( const Uint8 _c ) /* Store the first couple of bytes */ if( m_midiParseData.m_bytes < RAW_MIDI_PARSE_BUF_SIZE ) { - m_midiParseData.m_buffer[m_midiParseData.m_bytes] = _c; + m_midiParseData.m_buffer[m_midiParseData.m_bytes] = c; } ++m_midiParseData.m_bytes; @@ -207,8 +206,7 @@ void MidiClientRaw::parseData( const Uint8 _c ) * We simply keep the status as it is, just reset the parameter counter. * If another status byte comes in, it will overwrite the status. */ - m_midiParseData.m_midiEvent.m_type = static_cast( - m_midiParseData.m_status ); + m_midiParseData.m_midiEvent.m_type = static_cast( m_midiParseData.m_status ); m_midiParseData.m_midiEvent.m_channel = m_midiParseData.m_channel; m_midiParseData.m_bytes = 0; /* Related to running status! */ switch( m_midiParseData.m_midiEvent.m_type ) @@ -290,7 +288,7 @@ void MidiClientRaw::processOutEvent( const midiEvent & _me, // Taken from Nagano Daisuke's USB-MIDI driver -static const Uint8 REMAINS_F0F6[] = +static const unsigned char REMAINS_F0F6[] = { 0, /* 0xF0 */ 2, /* 0XF1 */ @@ -301,7 +299,7 @@ static const Uint8 REMAINS_F0F6[] = 1 /* 0XF6 */ } ; -static const Uint8 REMAINS_80E0[] = +static const unsigned char REMAINS_80E0[] = { 3, /* 0x8X Note Off */ 3, /* 0x9X Note On */ @@ -316,15 +314,15 @@ static const Uint8 REMAINS_80E0[] = // Returns the length of the MIDI message starting with _event. // Taken from Nagano Daisuke's USB-MIDI driver -Uint8 MidiClientRaw::eventLength( const Uint8 _event ) +int MidiClientRaw::eventLength( const unsigned char event ) { - if ( _event < 0xF0 ) + if ( event < 0xF0 ) { - return REMAINS_80E0[( ( _event - 0x80 ) >> 4 ) & 0x0F]; + return REMAINS_80E0[( ( event - 0x80 ) >> 4 ) & 0x0F]; } - else if ( _event < 0xF7 ) + else if ( event < 0xF7 ) { - return REMAINS_F0F6[_event - 0xF0]; + return REMAINS_F0F6[event - 0xF0]; } return 1; } diff --git a/src/core/midi/MidiController.cpp b/src/core/midi/MidiController.cpp index 7e12cad98..d323e6e7f 100644 --- a/src/core/midi/MidiController.cpp +++ b/src/core/midi/MidiController.cpp @@ -76,7 +76,7 @@ void MidiController::updateName() void MidiController::processInEvent( const midiEvent & _me, const midiTime & _time ) { - Uint8 controllerNum; + unsigned char controllerNum; switch( _me.m_type ) { case MidiControlChange: @@ -86,7 +86,7 @@ void MidiController::processInEvent( const midiEvent & _me, ( m_midiPort.inputChannel() == _me.m_channel + 1 || m_midiPort.inputChannel() == 0 ) ) { - Uint8 val = _me.m_data.m_bytes[2] & 0x7F; + unsigned char val = _me.m_data.m_bytes[2] & 0x7F; m_lastValue = (float)( val ) / 127.0f; emit valueChanged(); } diff --git a/src/core/midi/MidiOss.cpp b/src/core/midi/MidiOss.cpp index 1ece30c83..066490cec 100644 --- a/src/core/midi/MidiOss.cpp +++ b/src/core/midi/MidiOss.cpp @@ -89,9 +89,9 @@ QString MidiOss::probeDevice() -void MidiOss::sendByte( const Uint8 _c ) +void MidiOss::sendByte( const unsigned char c ) { - m_midiDev.putChar( _c ); + m_midiDev.putChar( c ); } diff --git a/src/core/mmp.cpp b/src/core/mmp.cpp index adc438fdf..2eca85c7d 100644 --- a/src/core/mmp.cpp +++ b/src/core/mmp.cpp @@ -1,7 +1,7 @@ /* * mmp.cpp - implementation of class multimediaProject * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * Copyright (c) 2012-2013 Paul Giblock

* * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -179,27 +180,25 @@ void multimediaProject::write( QTextStream & _strm ) -bool multimediaProject::writeFile( const QString & _fn ) +bool multimediaProject::writeFile( const QString& filename ) { - QString fn = nameWithExtension( _fn ); - QFile outfile( fn ); + const QString fullName = nameWithExtension( filename ); + const QString fullNameTemp = fullName + ".new"; + const QString fullNameBak = fullName + ".bak"; + + QFile outfile( fullNameTemp ); + if( !outfile.open( QIODevice::WriteOnly | QIODevice::Truncate ) ) { QMessageBox::critical( NULL, - songEditor::tr( "Could not write file" ), - songEditor::tr( "Could not write file " - "%1. You probably are " - "not permitted to " - "write to this file.\n" - "Please make sure you " - "have write-access to " - "the file and try " - "again." - ).arg( fn ) ); + songEditor::tr( "Could not write file" ), + songEditor::tr( "Could not open %1 for writing. You probably are not permitted to " + "write to this file. Please make sure you have write-access to " + "the file and try again." ).arg( fullName ) ); return false; } - if( fn.section( '.', -1 ) == "mmpz" ) + if( fullName.section( '.', -1 ) == "mmpz" ) { QString xml; QTextStream ts( &xml ); @@ -211,9 +210,23 @@ bool multimediaProject::writeFile( const QString & _fn ) QTextStream ts( &outfile ); write( ts ); } + outfile.close(); - return true; + // make sure the file has been written correctly + if( QFileInfo( outfile.fileName() ).size() > 0 ) + { + // remove old backup file + QFile::remove( fullNameBak ); + // move current file to backup file + QFile::rename( fullName, fullNameBak ); + // move temporary file to current file + QFile::rename( fullNameTemp, fullName ); + + return true; + } + + return false; } diff --git a/src/core/note.cpp b/src/core/note.cpp index 7307fd461..4739562b1 100644 --- a/src/core/note.cpp +++ b/src/core/note.cpp @@ -56,10 +56,6 @@ note::note( const midiTime & _length, const midiTime & _pos, { m_detuning = sharedObject::ref( _detuning ); } - else - { - createDetuning(); - } //restoreJournallingState(); } @@ -84,10 +80,6 @@ note::note( const note & _note ) : { m_detuning = sharedObject::ref( _note.m_detuning ); } - else - { - createDetuning(); - } } @@ -192,7 +184,8 @@ void note::saveSettings( QDomDocument & _doc, QDomElement & _this ) _this.setAttribute( "pan", m_panning ); _this.setAttribute( "len", m_length ); _this.setAttribute( "pos", m_pos ); - if( m_length > 0 ) + + if( m_detuning && m_length ) { m_detuning->saveSettings( _doc, _this ); } @@ -203,15 +196,16 @@ void note::saveSettings( QDomDocument & _doc, QDomElement & _this ) void note::loadSettings( const QDomElement & _this ) { - const int old_key = _this.attribute( "tone" ).toInt() + - _this.attribute( "oct" ).toInt() * KeysPerOctave; - m_key = qMax( old_key, _this.attribute( "key" ).toInt() ); + const int oldKey = _this.attribute( "tone" ).toInt() + _this.attribute( "oct" ).toInt() * KeysPerOctave; + m_key = qMax( oldKey, _this.attribute( "key" ).toInt() ); m_volume = _this.attribute( "vol" ).toInt(); m_panning = _this.attribute( "pan" ).toInt(); m_length = _this.attribute( "len" ).toInt(); m_pos = _this.attribute( "pos" ).toInt(); + if( _this.hasChildNodes() ) { + createDetuning(); m_detuning->loadSettings( _this ); } } @@ -261,6 +255,7 @@ void note::redoStep( journalEntry & _je ) void note::editDetuningPattern() { + createDetuning(); m_detuning->automationPattern()->openInAutomationEditor(); } @@ -269,11 +264,13 @@ void note::editDetuningPattern() void note::createDetuning() { - m_detuning = new DetuningHelper; - (void) m_detuning->automationPattern(); - m_detuning->setRange( -MaxDetuning, MaxDetuning, 0.1f ); - m_detuning->automationPattern()->setProgressionType( - AutomationPattern::LinearProgression ); + if( m_detuning == NULL ) + { + m_detuning = new DetuningHelper; + (void) m_detuning->automationPattern(); + m_detuning->setRange( -MaxDetuning, MaxDetuning, 0.1f ); + m_detuning->automationPattern()->setProgressionType( AutomationPattern::LinearProgression ); + } } diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index a8f0604fd..9654cde23 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -34,8 +34,7 @@ notePlayHandle::BaseDetuning::BaseDetuning( DetuningHelper *detuning ) : - m_detuning( detuning ), - m_value( m_detuning->automationPattern()->valueAt( 0 ) ) + m_value( detuning ? detuning->automationPattern()->valueAt( 0 ) : 0 ) { } @@ -503,12 +502,11 @@ void notePlayHandle::updateFrequency() -void notePlayHandle::processMidiTime( const midiTime & _time ) +void notePlayHandle::processMidiTime( const midiTime& time ) { - if( _time >= songGlobalParentOffset()+pos() ) + if( detuning() && time >= songGlobalParentOffset()+pos() ) { - const float v = detuning()->automationPattern()-> - valueAt( _time - songGlobalParentOffset() - pos() ); + const float v = detuning()->automationPattern()->valueAt( time - songGlobalParentOffset() - pos() ); if( !typeInfo::isEqual( v, m_baseDetuning->value() ) ) { m_baseDetuning->setValue( v ); diff --git a/src/core/timeline.cpp b/src/core/timeline.cpp index 11aed487f..a517fb1e9 100644 --- a/src/core/timeline.cpp +++ b/src/core/timeline.cpp @@ -238,9 +238,7 @@ void timeLine::paintEvent( QPaintEvent * ) tact_t tact_num = m_begin.getTact(); int x = m_xOffset + s_posMarkerPixmap->width() / 2 - - ( ( static_cast( m_begin * m_ppt ) / - midiTime::ticksPerTact() ) % - static_cast( m_ppt ) ); + ( ( static_cast( m_begin * m_ppt ) / midiTime::ticksPerTact() ) % static_cast( m_ppt ) ); p.setPen( QColor( 192, 192, 192 ) ); for( int i = 0; x + i * m_ppt < width(); ++i ) @@ -287,9 +285,7 @@ void timeLine::mousePressEvent( QMouseEvent * _me ) } else { - const midiTime t = m_begin + - static_cast( _me->x() * - midiTime::ticksPerTact() / m_ppt ); + const midiTime t = m_begin + static_cast( _me->x() * midiTime::ticksPerTact() / m_ppt ); m_action = MoveLoopBegin; if( m_loopPos[0] > m_loopPos[1] ) { @@ -317,9 +313,8 @@ void timeLine::mousePressEvent( QMouseEvent * _me ) void timeLine::mouseMoveEvent( QMouseEvent * _me ) { - const midiTime t = m_begin + static_cast( qMax( _me->x() - - m_xOffset - m_moveXOff, 0 ) * - midiTime::ticksPerTact() / m_ppt ); + const midiTime t = m_begin + static_cast( qMax( _me->x() - m_xOffset - m_moveXOff, 0 ) * midiTime::ticksPerTact() / m_ppt ); + switch( m_action ) { case MovePositionMarker: @@ -332,7 +327,7 @@ void timeLine::mouseMoveEvent( QMouseEvent * _me ) case MoveLoopBegin: case MoveLoopEnd: { - const Uint8 i = m_action - MoveLoopBegin; + const int i = m_action - MoveLoopBegin; if( _me->modifiers() & Qt::ControlModifier ) { // no ctrl-press-hint when having ctrl pressed diff --git a/src/core/track.cpp b/src/core/track.cpp index 15c7e32a7..10a4ed80f 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -73,12 +73,12 @@ /*! The width of the resize grip in pixels */ -const Sint16 RESIZE_GRIP_WIDTH = 4; +const int RESIZE_GRIP_WIDTH = 4; /*! The size of the track buttons in pixels */ -const Uint16 TRACK_OP_BTN_WIDTH = 20; -const Uint16 TRACK_OP_BTN_HEIGHT = 14; +const int TRACK_OP_BTN_WIDTH = 20; +const int TRACK_OP_BTN_HEIGHT = 14; /*! A pointer for that text bubble used when moving segments, etc. @@ -713,13 +713,10 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me ) } else if( m_action == Resize ) { - midiTime t = qMax( midiTime::ticksPerTact(), - static_cast( _me->x() * - midiTime::ticksPerTact() / ppt ) ); - if( ! ( _me->modifiers() & Qt::ControlModifier ) - && _me->button() == Qt::NoButton ) + midiTime t = qMax( midiTime::ticksPerTact() / 16, static_cast( _me->x() * midiTime::ticksPerTact() / ppt ) ); + if( ! ( _me->modifiers() & Qt::ControlModifier ) && _me->button() == Qt::NoButton ) { - t = t.toNearestTact(); + t = qMax( midiTime::ticksPerTact(), t.toNearestTact() ); } m_tco->changeLength( t ); s_textFloat->setText( tr( "%1:%2 (%3:%4 to %5:%6)" ). @@ -1657,7 +1654,7 @@ void track::clone() /*! \brief Save this track's settings to file * - * We save the track type and its muted state, then append the track- + * We save the track type and its muted state and solo state, then append the track- * specific settings. Then we iterate through the trackContentObjects * and save all their states in turn. * @@ -1675,6 +1672,7 @@ void track::saveSettings( QDomDocument & _doc, QDomElement & _this ) _this.setAttribute( "type", type() ); _this.setAttribute( "name", name() ); _this.setAttribute( "muted", isMuted() ); + _this.setAttribute( "solo", isSolo() ); if( m_height >= MINIMAL_TRACK_HEIGHT ) { _this.setAttribute( "height", m_height ); @@ -1705,7 +1703,7 @@ void track::saveSettings( QDomDocument & _doc, QDomElement & _this ) /*! \brief Load the settings from a file * - * We load the track's type and muted state, then clear out our + * We load the track's type and muted state and solo state, then clear out our * current trackContentObject. * * Then we step through the QDomElement's children and load the @@ -1727,6 +1725,7 @@ void track::loadSettings( const QDomElement & _this ) _this.firstChild().toElement().attribute( "name" ) ); setMuted( _this.attribute( "muted" ).toInt() ); + setSolo( _this.attribute( "solo" ).toInt() ); if( m_simpleSerializingMode ) { diff --git a/src/gui/AutomatableModelView.cpp b/src/gui/AutomatableModelView.cpp index bf035ad35..e60d0429a 100644 --- a/src/gui/AutomatableModelView.cpp +++ b/src/gui/AutomatableModelView.cpp @@ -102,9 +102,9 @@ void AutomatableModelView::addDefaultActions( QMenu* menu ) } QString controllerTxt; - if( model->getControllerConnection() ) + if( model->controllerConnection() ) { - Controller* cont = model->getControllerConnection()->getController(); + Controller* cont = model->controllerConnection()->getController(); if( cont ) { controllerTxt = AutomatableModel::tr( "Connected to %1" ).arg( cont->name() ); @@ -185,9 +185,9 @@ void AutomatableModelViewSlots::execConnectionDialog() if( d.chosenController() ) { // Update - if( m->getControllerConnection() ) + if( m->controllerConnection() ) { - m->getControllerConnection()->setController( d.chosenController() ); + m->controllerConnection()->setController( d.chosenController() ); } // New else @@ -212,9 +212,9 @@ void AutomatableModelViewSlots::removeConnection() { AutomatableModel* m = m_amv->modelUntyped(); - if( m->getControllerConnection() ) + if( m->controllerConnection() ) { - delete m->getControllerConnection(); + delete m->controllerConnection(); m->setControllerConnection( NULL ); } } diff --git a/src/gui/AutomationEditor.cpp b/src/gui/AutomationEditor.cpp index 55381d8b1..ce3847f0e 100644 --- a/src/gui/AutomationEditor.cpp +++ b/src/gui/AutomationEditor.cpp @@ -1529,10 +1529,10 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe ) if( validPattern() ) { - Sint32 len_ticks = 4; + int len_ticks = 4; timeMap & time_map = m_pattern->getTimeMap(); timeMap::iterator it = time_map.begin(); - p.setPen( QColor( 0xFF, 0xDF, 0x20 ) ); + p.setPen( QColor( 0xCF, 0xD9, 0xFF ) ); while( it+1 != time_map.end() ) { @@ -1603,7 +1603,7 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe ) QFont f = p.font(); f.setBold( TRUE ); p.setFont( pointSize<14>( f ) ); - p.setPen( QColor( 0, 255, 0 ) ); + p.setPen( QColor( 74, 253, 133 ) ); p.drawText( VALUES_WIDTH + 20, TOP_MARGIN + 40, width() - VALUES_WIDTH - 20 - SCROLLBAR_SIZE, grid_height - 40, Qt::TextWordWrap, @@ -1722,7 +1722,7 @@ void AutomationEditor::drawLevelTick( QPainter & _p, int _tick, float _level, rect_height = (int)( _level * m_y_delta ); } - QColor current_color( 0xFF, 0xB0, 0x00 ); + QColor current_color( 0x9F, 0xAF, 0xFF ); if( _is_selected == TRUE ) { current_color.setRgb( 0x00, 0x40, 0xC0 ); diff --git a/src/gui/AutomationPatternView.cpp b/src/gui/AutomationPatternView.cpp index 3d2638c94..c4d260c53 100644 --- a/src/gui/AutomationPatternView.cpp +++ b/src/gui/AutomationPatternView.cpp @@ -199,9 +199,9 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) QLinearGradient lingrad( 0, 0, 0, height() ); const QColor c = isSelected() ? QColor( 0, 0, 224 ) : QColor( 96, 96, 96 ); - lingrad.setColorAt( 0, c ); - lingrad.setColorAt( 0.5, Qt::black ); - lingrad.setColorAt( 1, c ); + lingrad.setColorAt( 0, QColor(16, 16, 16) ); + lingrad.setColorAt( 0.5, c ); + lingrad.setColorAt( 1, QColor(16, 16, 16) ); p.setBrush( lingrad ); p.setPen( QColor( 0, 0, 0 ) ); p.drawRect( QRect( 0, 0, width() - 1, height() - 1 ) ); @@ -235,8 +235,8 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) p.scale( 1.0f, -h ); QLinearGradient lin2grad( 0, min, 0, max ); - const QColor cl = QColor( 255, 224, 0 ); - const QColor cd = QColor( 229, 158, 0 ); + const QColor cl = QColor( 0xCF, 0xDA, 0xFF ); + const QColor cd = QColor( 0x99, 0xAF, 0xFF ); lin2grad.setColorAt( 1, cl ); lin2grad.setColorAt( 0, cd ); diff --git a/src/gui/ControllerConnectionDialog.cpp b/src/gui/ControllerConnectionDialog.cpp index 9a415045a..5e2903f68 100644 --- a/src/gui/ControllerConnectionDialog.cpp +++ b/src/gui/ControllerConnectionDialog.cpp @@ -49,8 +49,8 @@ class AutoDetectMidiController : public MidiController { public: - AutoDetectMidiController( Model * _parent ) : - MidiController( _parent ), + AutoDetectMidiController( Model* parent ) : + MidiController( parent ), m_detectedMidiChannel( 0 ), m_detectedMidiController( 0 ) { @@ -63,17 +63,14 @@ public: } - virtual void processInEvent( const midiEvent & _me, - const midiTime & _time ) + virtual void processInEvent( const midiEvent& event, const midiTime& time ) { - if( _me.m_type == MidiControlChange && - ( m_midiPort.inputChannel() == _me.m_channel + 1 || - m_midiPort.inputChannel() == 0 ) ) + if( event.m_type == MidiControlChange && + ( m_midiPort.inputChannel() == event.m_channel + 1 || m_midiPort.inputChannel() == 0 ) ) { - m_detectedMidiChannel = _me.m_channel + 1; - m_detectedMidiController = ( _me.m_data.m_bytes[0] & 0x7F ) + 1; - m_detectedMidiPort = - engine::mixer()->midiClient()->sourcePortName( _me ); + m_detectedMidiChannel = event.m_channel + 1; + m_detectedMidiController = ( event.m_data.m_bytes[0] & 0x7F ) + 1; + m_detectedMidiPort = engine::mixer()->midiClient()->sourcePortName( event ); emit valueChanged(); } @@ -82,9 +79,9 @@ public: // Would be a nice copy ctor, but too hard to add copy ctor because // model has none. - MidiController * copyToMidiController( Model * _parent ) + MidiController* copyToMidiController( Model* parent ) { - MidiController * c = new MidiController( _parent ); + MidiController* c = new MidiController( parent ); c->m_midiPort.setInputChannel( m_midiPort.inputChannel() ); c->m_midiPort.setInputController( m_midiPort.inputController() ); c->subscribeReadablePorts( m_midiPort.readablePorts() ); @@ -98,12 +95,12 @@ public: { m_midiPort.setInputChannel( m_detectedMidiChannel ); m_midiPort.setInputController( m_detectedMidiController ); - MidiPort::Map map = m_midiPort.readablePorts(); - for( MidiPort::Map::Iterator it = map.begin(); it != map.end(); ++it ) + + const MidiPort::Map& map = m_midiPort.readablePorts(); + for( MidiPort::Map::ConstIterator it = map.begin(); it != map.end(); ++it ) { m_midiPort.subscribeReadablePort( it.key(), - m_detectedMidiPort.isEmpty() || - ( it.key() == m_detectedMidiPort ) ); + m_detectedMidiPort.isEmpty() || ( it.key() == m_detectedMidiPort ) ); } } @@ -243,31 +240,25 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent, ControllerConnection * cc = NULL; if( m_targetModel ) { - cc = m_targetModel->getControllerConnection(); + cc = m_targetModel->controllerConnection(); - if( cc && cc->getController()->type() != - Controller::DummyController && engine::getSong() ) + if( cc && cc->getController()->type() != Controller::DummyController && engine::getSong() ) { - if ( cc->getController()->type() == - Controller::MidiController ) + if ( cc->getController()->type() == Controller::MidiController ) { m_midiGroupBox->model()->setValue( true ); // ensure controller is created midiToggled(); - MidiController * cont = - (MidiController*)( cc->getController() ); - m_midiChannelSpinBox->model()->setValue( - cont->m_midiPort.inputChannel() ); - m_midiControllerSpinBox->model()->setValue( - cont->m_midiPort.inputController() ); + MidiController * cont = (MidiController*)( cc->getController() ); + m_midiChannelSpinBox->model()->setValue( cont->m_midiPort.inputChannel() ); + m_midiControllerSpinBox->model()->setValue( cont->m_midiPort.inputController() ); m_midiController->subscribeReadablePorts( static_cast( cc->getController() )->m_midiPort.readablePorts() ); } else { - int idx = engine::getSong()->controllers().indexOf( - cc->getController() ); + int idx = engine::getSong()->controllers().indexOf( cc->getController() ); if( idx >= 0 ) { @@ -293,8 +284,7 @@ ControllerConnectionDialog::~ControllerConnectionDialog() { delete m_readablePorts; - if( m_midiController ) - delete m_midiController; + delete m_midiController; } @@ -308,8 +298,7 @@ void ControllerConnectionDialog::selectController() if( m_midiControllerSpinBox->model()->value() > 0 ) { MidiController * mc; - mc = m_midiController->copyToMidiController( - engine::getSong() ); + mc = m_midiController->copyToMidiController( engine::getSong() ); /* if( m_targetModel->getTrack() && @@ -367,24 +356,21 @@ void ControllerConnectionDialog::midiToggled() m_midiController = new AutoDetectMidiController( engine::getSong() ); MidiPort::Map map = m_midiController->m_midiPort.readablePorts(); - for( MidiPort::Map::Iterator it = map.begin(); - it != map.end(); ++it ) + for( MidiPort::Map::Iterator it = map.begin(); it != map.end(); ++it ) { it.value() = true; } m_midiController->subscribeReadablePorts( map ); - m_midiChannelSpinBox->setModel( - &m_midiController->m_midiPort.m_inputChannelModel ); - m_midiControllerSpinBox->setModel( - &m_midiController->m_midiPort.m_inputControllerModel ); + m_midiChannelSpinBox->setModel( &m_midiController->m_midiPort.m_inputChannelModel ); + m_midiControllerSpinBox->setModel( &m_midiController->m_midiPort.m_inputControllerModel ); + if( m_readablePorts ) { m_readablePorts->setModel( &m_midiController->m_midiPort ); } - connect( m_midiController, SIGNAL( valueChanged() ), - this, SLOT( midiValueChanged() ) ); + connect( m_midiController, SIGNAL( valueChanged() ), this, SLOT( midiValueChanged() ) ); } } m_midiAutoDetect.setValue( enabled ); diff --git a/src/gui/InstrumentView.cpp b/src/gui/InstrumentView.cpp index e822529e4..20880206f 100644 --- a/src/gui/InstrumentView.cpp +++ b/src/gui/InstrumentView.cpp @@ -1,7 +1,7 @@ /* * InstrumentView.cpp - base-class for views of all Instruments * - * Copyright (c) 2008-2009 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -22,6 +22,8 @@ * */ +#include + #include "InstrumentView.h" #include "embed.h" #include "Instrument.h" @@ -56,10 +58,8 @@ void InstrumentView::setModel( Model * _model, bool ) if( dynamic_cast( _model ) != NULL ) { ModelView::setModel( _model ); - instrumentTrackWindow()->setWindowIcon( - model()->descriptor()->logo->pixmap() ); - connect( model(), SIGNAL( destroyed( QObject * ) ), - this, SLOT( close() ) ); + instrumentTrackWindow()->setWindowIcon( model()->descriptor()->logo->pixmap() ); + connect( model(), SIGNAL( destroyed( QObject * ) ), this, SLOT( close() ) ); } } diff --git a/src/gui/LmmsStyle.cpp b/src/gui/LmmsStyle.cpp index 16a244ea7..8d3a15ab3 100644 --- a/src/gui/LmmsStyle.cpp +++ b/src/gui/LmmsStyle.cpp @@ -214,6 +214,7 @@ static QString getCacheKey( const QString & _key, } + LmmsStyle::LmmsStyle() : QPlastiqueStyle() { @@ -229,8 +230,12 @@ LmmsStyle::LmmsStyle() : QPalette LmmsStyle::standardPalette( void ) const { + QPalette pal = QPlastiqueStyle::standardPalette(); -/* pal.setColor( QPalette::Background, QColor( 91, 101, 113 ) ); + +/* sane defaults in case fetching from stylesheet fails*/ + + pal.setColor( QPalette::Background, QColor( 91, 101, 113 ) ); pal.setColor( QPalette::WindowText, QColor( 240, 240, 240 ) ); pal.setColor( QPalette::Base, QColor( 128, 128, 128 ) ); pal.setColor( QPalette::Text, QColor( 224, 224, 224 ) ); @@ -239,21 +244,23 @@ QPalette LmmsStyle::standardPalette( void ) const pal.setColor( QPalette::ButtonText, QColor( 0, 0, 0 ) ); pal.setColor( QPalette::BrightText, QColor( 74, 253, 133 ) ); pal.setColor( QPalette::Highlight, QColor( 100, 100, 100 ) ); - pal.setColor( QPalette::HighlightedText, QColor( 255, 255, 255 ) );*/ + pal.setColor( QPalette::HighlightedText, QColor( 255, 255, 255 ) ); + +/* fetch from stylesheet using regexp */ QStringList paletteData = qApp->styleSheet().split( '\n' ).filter( QRegExp( "^palette:*" ) ); foreach( QString s, paletteData ) { - if (s.contains("background")) { pal.setColor( QPalette::Background, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } - else if (s.contains("windowtext")) { pal.setColor( QPalette::WindowText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } - else if (s.contains("base")) { pal.setColor( QPalette::Base, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } - else if (s.contains("buttontext")) { pal.setColor( QPalette::ButtonText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } - else if (s.contains("brighttext")) { pal.setColor( QPalette::BrightText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } - else if (s.contains("text")) { pal.setColor( QPalette::Text, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } - else if (s.contains("button")) { pal.setColor( QPalette::Button, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } - else if (s.contains("shadow")) { pal.setColor( QPalette::Shadow, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } - else if (s.contains("highlightedtext")) { pal.setColor( QPalette::HighlightedText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } - else if (s.contains("highlight")) { pal.setColor( QPalette::Highlight, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }; + if (s.contains(":background")) { pal.setColor( QPalette::Background, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } + else if (s.contains(":windowtext")) { pal.setColor( QPalette::WindowText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } + else if (s.contains(":base")) { pal.setColor( QPalette::Base, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } + else if (s.contains(":buttontext")) { pal.setColor( QPalette::ButtonText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } + else if (s.contains(":brighttext")) { pal.setColor( QPalette::BrightText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } + else if (s.contains(":text")) { pal.setColor( QPalette::Text, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } + else if (s.contains(":button")) { pal.setColor( QPalette::Button, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } + else if (s.contains(":shadow")) { pal.setColor( QPalette::Shadow, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } + else if (s.contains(":highlightedtext")) { pal.setColor( QPalette::HighlightedText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); } + else if (s.contains(":highlight")) { pal.setColor( QPalette::Highlight, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }; } return( pal ); diff --git a/src/gui/PianoView.cpp b/src/gui/PianoView.cpp index 78800e37f..18a916a1e 100644 --- a/src/gui/PianoView.cpp +++ b/src/gui/PianoView.cpp @@ -444,7 +444,7 @@ void PianoView::mousePressEvent( QMouseEvent * _me ) if( _me->button() == Qt::LeftButton && m_piano != NULL ) { // get pressed key - Uint32 key_num = getKeyFromMouse( _me->pos() ); + int key_num = getKeyFromMouse( _me->pos() ); if( _me->pos().y() > PIANO_BASE ) { int y_diff = _me->pos().y() - PIANO_BASE; @@ -805,9 +805,12 @@ void PianoView::paintEvent( QPaintEvent * ) const int base_key = ( m_piano != NULL ) ? m_piano->instrumentTrack()->baseNoteModel()->value() : 0; - g.setColorAt( 0, QColor( 0, 96, 0 ) ); - g.setColorAt( 0.1, QColor( 64, 255, 64 ) ); - g.setColorAt( 1, QColor( 0, 96, 0 ) ); + g.setColorAt( 0, QApplication::palette().color( QPalette::Active, + QPalette::BrightText ).darker(220) ); + g.setColorAt( 0.1, QApplication::palette().color( QPalette::Active, + QPalette::BrightText ) ); + g.setColorAt( 1, QApplication::palette().color( QPalette::Active, + QPalette::BrightText ) ); if( KEY_ORDER[base_key % KeysPerOctave] == Piano::WhiteKey ) { p.fillRect( QRect( getKeyX( base_key ), 1, PW_WHITE_KEY_WIDTH-1, diff --git a/src/gui/bb_editor.cpp b/src/gui/bb_editor.cpp index 8045c8af1..e66e74da1 100644 --- a/src/gui/bb_editor.cpp +++ b/src/gui/bb_editor.cpp @@ -36,6 +36,9 @@ #include "tool_button.h" #include "config_mgr.h" +#include "TrackContainer.h" +#include "pattern.h" + bbEditor::bbEditor( bbTrackContainer* tc ) : @@ -93,6 +96,16 @@ bbEditor::bbEditor( bbTrackContainer* tc ) : tr( "Add automation-track" ), this, SLOT( addAutomationTrack() ), m_toolBar ); + toolButton * remove_bar = new toolButton( + embed::getIconPixmap( "step_btn_remove" ), + tr( "Remove steps" ), + this, SLOT( removeSteps() ), m_toolBar ); + + toolButton * add_bar = new toolButton( + embed::getIconPixmap( "step_btn_add" ), + tr( "Add steps" ), + this, SLOT( addSteps() ), m_toolBar ); + m_playButton->setWhatsThis( @@ -119,6 +132,8 @@ bbEditor::bbEditor( bbTrackContainer* tc ) : tb_layout->addWidget( add_bb_track ); tb_layout->addWidget( add_automation_track ); tb_layout->addStretch(); + tb_layout->addWidget( remove_bar ); + tb_layout->addWidget( add_bar ); tb_layout->addWidget( l ); tb_layout->addSpacing( 15 ); @@ -219,6 +234,44 @@ void bbEditor::addAutomationTrack() +void bbEditor::addSteps() +{ + TrackContainer::TrackList tl = model()->tracks(); + + for( TrackContainer::TrackList::iterator it = tl.begin(); + it != tl.end(); ++it ) + { + if( ( *it )->type() == track::InstrumentTrack ) + { + pattern * p = static_cast( + ( *it )->getTCO( m_bbtc->currentBB() ) ); + p->addSteps(); + } + } +} + + + + +void bbEditor::removeSteps() +{ + TrackContainer::TrackList tl = model()->tracks(); + + for( TrackContainer::TrackList::iterator it = tl.begin(); + it != tl.end(); ++it ) + { + if( ( *it )->type() == track::InstrumentTrack ) + { + pattern * p = static_cast( + ( *it )->getTCO( m_bbtc->currentBB() ) ); + p->removeSteps(); + } + } +} + + + + void bbEditor::keyPressEvent( QKeyEvent * _ke ) { if ( _ke->key() == Qt::Key_Space ) diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 6679120a1..be14b6da6 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -844,10 +844,9 @@ inline void pianoRoll::drawNoteRect( QPainter & _p, int _x, int _y, ( (float)( PanningRight - _n->getPanning() ) ) / ( (float)( PanningRight - PanningLeft ) ) * 2.0f ); - const QColor defaultNoteColor( 0x00, 0xAA, 0x00 ); + const QColor defaultNoteColor( 0x4A, 0xFD, 0x85 ); QColor col = defaultNoteColor; - col = QColor( 0x00, 0xAA, 0x00 ); if( _n->length() < 0 ) { //step note @@ -915,7 +914,7 @@ inline void pianoRoll::drawDetuningInfo( QPainter & _p, note * _n, int _x, int _y ) { int middle_y = _y + KEY_LINE_HEIGHT / 2; - _p.setPen( QColor( 0xFF, 0xDF, 0x20 ) ); + _p.setPen( QColor( 0x99, 0xAF, 0xFF ) ); int old_x = 0; int old_y = 0; @@ -923,7 +922,7 @@ inline void pianoRoll::drawDetuningInfo( QPainter & _p, note * _n, int _x, timeMap & map = _n->detuning()->automationPattern()->getTimeMap(); for( timeMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { - Sint32 pos_ticks = it.key(); + int pos_ticks = it.key(); if( pos_ticks > _n->length() ) { break; @@ -1969,7 +1968,7 @@ void pianoRoll::computeSelectedNotes(bool shift) ( *it )->setSelected( false ); } - Sint32 len_ticks = ( *it )->length(); + int len_ticks = ( *it )->length(); if( len_ticks == 0 ) { @@ -1982,7 +1981,7 @@ void pianoRoll::computeSelectedNotes(bool shift) const int key = ( *it )->key() - m_startKey + 1; - Sint32 pos_ticks = ( *it )->pos(); + int pos_ticks = ( *it )->pos(); // if the selection even barely overlaps the note if( key > sel_key_start && @@ -3032,7 +3031,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe ) for( NoteVector::ConstIterator it = notes.begin(); it != notes.end(); ++it ) { - Sint32 len_ticks = ( *it )->length(); + int len_ticks = ( *it )->length(); if( len_ticks == 0 ) { @@ -3045,7 +3044,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe ) const int key = ( *it )->key() - m_startKey + 1; - Sint32 pos_ticks = ( *it )->pos(); + int pos_ticks = ( *it )->pos(); int note_width = len_ticks * m_ppt / midiTime::ticksPerTact(); @@ -3130,7 +3129,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe ) QFont f = p.font(); f.setBold( true ); p.setFont( pointSize<14>( f ) ); - p.setPen( QColor( 0, 255, 0 ) ); + p.setPen( QColor( 0x4A, 0xFD, 0x85 ) ); p.drawText( WHITE_KEY_WIDTH + 20, PR_TOP_MARGIN + 40, tr( "Please open a pattern by double-clicking " "on it!" ) ); @@ -3523,16 +3522,15 @@ void pianoRoll::selectAll() // if first_time = true, we HAVE to set the vars for select bool first_time = true; - for( NoteVector::ConstIterator it = notes.begin(); it != notes.end(); - ++it ) + for( NoteVector::ConstIterator it = notes.begin(); it != notes.end(); ++it ) { - Uint32 len_ticks = ( *it )->length(); + int len_ticks = ( *it )->length(); if( len_ticks > 0 ) { const int key = ( *it )->key(); - Uint32 pos_ticks = ( *it )->pos(); + int pos_ticks = ( *it )->pos(); if( key <= m_selectStartKey || first_time ) { // if we move start-key down, we have to add diff --git a/src/gui/song_editor.cpp b/src/gui/song_editor.cpp index 929bdd0c0..60d7ed256 100644 --- a/src/gui/song_editor.cpp +++ b/src/gui/song_editor.cpp @@ -252,7 +252,7 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) : // fill own tool-bar - m_playButton = new toolButton( embed::getIconPixmap( "play", 24, 24 ), + m_playButton = new toolButton( embed::getIconPixmap( "play" ), tr( "Play song (Space)" ), this, SLOT( play() ), m_toolBar ); @@ -275,7 +275,7 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) : m_recordAccompanyButton->setDisabled( true ); } - m_stopButton = new toolButton( embed::getIconPixmap( "stop", 24, 24 ), + m_stopButton = new toolButton( embed::getIconPixmap( "stop" ), tr( "Stop song (Space)" ), this, SLOT( stop() ), m_toolBar ); @@ -286,13 +286,13 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) : m_toolBar ); m_addSampleTrackButton = new toolButton( embed::getIconPixmap( - "add_sample_track", 24, 24 ), + "add_sample_track" ), tr( "Add sample-track" ), m_s, SLOT( addSampleTrack() ), m_toolBar ); m_addAutomationTrackButton = new toolButton( embed::getIconPixmap( - "add_automation", 24, 24 ), + "add_automation" ), tr( "Add automation-track" ), m_s, SLOT( addAutomationTrack() ), m_toolBar ); diff --git a/src/gui/widgets/EffectRackView.cpp b/src/gui/widgets/EffectRackView.cpp index 31ab4411e..2112033d1 100644 --- a/src/gui/widgets/EffectRackView.cpp +++ b/src/gui/widgets/EffectRackView.cpp @@ -2,7 +2,7 @@ * EffectRackView.cpp - view for effectChain model * * Copyright (c) 2006-2007 Danny McRae - * Copyright (c) 2008-2011 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -35,36 +35,40 @@ #include "group_box.h" -EffectRackView::EffectRackView( EffectChain * _model, QWidget * _parent ) : - QWidget( _parent ), +EffectRackView::EffectRackView( EffectChain* model, QWidget* parent ) : + QWidget( parent ), ModelView( NULL, this ) { - setFixedSize( 250, 250 ); - - m_mainLayout = new QVBoxLayout( this ); - m_mainLayout->setSpacing( 0 ); - m_mainLayout->setMargin( 5 ); + QVBoxLayout* mainLayout = new QVBoxLayout( this ); + mainLayout->setMargin( 5 ); m_effectsGroupBox = new groupBox( tr( "EFFECTS CHAIN" ) ); - m_mainLayout->addWidget( m_effectsGroupBox ); + mainLayout->addWidget( m_effectsGroupBox ); - m_scrollArea = new QScrollArea( m_effectsGroupBox ); - m_scrollArea->setFixedSize( 230, 184 ); + QVBoxLayout* effectsLayout = new QVBoxLayout( m_effectsGroupBox ); + effectsLayout->setSpacing( 0 ); + effectsLayout->setContentsMargins( 2, 12, 2, 2 ); + + m_scrollArea = new QScrollArea; m_scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); m_scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_scrollArea->setPalette( QApplication::palette( m_scrollArea ) ); + m_scrollArea->setFrameStyle( QFrame::NoFrame ); m_scrollArea->setWidget( new QWidget ); - m_scrollArea->move( 6, 22 ); - QPushButton * addButton = new QPushButton( m_effectsGroupBox ); + effectsLayout->addWidget( m_scrollArea ); + + QPushButton* addButton = new QPushButton; addButton->setText( tr( "Add effect" ) ); - addButton->move( 8, 210 ); + + effectsLayout->addWidget( addButton ); + connect( addButton, SIGNAL( clicked() ), this, SLOT( addEffect() ) ); m_lastY = 0; - setModel( _model ); + setModel( model ); } @@ -91,26 +95,26 @@ void EffectRackView::clearViews() -void EffectRackView::moveUp( EffectView * _view ) +void EffectRackView::moveUp( EffectView* view ) { - fxChain()->moveUp( _view->effect() ); - if( _view != m_effectViews.first() ) + fxChain()->moveUp( view->effect() ); + if( view != m_effectViews.first() ) { int i = 0; for( QVector::Iterator it = m_effectViews.begin(); it != m_effectViews.end(); it++, i++ ) { - if( *it == _view ) + if( *it == view ) { break; } } - + EffectView * temp = m_effectViews[ i - 1 ]; - - m_effectViews[i - 1] = _view; + + m_effectViews[i - 1] = view; m_effectViews[i] = temp; - + update(); } } @@ -118,24 +122,23 @@ void EffectRackView::moveUp( EffectView * _view ) -void EffectRackView::moveDown( EffectView * _view ) +void EffectRackView::moveDown( EffectView* view ) { - if( _view != m_effectViews.last() ) + if( view != m_effectViews.last() ) { // moving next effect up is the same - moveUp( *( qFind( m_effectViews.begin(), m_effectViews.end(), _view ) + 1 ) ); + moveUp( *( qFind( m_effectViews.begin(), m_effectViews.end(), view ) + 1 ) ); } } -void EffectRackView::deletePlugin( EffectView * _view ) +void EffectRackView::deletePlugin( EffectView* view ) { - Effect * e = _view->effect(); - m_effectViews.erase( qFind( m_effectViews.begin(), m_effectViews.end(), - _view ) ); - delete _view; + Effect * e = view->effect(); + m_effectViews.erase( qFind( m_effectViews.begin(), m_effectViews.end(), view ) ); + delete view; fxChain()->removeEffect( e ); e->deleteLater(); update(); @@ -187,7 +190,11 @@ void EffectRackView::update() } } - int i = m_lastY = 0, nView = 0; + int i = 0, nView = 0; + + const int EffectViewMargin = 3; + m_lastY = EffectViewMargin; + for( QVector::Iterator it = m_effectViews.begin(); it != m_effectViews.end(); i++ ) { @@ -198,14 +205,14 @@ void EffectRackView::update() } else { - ( *it )->move( 0, m_lastY ); + ( *it )->move( EffectViewMargin, m_lastY ); m_lastY += ( *it )->height(); ++nView; ++it; } } - w->setFixedSize( 210, m_lastY ); + w->setFixedSize( 210 + 2*EffectViewMargin, m_lastY ); QWidget::update(); } @@ -251,8 +258,7 @@ void EffectRackView::modelChanged() { //clearViews(); m_effectsGroupBox->setModel( &fxChain()->m_enabledModel ); - connect( fxChain(), SIGNAL( aboutToClear() ), - this, SLOT( clearViews() ) ); + connect( fxChain(), SIGNAL( aboutToClear() ), this, SLOT( clearViews() ) ); update(); } diff --git a/src/gui/widgets/EnvelopeAndLfoView.cpp b/src/gui/widgets/EnvelopeAndLfoView.cpp index ae796f0d8..1ce05044c 100644 --- a/src/gui/widgets/EnvelopeAndLfoView.cpp +++ b/src/gui/widgets/EnvelopeAndLfoView.cpp @@ -425,7 +425,7 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * ) static_cast( 128 - 32 * gray_amount ) ), 2 ) ); - const QColor end_points_color( 0xFF, 0xBF, 0x22 ); + const QColor end_points_color( 0x99, 0xAF, 0xFF ); const QColor end_points_bg_color( 0, 0, 2 ); const int y_base = ENV_GRAPH_Y + s_envGraph->height() - 3; @@ -541,7 +541,7 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * ) old_y = cur_y; } - p.setPen( QColor( 255, 192, 0 ) ); + p.setPen( QColor( 201, 201, 225 ) ); int ms_per_osc = static_cast( SECS_PER_LFO_OSCILLATION * m_lfoSpeedKnob->value() * 1000.0f ); diff --git a/src/gui/widgets/InstrumentMidiIOView.cpp b/src/gui/widgets/InstrumentMidiIOView.cpp index f67cb0e7a..8c01179a7 100644 --- a/src/gui/widgets/InstrumentMidiIOView.cpp +++ b/src/gui/widgets/InstrumentMidiIOView.cpp @@ -1,7 +1,7 @@ /* * InstrumentMidiIOView.cpp - MIDI-IO-View * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -24,6 +24,7 @@ #include #include +#include #include "InstrumentMidiIOView.h" #include "MidiPortMenu.h" @@ -38,26 +39,34 @@ -InstrumentMidiIOView::InstrumentMidiIOView( QWidget * _parent ) : - QWidget( _parent ), +InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) : + QWidget( parent ), ModelView( NULL, this ), m_rpBtn( NULL ), m_wpBtn( NULL ) { - m_midiInputGroupBox = new groupBox( tr( "ENABLE MIDI INPUT" ), this ); - m_midiInputGroupBox->setGeometry( 4, 5, 242, 80 ); + QVBoxLayout* layout = new QVBoxLayout( this ); + layout->setMargin( 5 ); + m_midiInputGroupBox = new groupBox( tr( "ENABLE MIDI INPUT" ) ); + layout->addWidget( m_midiInputGroupBox ); + + QHBoxLayout* midiInputLayout = new QHBoxLayout( m_midiInputGroupBox ); + midiInputLayout->setContentsMargins( 8, 18, 8, 8 ); + midiInputLayout->setSpacing( 6 ); m_inputChannelSpinBox = new lcdSpinBox( 2, m_midiInputGroupBox ); m_inputChannelSpinBox->addTextForValue( 0, "--" ); m_inputChannelSpinBox->setLabel( tr( "CHANNEL" ) ); - m_inputChannelSpinBox->move( 16, 32 ); m_inputChannelSpinBox->setEnabled( false ); + midiInputLayout->addWidget( m_inputChannelSpinBox ); m_fixedInputVelocitySpinBox = new lcdSpinBox( 3, m_midiInputGroupBox ); - m_fixedInputVelocitySpinBox->addTextForValue( -1, "---" ); + m_fixedInputVelocitySpinBox->setDisplayOffset( 1 ); + m_fixedInputVelocitySpinBox->addTextForValue( 0, "---" ); m_fixedInputVelocitySpinBox->setLabel( tr( "VELOCITY" ) ); - m_fixedInputVelocitySpinBox->move( 64, 32 ); m_fixedInputVelocitySpinBox->setEnabled( false ); + midiInputLayout->addWidget( m_fixedInputVelocitySpinBox ); + midiInputLayout->addStretch(); connect( m_midiInputGroupBox->ledButton(), SIGNAL( toggled( bool ) ), m_inputChannelSpinBox, SLOT( setEnabled( bool ) ) ); @@ -66,31 +75,37 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget * _parent ) : - m_midiOutputGroupBox = new groupBox( tr( "ENABLE MIDI OUTPUT" ), this ); - m_midiOutputGroupBox->setGeometry( 4, 90, 242, 80 ); + m_midiOutputGroupBox = new groupBox( tr( "ENABLE MIDI OUTPUT" ) ); + layout->addWidget( m_midiOutputGroupBox ); + + QHBoxLayout* midiOutputLayout = new QHBoxLayout( m_midiOutputGroupBox ); + midiOutputLayout->setContentsMargins( 8, 18, 8, 8 ); + midiOutputLayout->setSpacing( 6 ); m_outputChannelSpinBox = new lcdSpinBox( 2, m_midiOutputGroupBox ); m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) ); - m_outputChannelSpinBox->move( 16, 32 ); m_outputChannelSpinBox->setEnabled( false ); + midiOutputLayout->addWidget( m_outputChannelSpinBox ); m_fixedOutputVelocitySpinBox = new lcdSpinBox( 3, m_midiOutputGroupBox ); - m_fixedOutputVelocitySpinBox->addTextForValue( -1, "---" ); + m_fixedOutputVelocitySpinBox->setDisplayOffset( 1 ); + m_fixedOutputVelocitySpinBox->addTextForValue( 0, "---" ); m_fixedOutputVelocitySpinBox->setLabel( tr( "VELOCITY" ) ); - m_fixedOutputVelocitySpinBox->move( 64, 32 ); m_fixedOutputVelocitySpinBox->setEnabled( false ); + midiOutputLayout->addWidget( m_fixedOutputVelocitySpinBox ); m_outputProgramSpinBox = new lcdSpinBox( 3, m_midiOutputGroupBox ); m_outputProgramSpinBox->setLabel( tr( "PROGRAM" ) ); - m_outputProgramSpinBox->move( 112, 32 ); m_outputProgramSpinBox->setEnabled( false ); + midiOutputLayout->addWidget( m_outputProgramSpinBox ); m_fixedOutputNoteSpinBox = new lcdSpinBox( 3, m_midiOutputGroupBox ); - m_fixedOutputNoteSpinBox->addTextForValue( -1, "---" ); + m_fixedOutputNoteSpinBox->setDisplayOffset( 1 ); + m_fixedOutputNoteSpinBox->addTextForValue( 0, "---" ); m_fixedOutputNoteSpinBox->setLabel( tr( "NOTE" ) ); - m_fixedOutputNoteSpinBox->move( 160, 32 ); m_fixedOutputNoteSpinBox->setEnabled( false ); - + midiOutputLayout->addWidget( m_fixedOutputNoteSpinBox ); + midiOutputLayout->addStretch(); connect( m_midiOutputGroupBox->ledButton(), SIGNAL( toggled( bool ) ), m_outputChannelSpinBox, SLOT( setEnabled( bool ) ) ); @@ -103,18 +118,24 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget * _parent ) : if( !engine::mixer()->midiClient()->isRaw() ) { - m_rpBtn = new QToolButton( m_midiInputGroupBox ); + m_rpBtn = new QToolButton; + m_rpBtn->setMinimumSize( 32, 32 ); m_rpBtn->setText( tr( "MIDI devices to receive MIDI events from" ) ); m_rpBtn->setIcon( embed::getIconPixmap( "piano" ) ); - m_rpBtn->setGeometry( 208, 24, 32, 32 ); m_rpBtn->setPopupMode( QToolButton::InstantPopup ); + midiInputLayout->insertSpacing( 0, 4 ); + midiInputLayout->insertWidget( 0, m_rpBtn ); - m_wpBtn = new QToolButton( m_midiOutputGroupBox ); + m_wpBtn = new QToolButton; + m_wpBtn->setMinimumSize( 32, 32 ); m_wpBtn->setText( tr( "MIDI devices to send MIDI events to" ) ); m_wpBtn->setIcon( embed::getIconPixmap( "piano" ) ); - m_wpBtn->setGeometry( 208, 24, 32, 32 ); m_wpBtn->setPopupMode( QToolButton::InstantPopup ); + midiOutputLayout->insertSpacing( 0, 4 ); + midiOutputLayout->insertWidget( 0, m_wpBtn ); } + + layout->addStretch(); } diff --git a/src/gui/widgets/cpuload_widget.cpp b/src/gui/widgets/cpuload_widget.cpp index 4b2db4626..508581a74 100644 --- a/src/gui/widgets/cpuload_widget.cpp +++ b/src/gui/widgets/cpuload_widget.cpp @@ -2,7 +2,7 @@ * cpuload_widget.cpp - widget for displaying CPU-load (partly based on * Hydrogen's CPU-load-widget) * - * Copyright (c) 2005-2007 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -90,7 +90,7 @@ void cpuloadWidget::paintEvent( QPaintEvent * ) void cpuloadWidget::updateCpuLoad() { // smooth load-values a bit - Uint8 new_load = ( m_currentLoad + engine::mixer()->cpuLoad() ) / 2; + int new_load = ( m_currentLoad + engine::mixer()->cpuLoad() ) / 2; if( new_load != m_currentLoad ) { m_currentLoad = new_load; diff --git a/src/gui/widgets/fade_button.cpp b/src/gui/widgets/fade_button.cpp index 2dc8f6cd7..0ae0c1f89 100644 --- a/src/gui/widgets/fade_button.cpp +++ b/src/gui/widgets/fade_button.cpp @@ -99,10 +99,10 @@ void fadeButton::paintEvent( QPaintEvent * _pe ) int w = rect().right(); int h = rect().bottom(); - p.setPen( QColor( 37, 39, 46 ) ); + p.setPen( m_normalColor.darker(130) ); p.drawLine( w, 1, w, h ); p.drawLine( 1, h, w, h ); - p.setPen( QColor( 145, 147, 154 ) ); + p.setPen( m_normalColor.lighter(130) ); p.drawLine( 0, 0, 0, h-1 ); p.drawLine( 0, 0, w, 0 ); } diff --git a/src/gui/widgets/fader.cpp b/src/gui/widgets/fader.cpp index e9e14b2c4..b9f301663 100644 --- a/src/gui/widgets/fader.cpp +++ b/src/gui/widgets/fader.cpp @@ -290,7 +290,7 @@ void fader::paintEvent( QPaintEvent * ev) if( m_persistentPeak_L > 0.05 ) { - painter.fillRect( QRect( 2, persistentPeak_L, 4, 1 ), (m_persistentPeak_L < 1.0 )? QColor( 0, 200, 0) : QColor( 200, 0, 0)); + painter.fillRect( QRect( 2, persistentPeak_L, 4, 1 ), (m_persistentPeak_L < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100)); } int peak_R = calculateDisplayPeak( m_fPeakValue_R - m_fMinPeak ); @@ -299,11 +299,11 @@ void fader::paintEvent( QPaintEvent * ev) if( m_persistentPeak_R > 0.05 ) { - painter.fillRect( QRect( 16, persistentPeak_R, 4, 1 ), (m_persistentPeak_R < 1.0 )? QColor( 0, 200, 0) : QColor( 200, 0, 0)); + painter.fillRect( QRect( 16, persistentPeak_R, 4, 1 ), (m_persistentPeak_R < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100)); } // knob - painter.drawPixmap( 4, knobPosY() - m_knob.height(), m_knob ); + painter.drawPixmap( 0, knobPosY() - m_knob.height(), m_knob ); } diff --git a/src/gui/widgets/knob.cpp b/src/gui/widgets/knob.cpp index efb4b6e0b..b46a62a06 100644 --- a/src/gui/widgets/knob.cpp +++ b/src/gui/widgets/knob.cpp @@ -1,7 +1,7 @@ /* * knob.cpp - powerful knob-widget * - * Copyright (c) 2004-2011 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -328,18 +328,22 @@ void knob::drawKnob( QPainter * _p ) width() / 2 - m_knobPixmap->width() / 2 ), 0, *m_knobPixmap ); - p.setPen( QPen( QColor( 200, 0, 0 ), 2 ) ); +// p.setPen( QPen( QColor( 200, 0, 0 ), 2 ) ); p.setRenderHint( QPainter::Antialiasing ); switch( m_knobNum ) { case knobSmall_17: { - p.drawLine( calculateLine( mid, radius ) ); + p.setPen( QPen( QApplication::palette().color( QPalette::Active, + QPalette::WindowText ), 2 ) ); + p.drawLine( calculateLine( mid, radius-2 ) ); break; } case knobBright_26: { + p.setPen( QPen( QApplication::palette().color( QPalette::Active, + QPalette::WindowText ), 2 ) ); p.drawLine( calculateLine( mid, radius-5 ) ); break; } @@ -355,7 +359,8 @@ void knob::drawKnob( QPainter * _p ) } case knobGreen_17: { - p.setPen( QPen( QColor( 0, 200, 0 ), 2 ) ); + p.setPen( QPen( QApplication::palette().color( QPalette::Active, + QPalette::BrightText), 2 ) ); p.drawLine( calculateLine( mid, radius ) ); break; } @@ -635,9 +640,8 @@ void knob::enterValue() void knob::friendlyUpdate() { - if( model()->getControllerConnection() == NULL || - model()->getControllerConnection()->getController()-> - frequentUpdates() == false || + if( model()->controllerConnection() == NULL || + model()->controllerConnection()->getController()->frequentUpdates() == false || Controller::runningFrames() % (256*4) == 0 ) { update(); diff --git a/src/gui/widgets/lcd_spinbox.cpp b/src/gui/widgets/lcd_spinbox.cpp index dcc1ebd09..18bfcb5dc 100644 --- a/src/gui/widgets/lcd_spinbox.cpp +++ b/src/gui/widgets/lcd_spinbox.cpp @@ -43,7 +43,8 @@ lcdSpinBox::lcdSpinBox( int numDigits, QWidget* parent, const QString& name ) : LcdWidget( numDigits, parent, name ), IntModelView( new IntModel( 0, 0, 0, NULL, name, true ), this ), - m_origMousePos() + m_origMousePos(), + m_displayOffset( 0 ) { } @@ -53,7 +54,8 @@ lcdSpinBox::lcdSpinBox( int numDigits, QWidget* parent, const QString& name ) : lcdSpinBox::lcdSpinBox( int numDigits, const QString& style, QWidget* parent, const QString& name ) : LcdWidget( numDigits, parent, name ), IntModelView( new IntModel( 0, 0, 0, NULL, name, true ), this ), - m_origMousePos() + m_origMousePos(), + m_displayOffset( 0 ) { } @@ -67,7 +69,7 @@ lcdSpinBox::~lcdSpinBox() void lcdSpinBox::update() { - setValue( model()->value() ); + setValue( model()->value() + m_displayOffset ); QWidget::update(); } diff --git a/src/tracks/AutomationTrack.cpp b/src/tracks/AutomationTrack.cpp index fc7f50c7c..5988ba3c5 100644 --- a/src/tracks/AutomationTrack.cpp +++ b/src/tracks/AutomationTrack.cpp @@ -51,7 +51,7 @@ AutomationTrack::~AutomationTrack() bool AutomationTrack::play( const midiTime & _start, const fpp_t _frames, - const f_cnt_t _frame_base, Sint16 _tco_num ) + const f_cnt_t _frame_base, int _tco_num ) { if( isMuted() ) { diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 9c17efc5c..f9c3ad9a1 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -106,6 +106,7 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) : m_panningModel( DefaultPanning, PanningLeft, PanningRight, 0.1f, this, tr( "Panning" ) ), m_pitchModel( 0, -100, 100, 1, this, tr( "Pitch" ) ), + m_pitchRangeModel( 1, 1, 24, this, tr( "Pitch range" ) ), m_effectChannelModel( 0, 0, NumFxChannels, this, tr( "FX channel" ) ), m_instrument( NULL ), m_soundShaping( this ), @@ -119,6 +120,8 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) : connect( &m_pitchModel, SIGNAL( dataChanged() ), this, SLOT( updatePitch() ) ); + connect( &m_pitchRangeModel, SIGNAL( dataChanged() ), + this, SLOT( updatePitchRange() ) ); for( int i = 0; i < NumKeys; ++i ) { @@ -585,6 +588,15 @@ void InstrumentTrack::updatePitch() +void InstrumentTrack::updatePitchRange() +{ + const int r = m_pitchRangeModel.value(); + m_pitchModel.setRange( -100 * r, 100 * r ); +} + + + + int InstrumentTrack::masterKey( int _midi_key ) const { int key = m_baseNoteModel.value() - engine::getSong()->masterPitch(); @@ -603,10 +615,8 @@ void InstrumentTrack::removeMidiPortNode( multimediaProject & _mmp ) -bool InstrumentTrack::play( const midiTime & _start, - const fpp_t _frames, - const f_cnt_t _offset, - Sint16 _tco_num ) +bool InstrumentTrack::play( const midiTime & _start, const fpp_t _frames, + const f_cnt_t _offset, int _tco_num ) { const float frames_per_tick = engine::framesPerTick(); @@ -758,6 +768,7 @@ void InstrumentTrack::saveTrackSpecificSettings( QDomDocument & _doc, m_volumeModel.saveSettings( _doc, _this, "vol" ); m_panningModel.saveSettings( _doc, _this, "pan" ); m_pitchModel.saveSettings( _doc, _this, "pitch" ); + m_pitchRangeModel.saveSettings( _doc, _this, "pitchrange" ); m_effectChannelModel.saveSettings( _doc, _this, "fxch" ); m_baseNoteModel.saveSettings( _doc, _this, "basenote" ); @@ -802,6 +813,7 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & _this ) } m_pitchModel.loadSettings( _this, "pitch" ); + m_pitchRangeModel.loadSettings( _this, "pitchrange" ); m_effectChannelModel.loadSettings( _this, "fxch" ); if( _this.hasAttribute( "baseoct" ) ) @@ -995,8 +1007,10 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV m_midiInputAction->setText( tr( "Input" ) ); m_midiOutputAction->setText( tr( "Output" ) ); - m_activityIndicator = new fadeButton( QColor( 56, 60, 72 ), - QColor( 64, 255, 16 ), + m_activityIndicator = new fadeButton( QApplication::palette().color( QPalette::Active, + QPalette::Background), + QApplication::palette().color( QPalette::Active, + QPalette::BrightText ), getTrackSettingsWidget() ); m_activityIndicator->setGeometry( widgetWidth-2*24-11, 2, 8, 28 ); @@ -1255,69 +1269,80 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : vlayout->setMargin( 0 ); vlayout->setSpacing( 0 ); - m_generalSettingsWidget = new tabWidget( tr( "GENERAL SETTINGS" ), - this ); - m_generalSettingsWidget->setFixedHeight( 90 ); + tabWidget* generalSettingsWidget = new tabWidget( tr( "GENERAL SETTINGS" ), this ); - // setup line-edit for changing channel-name - m_nameLineEdit = new QLineEdit( m_generalSettingsWidget ); - m_nameLineEdit->setFont( pointSize<8>( - m_nameLineEdit->font() ) ); - m_nameLineEdit->setGeometry( 10, 16, 230, 18 ); + QVBoxLayout* generalSettingsLayout = new QVBoxLayout( generalSettingsWidget ); + + generalSettingsLayout->setContentsMargins( 8, 18, 8, 8 ); + generalSettingsLayout->setSpacing( 6 ); + + // setup line edit for changing instrument track name + m_nameLineEdit = new QLineEdit; + m_nameLineEdit->setFont( pointSize<8>( m_nameLineEdit->font() ) ); connect( m_nameLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( textChanged( const QString & ) ) ); + generalSettingsLayout->addWidget( m_nameLineEdit ); - // setup volume-knob - m_volumeKnob = new knob( knobBright_26, m_generalSettingsWidget, - tr( "Instrument volume" ) ); + QHBoxLayout* basicControlsLayout = new QHBoxLayout; + basicControlsLayout->setSpacing( 3 ); + + // set up volume knob + m_volumeKnob = new knob( knobBright_26, NULL, tr( "Instrument volume" ) ); m_volumeKnob->setVolumeKnob( true ); - m_volumeKnob->move( 10, 44 ); m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" ); m_volumeKnob->setLabel( tr( "VOL" ) ); m_volumeKnob->setWhatsThis( tr( volume_help ) ); + basicControlsLayout->addWidget( m_volumeKnob ); - // setup panning-knob - m_panningKnob = new knob( knobBright_26, m_generalSettingsWidget, - tr( "Panning" ) ); - m_panningKnob->move( m_volumeKnob->x() + - m_volumeKnob->width() + 16, 44 ); + // set up panning knob + m_panningKnob = new knob( knobBright_26, NULL, tr( "Panning" ) ); m_panningKnob->setHintText( tr( "Panning:" ) + " ", "" ); m_panningKnob->setLabel( tr( "PAN" ) ); + basicControlsLayout->addWidget( m_panningKnob ); + basicControlsLayout->addStretch(); - m_pitchKnob = new knob( knobBright_26, m_generalSettingsWidget, - tr( "Pitch" ) ); - m_pitchKnob->move( m_panningKnob->x() + - m_panningKnob->width() + 16, 44 ); + // set up pitch knob + m_pitchKnob = new knob( knobBright_26, NULL, tr( "Pitch" ) ); m_pitchKnob->setHintText( tr( "Pitch:" ) + " ", " " + tr( "cents" ) ); m_pitchKnob->setLabel( tr( "PITCH" ) ); + basicControlsLayout->addWidget( m_pitchKnob ); + + // set up pitch range knob + m_pitchRangeSpinBox= new lcdSpinBox( 2, NULL, tr( "Pitch range (semitones)" ) ); + m_pitchRangeSpinBox->setLabel( tr( "RANGE" ) ); + + basicControlsLayout->addWidget( m_pitchRangeSpinBox ); + basicControlsLayout->addStretch(); // setup spinbox for selecting FX-channel - m_effectChannelNumber = new fxLineLcdSpinBox( 2, m_generalSettingsWidget, - tr( "FX channel" ) ); + m_effectChannelNumber = new fxLineLcdSpinBox( 2, NULL, tr( "FX channel" ) ); m_effectChannelNumber->setLabel( tr( "FX CHNL" ) ); - m_effectChannelNumber->move( m_pitchKnob->x() + - m_pitchKnob->width() + 16, 44 ); - m_saveSettingsBtn = new QPushButton( embed::getIconPixmap( - "project_save" ), "", - m_generalSettingsWidget ); - m_saveSettingsBtn->setGeometry( m_effectChannelNumber->x() + - m_effectChannelNumber->width() + 20, 44, - 32, 32 ); - connect( m_saveSettingsBtn, SIGNAL( clicked() ), this, - SLOT( saveSettingsBtnClicked() ) ); - toolTip::add( m_saveSettingsBtn, - tr( "Save current channel settings in a preset-file" ) ); - m_saveSettingsBtn->setWhatsThis( + basicControlsLayout->addWidget( m_effectChannelNumber ); + + basicControlsLayout->addStretch(); + + + QPushButton* saveSettingsBtn = new QPushButton( embed::getIconPixmap( "project_save" ), QString() ); + saveSettingsBtn->setMinimumSize( 32, 32 ); + + connect( saveSettingsBtn, SIGNAL( clicked() ), this, SLOT( saveSettingsBtnClicked() ) ); + + toolTip::add( saveSettingsBtn, tr( "Save current channel settings in a preset-file" ) ); + saveSettingsBtn->setWhatsThis( tr( "Click here, if you want to save current channel settings " "in a preset-file. Later you can load this preset by " "double-clicking it in the preset-browser." ) ); + basicControlsLayout->addWidget( saveSettingsBtn ); + + generalSettingsLayout->addLayout( basicControlsLayout ); + m_tabWidget = new tabWidget( "", this ); m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + 10 ); @@ -1325,16 +1350,14 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // create tab-widgets m_ssView = new InstrumentSoundShapingView( m_tabWidget ); - QWidget * instrument_functions = new QWidget( m_tabWidget ); - m_chordView = new ChordCreatorView( &m_track->m_chordCreator, - instrument_functions ); - m_arpView= new ArpeggiatorView( &m_track->m_arpeggiator, - instrument_functions ); + QWidget* instrumentFunctions = new QWidget( m_tabWidget ); + m_chordView = new ChordCreatorView( &m_track->m_chordCreator, instrumentFunctions ); + m_arpView= new ArpeggiatorView( &m_track->m_arpeggiator, instrumentFunctions ); m_midiView = new InstrumentMidiIOView( m_tabWidget ); - m_effectView = new EffectRackView( m_track->m_audioPort.effects(), - m_tabWidget ); + m_effectView = new EffectRackView( m_track->m_audioPort.effects(), m_tabWidget ); + m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 ); - m_tabWidget->addTab( instrument_functions, tr( "FUNC" ), 2 ); + m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), 2 ); m_tabWidget->addTab( m_effectView, tr( "FX" ), 3 ); m_tabWidget->addTab( m_midiView, tr( "MIDI" ), 4 ); @@ -1342,7 +1365,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_pianoView = new PianoView( this ); m_pianoView->setFixedSize( INSTRUMENT_WIDTH, PIANO_HEIGHT ); - vlayout->addWidget( m_generalSettingsWidget ); + vlayout->addWidget( generalSettingsWidget ); vlayout->addWidget( m_tabWidget ); vlayout->addWidget( m_pianoView ); @@ -1354,8 +1377,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : setFixedWidth( INSTRUMENT_WIDTH ); resize( sizeHint() ); - QMdiSubWindow * subWin = - engine::mainWindow()->workspace()->addSubWindow( this ); + QMdiSubWindow * subWin = engine::mainWindow()->workspace()->addSubWindow( this ); Qt::WindowFlags flags = subWin->windowFlags(); flags |= Qt::MSWindowsFixedSizeDialogHint; flags &= ~Qt::WindowMaximizeButtonHint; @@ -1418,6 +1440,7 @@ void InstrumentTrackWindow::modelChanged() if( m_track->instrument() && m_track->instrument()->isBendable() ) { m_pitchKnob->setModel( &m_track->m_pitchModel ); + m_pitchRangeSpinBox->setModel( &m_track->m_pitchRangeModel ); m_pitchKnob->show(); } else diff --git a/src/tracks/SampleTrack.cpp b/src/tracks/SampleTrack.cpp index 487bdde65..d57ca8447 100644 --- a/src/tracks/SampleTrack.cpp +++ b/src/tracks/SampleTrack.cpp @@ -76,8 +76,7 @@ SampleTCO::~SampleTCO() void SampleTCO::changeLength( const midiTime & _length ) { - trackContentObject::changeLength( qMax( static_cast( _length ), - DefaultTicksPerTact ) ); + trackContentObject::changeLength( qMax( static_cast( _length ), DefaultTicksPerTact ) ); } @@ -333,13 +332,15 @@ void SampleTCOView::paintEvent( QPaintEvent * _pe ) QLinearGradient grad( 0, 0, 0, height() ); if( isSelected() ) { - grad.setColorAt( 1, QColor( 0, 0, 224 ) ); grad.setColorAt( 0, QColor( 0, 0, 128 ) ); + grad.setColorAt( 0.5, QColor( 0, 0, 224 ) ); + grad.setColorAt( 1, QColor( 0, 0, 128 ) ); } else { - grad.setColorAt( 0, QColor( 96, 96, 96 ) ); - grad.setColorAt( 1, QColor( 16, 16, 16 ) ); + grad.setColorAt( 0, QColor( 16, 16, 16 ) ); + grad.setColorAt( 0.5, QColor( 96, 96, 96 ) ); + grad.setColorAt( 0, QColor( 16, 16, 16 ) ); } p.fillRect( _pe->rect(), grad ); @@ -351,7 +352,7 @@ void SampleTCOView::paintEvent( QPaintEvent * _pe ) } else { - p.setPen( QColor( 64, 224, 160 ) ); + p.setPen( QColor( 74, 253, 133 ) ); } QRect r = QRect( 1, 1, qMax( static_cast( m_tco->sampleLength() * @@ -406,8 +407,7 @@ SampleTrack::~SampleTrack() bool SampleTrack::play( const midiTime & _start, const fpp_t _frames, - const f_cnt_t _offset, - Sint16 /*_tco_num*/ ) + const f_cnt_t _offset, int /*_tco_num*/ ) { m_audioPort.effects()->startRunning(); bool played_a_note = false; // will be return variable diff --git a/src/tracks/bb_track.cpp b/src/tracks/bb_track.cpp index 93f3aa8c5..bc0c1df73 100644 --- a/src/tracks/bb_track.cpp +++ b/src/tracks/bb_track.cpp @@ -1,7 +1,7 @@ /* * bb_track.cpp - implementation of class bbTrack and bbTCO * - * Copyright (c) 2004-2013 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -113,7 +113,7 @@ void bbTCO::loadSettings( const QDomElement & _this ) trackContentObjectView * bbTCO::createView( trackView * _tv ) { - return( new bbTCOView( this, _tv ) ); + return new bbTCOView( this, _tv ); } @@ -342,27 +342,24 @@ bbTrack::~bbTrack() // play _frames frames of given TCO within starting with _start bool bbTrack::play( const midiTime & _start, const fpp_t _frames, - const f_cnt_t _offset, Sint16 _tco_num ) + const f_cnt_t _offset, int _tco_num ) { if( isMuted() ) { - return( false ); + return false; } if( _tco_num >= 0 ) { - return( engine::getBBTrackContainer()->play( _start, _frames, - _offset, - s_infoMap[this] ) ); + return engine::getBBTrackContainer()->play( _start, _frames, _offset, s_infoMap[this] ); } tcoVector tcos; - getTCOsInRange( tcos, _start, _start + static_cast( _frames / - engine::framesPerTick() ) ); + getTCOsInRange( tcos, _start, _start + static_cast( _frames / engine::framesPerTick() ) ); if( tcos.size() == 0 ) { - return( false ); + return false; } midiTime lastPosition; @@ -379,13 +376,9 @@ bool bbTrack::play( const midiTime & _start, const fpp_t _frames, if( _start - lastPosition < lastLen ) { - return( engine::getBBTrackContainer()->play( _start - - lastPosition, - _frames, - _offset, - s_infoMap[this] ) ); + return engine::getBBTrackContainer()->play( _start - lastPosition, _frames, _offset, s_infoMap[this] ); } - return( false ); + return false; } @@ -408,11 +401,10 @@ trackContentObject * bbTrack::createTCO( const midiTime & _pos ) getTCOsInRange( tcos, 0, _pos ); if( tcos.size() > 0 && dynamic_cast( tcos.back() ) != NULL ) { - return( new bbTCO( this, - dynamic_cast( tcos.back() )->color() ) ); + return new bbTCO( this, dynamic_cast( tcos.back() )->color() ); } - return( new bbTCO( this ) ); + return new bbTCO( this ); } @@ -497,10 +489,10 @@ bbTrack * bbTrack::findBBTrack( int _bb_num ) { if( it.value() == _bb_num ) { - return( it.key() ); + return it.key(); } } - return( NULL ); + return NULL; } @@ -510,9 +502,9 @@ int bbTrack::numOfBBTrack( track * _track ) { if( dynamic_cast( _track ) != NULL ) { - return( s_infoMap[dynamic_cast( _track )] ); + return s_infoMap[dynamic_cast( _track )]; } - return( 0 ); + return 0; } @@ -571,7 +563,7 @@ bbTrackView::~bbTrackView() bool bbTrackView::close() { engine::getBBEditor()->removeBBView( bbTrack::s_infoMap[m_bbTrack] ); - return( trackView::close() ); + return trackView::close(); } diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index 5ad261ca8..54c7ef41c 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -485,9 +485,9 @@ void pattern::abortFreeze() -void pattern::addSteps( int _n ) +void pattern::addSteps() { - m_steps += _n; + m_steps += midiTime::stepsPerTact(); ensureBeatNotes(); emit dataChanged(); } @@ -495,8 +495,9 @@ void pattern::addSteps( int _n ) -void pattern::removeSteps( int _n ) +void pattern::removeSteps() { + int _n = midiTime::stepsPerTact(); if( _n < m_steps ) { for( int i = m_steps - _n; i < m_steps; ++i ) @@ -908,23 +909,6 @@ void patternView::changeName() - -void patternView::addSteps( QAction * _item ) -{ - m_pat->addSteps( _item->text().section( ' ', 0, 0 ).toInt() ); -} - - - - -void patternView::removeSteps( QAction * _item ) -{ - m_pat->removeSteps( _item->text().section( ' ', 0, 0 ).toInt() ); -} - - - - void patternView::constructContextMenu( QMenu * _cm ) { QAction * a = new QAction( embed::getIconPixmap( "piano" ), @@ -967,24 +951,10 @@ void patternView::constructContextMenu( QMenu * _cm ) _cm->addSeparator(); } - QMenu * add_step_menu = _cm->addMenu( - embed::getIconPixmap( "step_btn_add" ), - tr( "Add steps" ) ); - QMenu * remove_step_menu = _cm->addMenu( - embed::getIconPixmap( "step_btn_remove" ), - tr( "Remove steps" ) ); - connect( add_step_menu, SIGNAL( triggered( QAction * ) ), - this, SLOT( addSteps( QAction * ) ) ); - connect( remove_step_menu, SIGNAL( triggered( QAction * ) ), - this, SLOT( removeSteps( QAction * ) ) ); - for( int i = 1; i <= 16; i *= 2 ) - { - const QString label = ( i == 1 ) ? - tr( "1 step" ) : - tr( "%1 steps" ).arg( i ); - add_step_menu->addAction( label ); - remove_step_menu->addAction( label ); - } + _cm->addAction( embed::getIconPixmap( "step_btn_add" ), + tr( "Add steps" ), m_pat, SLOT( addSteps() ) ); + _cm->addAction( embed::getIconPixmap( "step_btn_remove" ), + tr( "Remove steps" ), m_pat, SLOT( removeSteps() ) ); } @@ -1142,9 +1112,9 @@ void patternView::paintEvent( QPaintEvent * ) QLinearGradient lingrad( 0, 0, 0, height() ); const QColor c = isSelected() ? QColor( 0, 0, 224 ) : QColor( 96, 96, 96 ); - lingrad.setColorAt( 0, c ); - lingrad.setColorAt( 0.5, Qt::black ); - lingrad.setColorAt( 1, c ); + lingrad.setColorAt( 0, QColor( 16, 16, 16 ) ); + lingrad.setColorAt( 0.5, c ); + lingrad.setColorAt( 1, QColor( 16, 16, 16 ) ); p.setBrush( lingrad ); p.setPen( QColor( 0, 0, 0 ) ); //p.drawRect( 0, 0, width() - 1, height() - 1 ); @@ -1202,11 +1172,11 @@ void patternView::paintEvent( QPaintEvent * ) } else if( m_pat->m_frozenPattern != NULL ) { - p.setPen( QColor( 0x00, 0xE0, 0xFF ) ); + p.setPen( QColor( 0x70, 0xFF, 0xFF ) ); } else { - p.setPen( QColor( 0xFF, 0xB0, 0x00 ) ); + p.setPen( QColor( 0x77, 0xC7, 0xD8 ) ); } for( NoteVector::Iterator it = @@ -1317,7 +1287,7 @@ void patternView::paintEvent( QPaintEvent * ) else if( m_pat->m_frozenPattern != NULL ) { p.setBrush( QBrush() ); - p.setPen( QColor( 0, 224, 255 ) ); + p.setPen( QColor( 0x70, 255, 255 ) ); p.drawRect( 0, 0, width()-1, height() - 1 ); p.drawPixmap( 3, height() - s_frozen->height() - 4, *s_frozen ); }