[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/core SnapList.cpp SnapList.h
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src/core SnapList.cpp SnapList.h |
Date: |
Wed, 13 Feb 2008 15:28:52 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 08/02/13 15:28:52
Modified files:
src/core : SnapList.cpp SnapList.h
Log message:
* make snaprange a config option
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/SnapList.cpp?cvsroot=traverso&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/SnapList.h?cvsroot=traverso&r1=1.14&r2=1.15
Patches:
Index: SnapList.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/SnapList.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- SnapList.cpp 13 Feb 2008 12:45:40 -0000 1.27
+++ SnapList.cpp 13 Feb 2008 15:28:52 -0000 1.28
@@ -20,10 +20,12 @@
*/
#include "SnapList.h"
+
#include "Peak.h"
#include "Sheet.h"
#include "AudioClip.h"
#include "AudioClipManager.h"
+#include "Config.h"
#include "ContextPointer.h"
#include "TimeLine.h"
#include "Marker.h"
@@ -40,8 +42,6 @@
#define SLPRINT(args...)
#endif
-static const int SNAP_WIDTH = 10;
-
SnapList::SnapList(Sheet* sheet)
: QObject(sheet)
, m_sheet(sheet)
@@ -133,16 +133,17 @@
}
// check if neighbouring snap regions overlap.
- // if yes, reduce SNAP_WIDTH to keep the border in the middle
- int ls = -SNAP_WIDTH;
+ // if yes, reduce snap-range to keep the border in the middle
+ int snaprange = config().get_property("Snap", "range",
10).toInt();
+ int ls = - snaprange;
if (lastIndex > -1) {
- if ( (m_xposList.at(i) - lastVal) < (2 * SNAP_WIDTH *
m_scalefactor) ) {
+ if ( (m_xposList.at(i) - lastVal) < (2 * snaprange *
m_scalefactor) ) {
ls = - (int) ((m_xposList.at(i) / m_scalefactor
- lastVal / m_scalefactor) / 2);
}
}
- for (int j = ls; j <= SNAP_WIDTH; j++) {
+ for (int j = ls; j <= snaprange; j++) {
int pos = (int)((m_xposList.at(i) - m_rangeStart) /
m_scalefactor + j); // index in the LUT
if (pos < 0) {
@@ -166,7 +167,7 @@
// public function that checks if there is a snap position
-// within +-SNAP_WIDTH of the supplied value i
+// within +- snap-range of the supplied value i
TimeRef SnapList::get_snap_value(const TimeRef& pos)
{
if (m_isDirty) {
@@ -337,7 +338,7 @@
}
-TimeRef SnapList::calculate_snap_diff(TimeRef & leftlocation, TimeRef
rightlocation)
+TimeRef SnapList::calculate_snap_diff(TimeRef leftlocation, TimeRef
rightlocation)
{
// "nframe_t" domain, but must be signed ints because they can become
negative
qint64 snapStartDiff = 0;
@@ -375,6 +376,5 @@
snapDiff = snapEndDiff;
}
-// leftlocation -= snapDiff;
return TimeRef(snapDiff);
}
Index: SnapList.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/SnapList.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- SnapList.h 13 Feb 2008 12:45:40 -0000 1.14
+++ SnapList.h 13 Feb 2008 15:28:52 -0000 1.15
@@ -45,7 +45,7 @@
TimeRef next_snap_pos(const TimeRef& location);
TimeRef prev_snap_pos(const TimeRef& location);
- TimeRef calculate_snap_diff(TimeRef& leftlocation, TimeRef
rightlocation);
+ TimeRef calculate_snap_diff(TimeRef leftlocation, TimeRef
rightlocation);
void set_range(const TimeRef& start, const TimeRef& end, int
scalefactor);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src/core SnapList.cpp SnapList.h,
Remon Sijrier <=