Skip to content

Commit

Permalink
Fix note transpose on sample zero
Browse files Browse the repository at this point in the history
  • Loading branch information
8bitbubsy committed Apr 21, 2024
1 parent bc169af commit c45f41b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
32 changes: 24 additions & 8 deletions src/pt2_edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ void delSampleTrack(void)

void trackNoteUp(bool sampleAllFlag, uint8_t from, uint8_t to)
{
const uint8_t transposeSample = editor.sampleZero ? 0 : editor.currSample + 1;

if (from > to)
{
uint8_t old = from;
Expand All @@ -726,7 +728,7 @@ void trackNoteUp(bool sampleAllFlag, uint8_t from, uint8_t to)
{
note_t *noteSrc = &song->patterns[song->currPattern][(i * PAULA_VOICES) + cursor.channel];

if (!sampleAllFlag && noteSrc->sample != editor.currSample+1)
if (!sampleAllFlag && noteSrc->sample != transposeSample)
continue;

if (noteSrc->period)
Expand Down Expand Up @@ -764,6 +766,8 @@ void trackNoteUp(bool sampleAllFlag, uint8_t from, uint8_t to)

void trackNoteDown(bool sampleAllFlag, uint8_t from, uint8_t to)
{
const uint8_t transposeSample = editor.sampleZero ? 0 : editor.currSample + 1;

if (from > to)
{
uint8_t old = from;
Expand All @@ -776,7 +780,7 @@ void trackNoteDown(bool sampleAllFlag, uint8_t from, uint8_t to)
{
note_t *noteSrc = &song->patterns[song->currPattern][(i * PAULA_VOICES) + cursor.channel];

if (!sampleAllFlag && noteSrc->sample != editor.currSample+1)
if (!sampleAllFlag && noteSrc->sample != transposeSample)
continue;

if (noteSrc->period)
Expand Down Expand Up @@ -814,6 +818,8 @@ void trackNoteDown(bool sampleAllFlag, uint8_t from, uint8_t to)

void trackOctaUp(bool sampleAllFlag, uint8_t from, uint8_t to)
{
const uint8_t transposeSample = editor.sampleZero ? 0 : editor.currSample + 1;

if (from > to)
{
uint8_t old = from;
Expand All @@ -828,7 +834,7 @@ void trackOctaUp(bool sampleAllFlag, uint8_t from, uint8_t to)
{
note_t *noteSrc = &song->patterns[song->currPattern][(i * PAULA_VOICES) + cursor.channel];

if (!sampleAllFlag && noteSrc->sample != editor.currSample+1)
if (!sampleAllFlag && noteSrc->sample != transposeSample)
continue;

if (noteSrc->period)
Expand Down Expand Up @@ -872,6 +878,8 @@ void trackOctaUp(bool sampleAllFlag, uint8_t from, uint8_t to)

void trackOctaDown(bool sampleAllFlag, uint8_t from, uint8_t to)
{
const uint8_t transposeSample = editor.sampleZero ? 0 : editor.currSample + 1;

if (from > to)
{
uint8_t old = from;
Expand All @@ -884,7 +892,7 @@ void trackOctaDown(bool sampleAllFlag, uint8_t from, uint8_t to)
{
note_t *noteSrc = &song->patterns[song->currPattern][(i * PAULA_VOICES) + cursor.channel];

if (!sampleAllFlag && noteSrc->sample != editor.currSample+1)
if (!sampleAllFlag && noteSrc->sample != transposeSample)
continue;

if (noteSrc->period)
Expand Down Expand Up @@ -920,14 +928,16 @@ void trackOctaDown(bool sampleAllFlag, uint8_t from, uint8_t to)

void pattNoteUp(bool sampleAllFlag)
{
const uint8_t transposeSample = editor.sampleZero ? 0 : editor.currSample + 1;

saveUndo();
for (int32_t i = 0; i < PAULA_VOICES; i++)
{
for (int32_t j = 0; j < MOD_ROWS; j++)
{
note_t *noteSrc = &song->patterns[song->currPattern][(j * PAULA_VOICES) + i];

if (!sampleAllFlag && noteSrc->sample != editor.currSample+1)
if (!sampleAllFlag && noteSrc->sample != transposeSample)
continue;

if (noteSrc->period)
Expand Down Expand Up @@ -966,14 +976,16 @@ void pattNoteUp(bool sampleAllFlag)

void pattNoteDown(bool sampleAllFlag)
{
const uint8_t transposeSample = editor.sampleZero ? 0 : editor.currSample + 1;

saveUndo();
for (int32_t i = 0; i < PAULA_VOICES; i++)
{
for (int32_t j = 0; j < MOD_ROWS; j++)
{
note_t *noteSrc = &song->patterns[song->currPattern][(j * PAULA_VOICES) + i];

if (!sampleAllFlag && noteSrc->sample != editor.currSample+1)
if (!sampleAllFlag && noteSrc->sample != transposeSample)
continue;

if (noteSrc->period)
Expand Down Expand Up @@ -1012,14 +1024,16 @@ void pattNoteDown(bool sampleAllFlag)

void pattOctaUp(bool sampleAllFlag)
{
const uint8_t transposeSample = editor.sampleZero ? 0 : editor.currSample + 1;

saveUndo();
for (int32_t i = 0; i < PAULA_VOICES; i++)
{
for (int32_t j = 0; j < MOD_ROWS; j++)
{
note_t *noteSrc = &song->patterns[song->currPattern][(j * PAULA_VOICES) + i];

if (!sampleAllFlag && noteSrc->sample != editor.currSample+1)
if (!sampleAllFlag && noteSrc->sample != transposeSample)
continue;

if (noteSrc->period)
Expand Down Expand Up @@ -1056,14 +1070,16 @@ void pattOctaUp(bool sampleAllFlag)

void pattOctaDown(bool sampleAllFlag)
{
const uint8_t transposeSample = editor.sampleZero ? 0 : editor.currSample + 1;

saveUndo();
for (int32_t i = 0; i < PAULA_VOICES; i++)
{
for (int32_t j = 0; j < MOD_ROWS; j++)
{
note_t *noteSrc = &song->patterns[song->currPattern][(j * PAULA_VOICES) + i];

if (!sampleAllFlag && noteSrc->sample != editor.currSample+1)
if (!sampleAllFlag && noteSrc->sample != transposeSample)
continue;

if (noteSrc->period)
Expand Down
2 changes: 1 addition & 1 deletion src/pt2_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "pt2_unicode.h"
#include "pt2_palette.h"

#define PROG_VER_STR "1.67"
#define PROG_VER_STR "1.68"

#ifdef _WIN32
#define DIR_DELIMITER '\\'
Expand Down

0 comments on commit c45f41b

Please sign in to comment.