libxmp / libxmp/xmp-cli

New player commands: decrease/increase tempo factor.

Open
#77 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
84
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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 https://github.com/libxmp/libxmp/pull/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;
 	}
 }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/commands.c and review the libxmp 4.7.0 update requirement, using the referenced libxmp pull request as context. The work is done when player commands can increase and decrease the relative tempo factor and report the resulting factor.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.