Skip to content

New player commands: decrease/increase tempo factor. #77

Description

@AliceLR

It would be nice to have player commands to increase/decrease the relative tempo factor. This requires updating to libxmp 4.7.0, so no milestone currently assigned. Proof-of-concept patch via libxmp/libxmp#966:

diff --git a/src/commands.c b/src/commands.c
index 9b4a8239..6266a402 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -145,6 +145,7 @@ static void change_sequence(xmp_context handle, const struct xmp_module_info *mi
  */
 void read_command(xmp_context handle, const struct xmp_module_info *mi, struct control *ctl)
 {
+	double factor;
 	int cmd;
 
 	cmd = read_key();
@@ -276,5 +277,23 @@ void read_command(xmp_context handle, const struct xmp_module_info *mi, struct c
 	case '<':
 		change_sequence(handle, mi, ctl, -1);
 		break;
+	case '[':
+		factor = xmp_get_tempo_factor_relative(handle);
+		if (factor >= 0.2) {
+			factor -= 0.1;
+			if (xmp_set_tempo_factor_relative(handle, factor) == 0) {
+				info_message("Time factor %.02f", factor);
+			}
+		}
+		break;
+	case ']':
+		factor = xmp_get_tempo_factor_relative(handle);
+		if (factor > 0.0) {
+			factor += 0.1;
+			if (xmp_set_tempo_factor_relative(handle, factor) == 0) {
+				info_message("Time factor %.02f", factor);
+			}
+		}
+		break;
 	}
 }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions