Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
1.6.0-bacon1
1.6.0-bacon2
Interpolate values in tables and phrases
R + B on single-column selection will fill values from lowest to highest

Contributions:
drbscl
Add 64 bit soundfont support (#211)
Expand Down
9 changes: 9 additions & 0 deletions docs/wiki/What-is-LittlePiggyTracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ Note: CTRL Key mappings of RT and LT are inverted. Since the keyboard's Arrow Ke
- B+LEFT/RIGHT: Next/Previous Channel in Chain/Phrase Screen. Navigation +/- 1 in Instrument/Table Screen. Switch between Song and Live Modes in Song Screen.
- RT+ARROWS: Navigate between the Screens.
- LT+UP/DOWN: Jump up/down to next populated row after a blank row (great for live mode entire row queuing!)
- RT+B: in chains or tables, a single-column selection will fill values from lowest to highest

## Selections

Expand All @@ -137,6 +138,14 @@ And then:

- LT+A: paste the clipboard content at current location

- RT+B: in chains or tables, a single-column selection will fill values from lowest to highest

00 01 00 01
01 -- => 01 02
02 -- 02 03
03 04 03 04


## Playback Modes and Controls

There are two modes for playback, Song and Live. The controls in each mode differ slightly.
Expand Down
2 changes: 1 addition & 1 deletion sources/Application/Model/Project.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define PROJECT_NUMBER "1"
#define PROJECT_RELEASE "6"
#define BUILD_COUNT "0-bacon1"
#define BUILD_COUNT "0-bacon2"

#define MAX_TAP 3

Expand Down
72 changes: 70 additions & 2 deletions sources/Application/Views/PhraseView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,72 @@ void PhraseView::extendSelection() {
isDirty_ = true;
}
}

/******************************************************
interpolateSelection:
expands the lowest value of selection to the highest
******************************************************/
void PhraseView::interpolateSelection() {
if (!clipboard_.active_) {
return;
}

GUIRect rect = getSelectionRect();
// Only interpolate if we're in note (0) or param (3, 5) columns
int col = rect.Left();
if (col != rect.Right() || (col != 0 && col != 3 && col != 5)) {
return;
}

int startRow = rect.Top();
int endRow = rect.Bottom();
// Need at least 2 rows to interpolate
if (endRow - startRow < 1) {
return;
}

// Select the appropriate data array based on column
if (col == 0) {
// Note column
uchar *noteData = phrase_->note_ + (16 * viewData_->currentPhrase_);

uchar startNote = noteData[startRow];
uchar endNote = noteData[endRow];

if (startNote == 0xFF || endNote == 0xFF) {
View::SetNotification("No note info");
return;
}

int numSteps = endRow - startRow;
int noteDiff = (int)endNote - (int)startNote;

for (int step = 0; step <= numSteps; step++) {
int row = startRow + step;
int value = startNote + (2 * noteDiff * step + numSteps) / (2 * numSteps);
noteData[row] = (uchar)value;
}
} else {
// Parameter columns (3 or 5)
ushort *paramData = (col == 3) ?
phrase_->param1_ + (16 * viewData_->currentPhrase_) :
phrase_->param2_ + (16 * viewData_->currentPhrase_);

ushort startParam = paramData[startRow];
ushort endParam = paramData[endRow];

int numSteps = endRow - startRow;
int paramDiff = (int)endParam - (int)startParam;

for (int step = 0; step <= numSteps; step++) {
int row = startRow + step;
int value = startParam + (2 * paramDiff * step + numSteps) / (2 * numSteps);
paramData[row] = (ushort)value;
}
}
isDirty_ = true;
}

/******************************************************
copySelection:
copies data in the current selection to the
Expand Down Expand Up @@ -992,6 +1058,8 @@ void PhraseView::processSelectionButtonMask(unsigned short mask) {
if (mask & EPBM_B) {
if (mask & EPBM_L) {
extendSelection();
} else if (mask & EPBM_R) {
interpolateSelection();
} else {
copySelection();
}
Expand Down Expand Up @@ -1210,7 +1278,7 @@ void PhraseView::DrawView() {
DrawString(pos._x, pos._y, buffer, props);
setTextProps(props, 2, j, true);
pos._y++;
if (j == row_ && (col_ == 2 || col_ == 3)) {
if (j == row_ && col_ == 2) {
printHelpLegend(command, props);
}
}
Expand Down Expand Up @@ -1257,7 +1325,7 @@ void PhraseView::DrawView() {
DrawString(pos._x, pos._y, buffer, props);
setTextProps(props, 4, j, true);
pos._y++;
if (j == row_ && (col_ == 4 || col_ == 5)) {
if (j == row_ && col_ == 4) {
printHelpLegend(command, props);
}
}
Expand Down
1 change: 1 addition & 0 deletions sources/Application/Views/PhraseView.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class PhraseView : public View {

GUIRect getSelectionRect();
void fillClipboardData();
void interpolateSelection();
void copySelection();
void cutSelection();
void pasteClipboard();
Expand Down
59 changes: 56 additions & 3 deletions sources/Application/Views/TableView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,57 @@ void TableView::extendSelection() {
}
}

/******************************************************
interpolateSelection:
expands the lowest value of selection to the highest
******************************************************/
void TableView::interpolateSelection() {
if (!clipboard_.active_) {
return;
}

GUIRect rect = getSelectionRect();

// Only interpolate if we're in param columns (1, 3, 5)
int col = rect.Left();
if (col != rect.Right() || (col != 1 && col != 3 && col != 5)) {
return;
}

int startRow = rect.Top();
int endRow = rect.Bottom();

// Need at least 2 rows to interpolate
if (endRow - startRow < 1) {
return;
}

Table &table = TableHolder::GetInstance()->GetTable(viewData_->currentTable_);

ushort *paramData;
if (col == 1) {
paramData = table.param1_;
} else if (col == 3) {
paramData = table.param2_;
} else {
paramData = table.param3_;
}

ushort startParam = paramData[startRow];
ushort endParam = paramData[endRow];

int numSteps = endRow - startRow;
int paramDiff = (int)endParam - (int)startParam;

for (int step = 0; step <= numSteps; step++) {
int row = startRow + step;
int value = startParam + (2 * paramDiff * step + numSteps) / (2 * numSteps);
paramData[row] = (ushort)value;
}

isDirty_ = true;
}

void TableView::copySelection() {

// Keep up with row,col of selection coz
Expand Down Expand Up @@ -619,6 +670,8 @@ void TableView::processSelectionButtonMask(unsigned short mask) {
if (mask & EPBM_B) {
if (mask & EPBM_L) {
extendSelection();
} else if (mask & EPBM_R) {
interpolateSelection();
} else {
copySelection();
}
Expand Down Expand Up @@ -750,7 +803,7 @@ void TableView::DrawView() {
DrawString(pos._x, pos._y, buffer, props);
setTextProps(props, 0, j, true);
pos._y++;
if (j == row_ && (col_ == 0 || col_ == 1)) {
if (j == row_ && col_ == 0) {
printHelpLegend(command, props);
}
}
Expand Down Expand Up @@ -788,7 +841,7 @@ void TableView::DrawView() {
DrawString(pos._x, pos._y, buffer, props);
setTextProps(props, 2, j, true);
pos._y++;
if (j == row_ && (col_ == 2 || col_ == 3)) {
if (j == row_ && col_ == 2) {
printHelpLegend(command, props);
}
}
Expand Down Expand Up @@ -826,7 +879,7 @@ void TableView::DrawView() {
DrawString(pos._x, pos._y, buffer, props);
setTextProps(props, 4, j, true);
pos._y++;
if (j == row_ && (col_ == 4 || col_ == 5)) {
if (j == row_ && col_ == 5) {
printHelpLegend(command, props);
}
}
Expand Down
1 change: 1 addition & 0 deletions sources/Application/Views/TableView.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class TableView : public View {

void cutPosition();
void pasteLast();
void interpolateSelection();
void copySelection();
void cutSelection();
void pasteClipboard();
Expand Down