From 1ce450523f3156536703b31278df0fd8af2e01e7 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 11 Nov 2007 11:30:47 +0000 Subject: [PATCH] when adding new notes in piano-roll via mouse use alignment-border of 80/20 instead of 50/50 which makes piano-roll more usable git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms/stable-0.3@580 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 20 ++++++++++++++++++++ configure.in | 4 ++-- include/note.h | 3 ++- src/core/note.cpp | 7 ++++--- src/core/piano_roll.cpp | 6 ++++-- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9379cdde9..5613c485a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2007-11-11 Tobias Doerffel + + * include/note.h: + * src/core/note.cpp: + * src/core/piano_roll.cpp: + when adding new notes in piano-roll via mouse use alignment-border of + 80/20 instead of 50/50 which makes piano-roll more usable + +2007-11-10 Tobias Doerffel + + * data/presets/AudioFileProcessor/Erazor.cs.xml: + added preset + + * data/locale/de.ts: + * data/locale/de.qm: + updated German localization-files + + * src/lib/sample_buffer.cpp: + fixed file-filter in file-selection-dialog + 2007-10-30 Tobias Doerffel * src/core/note_play_handle.cpp: diff --git a/configure.in b/configure.in index 51b5ec777..c99efb584 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) -AC_INIT(lmms, 0.3.0-svn20071030, lmms-devel/at/lists/dot/sf/dot/net) -AM_INIT_AUTOMAKE(lmms, 0.3.0-svn20071030) +AC_INIT(lmms, 0.3.0-svn20071111, lmms-devel/at/lists/dot/sf/dot/net) +AM_INIT_AUTOMAKE(lmms, 0.3.0-svn20071111) AM_CONFIG_HEADER(config.h) diff --git a/include/note.h b/include/note.h index 4b7cf1b42..6eaa08d19 100644 --- a/include/note.h +++ b/include/note.h @@ -172,7 +172,8 @@ public: } static midiTime FASTCALL quantized( const midiTime & _m, - const int _q_grid ); + const int _q_grid, + const float _align = 0.5f ); detuningHelper * detuning( void ) const { diff --git a/src/core/note.cpp b/src/core/note.cpp index 5ee02d12d..4bd934422 100644 --- a/src/core/note.cpp +++ b/src/core/note.cpp @@ -177,10 +177,11 @@ void note::setPanning( const panning _panning ) -midiTime note::quantized( const midiTime & _m, const int _q_grid ) +midiTime note::quantized( const midiTime & _m, const int _q_grid, + const float _align ) { - float p = ( (float) _m / _q_grid ); - if( p - floorf( p ) < 0.5f ) + const float p = ( (float) _m / _q_grid ); + if( p - floorf( p ) < _align ) { return( static_cast( p ) * _q_grid ); } diff --git a/src/core/piano_roll.cpp b/src/core/piano_roll.cpp index 7100f858e..1558a7904 100644 --- a/src/core/piano_roll.cpp +++ b/src/core/piano_roll.cpp @@ -1361,7 +1361,9 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) pattern::MELODY_PATTERN ); // then set new note - midiTime note_pos( pos_tact_64th ); + midiTime note_pos( note::quantized( + midiTime( pos_tact_64th ), + quantization(), 0.8f ) ); midiTime note_len( newNoteLen() ); note new_note( note_len, note_pos, @@ -1371,7 +1373,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me ) NOTES_PER_OCTAVE) ); note * created_new_note = - m_pattern->addNote( new_note ); + m_pattern->addNote( new_note, FALSE ); // reset it so that it can be used for // ops (move, resize) after this