Compare commits

...

6 Commits
0.8 ... master

10 changed files with 1150 additions and 982 deletions

View File

@ -7,6 +7,12 @@ bindir=$(DESTDIR)$(prefix)/bin
mandir=$(DESTDIR)$(prefix)/share/man/man1
datadir=$(DESTDIR)/etc
# See whether emacs is installed and try to guess its installation prefix.
emacs_prefix = $(patsubst %/bin/emacs,%,$(shell which emacs 2>/dev/null))
ifneq ($(strip $(emacs_prefix)),)
elispdir = $(emacs_prefix)/share/emacs/site-lisp
endif
# Check to see whether we have Jack installed. Needs pkg-config.
JACK := $(shell pkg-config --libs jack 2>/dev/null)
@ -18,7 +24,7 @@ INSTALL_TARGETS = midizap $(wildcard midizap.1)
.PHONY: all world install uninstall man pdf clean realclean
all: midizap
all: midizap midizap-mode.el
# This also creates the manual page (see below).
world: all man
@ -27,6 +33,12 @@ install: all
install -d $(bindir) $(datadir) $(mandir)
install midizap $(bindir)
install -m 0644 example.midizaprc $(datadir)/midizaprc
ifneq ($(elispdir),)
# If emacs was found, or elispdir was specified manually, install
# midizap-mode.el into the elispdir directory.
install -d $(DESTDIR)$(elispdir)
install -m 0644 midizap-mode.el $(DESTDIR)$(elispdir)
endif
# If present, the manual page will be installed along with the program.
ifneq ($(findstring midizap.1, $(INSTALL_TARGETS)),)
install -m 0644 midizap.1 $(mandir)
@ -56,7 +68,7 @@ midizap.pdf: midizap.1
man -Tpdf ./midizap.1 > $@
clean:
rm -f midizap keys.h $(OBJ)
rm -f midizap keys.h keys.el midizap-mode.el $(OBJ)
realclean:
rm -f midizap midizap.1 midizap.pdf keys.h $(OBJ)
@ -64,6 +76,12 @@ realclean:
keys.h: keys.sed /usr/include/X11/keysymdef.h
sed -f keys.sed < /usr/include/X11/keysymdef.h > keys.h
keys.el: keywords.sed /usr/include/X11/keysymdef.h
sed -f keywords.sed < /usr/include/X11/keysymdef.h | tr '\n' ' ' > keys.el
midizap-mode.el: midizap-mode.el.in keys.el
sed '/;; keysyms/r keys.el' < midizap-mode.el.in > midizap-mode.el
readconfig.o: midizap.h keys.h
midizap.o: midizap.h jackdriver.h
jackdriver.o: jackdriver.h

View File

@ -56,7 +56,7 @@ First, make sure that you have the required dependencies installed. The program
Then just run `make` and `sudo make install`. This installs the example.midizaprc file as /etc/midizaprc, and the midizap program and the manual page in the default install location. Usually this will be under /usr/local, but the installation prefix can be changed with the `prefix` variable in the Makefile. Also, package maintainers can use the `DESTDIR` variable to install into a staging directory for packaging purposes.
For users of the Emacs text editor we provide a midizap mode which does syntax-highlighting of midizaprc files and also lets you launch a midizap session in an Emacs buffer. The mode isn't installed automatically, but you can do this manually by copying the midizap-mode.el file to a directory on your Emacs load-path; please check midizap-mode.el in the sources for more detailed instructions.
For users of the Emacs text editor we provide a midizap mode which does syntax-highlighting of midizaprc files and also lets you launch a midizap session in an Emacs buffer. If Emacs was found during installation, the midizap-mode.el file is installed into the share/emacs/site-lisp directory along with the other files. The Makefile tries to guess the proper installation prefix, but if necessary you can also set the `elispdir` variable or copy the file manually to a directory on your Emacs load-path. Please check midizap-mode.el for more detailed instructions.
# Configuration File

59
examples/MP100.midizaprc Normal file
View File

@ -0,0 +1,59 @@
# Minimal Mackie emulation for the Harley Benton MP-100 a.k.a. MeloAudio MIDI
# Commander foot controller (https://meloaudio.com)
# This device is rather limited in what it can do as a Mackie controller (no
# feedback, just 4 switches, 4 toggles, and 2 continuous controllers), but it
# may still come in handy to guitarists for basic hands-free DAW control. Note
# that we can't make good use of the bank switches on the device (the two
# extra switches on the right), since these always emit a PC message, which
# interferes with our use of the PC messages for the transport controls. It
# may be possible to do something better by configuring a custom mode on the
# device, but here we stick to what's available in the factory settings.
# Copyright (c) 2019 Albert Graef <aggraef@gmail.com>
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any
# warranty.
JACK_NAME "midizap-MP100"
JACK_PORTS 1
# Auto-connect to the MP-100 on the input, and Ardour's Mackie control input
# on the output side.
JACK_IN TSMIDI.* MIDI 1
JACK_OUT ardour:mackie control in
# The following configuration assumes that the MP-100 is set to mode 1 (JAMP),
# which is the default. Note that the controller numbers for the top row and
# the expression pedal inputs are specific to JAMP mode, so you will have to
# adjust these if you run the device in a different host mode. As implemented
# below, the controls are laid out as follows:
# top row: [mute] [solo] [rec] [select] EXP1: volume (current channel)
# bottom row: [stop] [play] [chan<] [chan>] EXP2: volume (master)
[MIDI]
# Note that MCP expects a note-on/off pair for each activation of the
# mure/solo/rec/select switches, while the MP-100 top switches act as toggles,
# so we have to use suitable mod translations for the top row.
# top row (mute/solo/rec/select for current channel)
CC22[] E1{127} E1{0} # Mute
CC25[] G#0{127} G#0{0} # Solo
CC24[] C0{127} C0{0} # Rec
CC26[] C2{127} C2{0} # Select
# bottom row (basic transport and bank controls)
PC0 A7 # Stop
PC1 A#7 # Play
PC2 C4 # Channel Left
PC3 C#4 # Channel Right
# EXP-1 and EXP-2 (current channel and master volume)
CC4[] PB[129]-1 # Volume
CC7[] PB[129]-9 # Master

3
keywords.sed Normal file
View File

@ -0,0 +1,3 @@
/^\#define/!d
s/^\#define //
s/^\([^[:space:]]*\).*$/"\1"/

View File

@ -18,20 +18,26 @@
;;; work you'll need the auto-complete package available from MELPA, please
;;; check: https://github.com/auto-complete/auto-complete.
;;; In the midizap-mode subdirectory you'll find some snippets to be used with
;;; yasnippet (https://github.com/joaotavora/yasnippet); to use these, copy
;;; the entire folder to your ~/.emacs.d/snippets directory.
;;; Code:
(require 'comint)
(defconst midizap-keywords
(list
"DEBUG_REGEX" "DEBUG_STROKES" "DEBUG_KEYS" "DEBUG_MIDI"
"MIDI_OCTAVE" "JACK_NAME" "JACK_PORTS"
"JACK_IN" "JACK_IN1" "JACK_IN2"
"JACK_OUT" "JACK_OUT1" "JACK_OUT2"
"PASSTHROUGH" "SYSTEM_PASSTHROUGH"
"RELEASE" "SHIFT" "SHIFT1" "SHIFT2" "SHIFT3" "SHIFT4"
"CLASS" "TITLE"
))
"DEBUG_REGEX" "DEBUG_STROKES" "DEBUG_KEYS" "DEBUG_MIDI"
"MIDI_OCTAVE" "JACK_NAME" "JACK_PORTS"
"JACK_IN" "JACK_IN1" "JACK_IN2"
"JACK_OUT" "JACK_OUT1" "JACK_OUT2"
"PASSTHROUGH" "SYSTEM_PASSTHROUGH"
"RELEASE" "SHIFT" "SHIFT1" "SHIFT2" "SHIFT3" "SHIFT4"
"CLASS" "TITLE"
;; keysyms
))
;;;###autoload
(define-generic-mode 'midizap-mode

27
midizap-mode/midizaprc Normal file
View File

@ -0,0 +1,27 @@
# -*- mode: snippet -*-
# name: midizaprc template
# key: #
# --
# midizap configuration template for Emacs (requires yasnippet)
# Jack client name and ports/connections
# NOTE: Remove the JACK_PORTS and JACK_OUT lines if you don't need MIDI
# output. For bidirectional setups, use JACK_PORTS 2 and add JACK_IN2,
# JACK_OUT2 and a [MIDI2] section for the feedback connection.
JACK_NAME "${1:client-name}"
JACK_PORTS 1
JACK_IN ${2:controller-regex}
JACK_OUT ${3:application-regex}
# common debugging options (uncomment as needed)
#DEBUG_REGEX
#DEBUG_KEYS
#DEBUG_MIDI
# translations go here
[MIDI]

5
midizap-mode/section Normal file
View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: section header
# key: [
# --
[${1:name}] ${2:regex}

1937
midizap.1

File diff suppressed because it is too large Load Diff

View File

@ -1428,10 +1428,10 @@ handle_event(uint8_t *msg, uint8_t portno, int depth, int recursive)
} else if (msg[2] > 64) {
int step = get_cc_step(tr, portno, chan, msg[1], -1);
if (step) {
int d = (msg[2]-64)/step;
uint8_t d = (msg[2]-128)/step;
while (d) {
send_strokes(tr, portno, status, chan, msg[1], 0, 0, -1, depth);
d--;
d++;
}
}
}

51
midizap.scm Normal file
View File

@ -0,0 +1,51 @@
(define-module (guixpkgs midizap)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (gnu packages xorg)
#:use-module (gnu packages audio)
#:use-module (guix gexp))
(define-public midizap
(package
(name "midizap")
(version "0.8")
(source
(local-file "." "midizap" #:recursive? #t)
;; (origin
;; (method git-fetch)
;; (uri (git-reference
;; (url "https://github.com/agraef/midizap.git")
;; (commit version)))
;; (sha256
;; (base32
;; "0y31fnffl31n9lpkiw1dc3q4rnpfnras30n9y2h5j6586dkmgni4")))
)
(arguments
`(#:tests? #f ; no check target
#:make-flags
(list "CC=gcc"
(string-append "DESTDIR=" %output)
"prefix=")
#:phases
(modify-phases %standard-phases
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(substitute* "Makefile"
(("/usr/include/X11/")
(string-append (assoc-ref inputs "xorgproto") "/include/X11/"))
(("-lXtst") "-lXtst -ljack"))
#t)))))
;; (native-inputs `(("pkg-config" ,pkg-config)))
(inputs `(("jack" ,jack-1)
("libx11" ,libx11)
("libxtst" ,libxtst)
("xorgproto" ,xorgproto)))
(build-system gnu-build-system)
(home-page "")
(synopsis "")
(description "")
(license license:gpl2+)))
midizap