summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2022-09-27 20:30:04 +0200
committerLeon Rische <leon.rische@me.com>2022-09-27 20:30:04 +0200
commite31fada906bbcdebc4f0fd88b68f9921264726c0 (patch)
tree8aacc35bc04084e682b55bf1b78f707e1c711d3b
parent684cf7435f446fd8b90fe0bffae74726b3a75f7d (diff)
Add audio replay commands
-rw-r--r--docs/extensions.org5
-rw-r--r--org-fc-audio.el14
2 files changed, 19 insertions, 0 deletions
diff --git a/docs/extensions.org b/docs/extensions.org
index 30dea9c..dbe6f22 100644
--- a/docs/extensions.org
+++ b/docs/extensions.org
@@ -16,6 +16,11 @@ Files are played using the ~mpv~ media player.
Commands:
- ~org-fc-audio-set-before~
- ~org-fc-audio-set-after~
+
+Each time an audio file is played, it's path is stored in
+~org-fc-audio-last-file~ and can be replayed using
+~org-fc-audio-replay~ or ~org-fc-audio-replay-slow~.
+
* ~org-fc-keymap-hint~
Can be enabled with ~(require 'org-fc-keymap-hint)~.
diff --git a/org-fc-audio.el b/org-fc-audio.el
index 2e95f7a..2774603 100644
--- a/org-fc-audio.el
+++ b/org-fc-audio.el
@@ -52,6 +52,8 @@
:type 'string
:group 'org-fc)
+(defvar org-fc-audio-last-file nil)
+
(defun org-fc-audio-set-before-setup (file)
"Set the befor-setup audio property of the current card to FILE."
(interactive "f")
@@ -79,6 +81,7 @@ the file at the given speed."
(defun org-fc-audio-play-file (file speed)
"Play the audio FILE at SPEED."
+ (setq org-fc-audio-last-file file)
(start-process-shell-command
"org-fc audio"
nil
@@ -96,6 +99,17 @@ the file at the given speed."
'org-fc-after-flip-hook
(lambda () (org-fc-audio-play org-fc-audio-after-flip-property)))
+(defun org-fc-audio-replay ()
+ (interactive)
+ (when org-fc-audio-last-file
+ (org-fc-audio-play-file org-fc-audio-last-file 1.0)))
+
+(defun org-fc-audio-replay-slow ()
+ (interactive)
+ (when org-fc-audio-last-file
+ (org-fc-audio-play-file org-fc-audio-last-file 0.7)))
+
+
;;; Footer
(provide 'org-fc-audio)