~l3kn/org-fc

e31fada906bbcdebc4f0fd88b68f9921264726c0 — Leon Rische 4 months ago 684cf74
Add audio replay commands
2 files changed, 19 insertions(+), 0 deletions(-)

M docs/extensions.org
M org-fc-audio.el
M docs/extensions.org => docs/extensions.org +5 -0
@@ 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)~.


M org-fc-audio.el => org-fc-audio.el +14 -0
@@ 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)