initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

94
timidity++/PKGBUILD Normal file
View File

@@ -0,0 +1,94 @@
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgname=timidity++
pkgver=2.14.0
_debver=$pkgver
_debrel=8
pkgrel=2
pkgdesc="A MIDI to WAVE converter and player"
arch=('i686' 'x86_64')
url='http://timidity.sourceforge.net'
license=('GPL-2')
depends=('flac' 'libao' 'libvorbis' 'portaudio' 'speex' 'jack')
makedepends=('libxaw3d' 'gtk2' 'tk' 'libxaw' 'libjack' 'quilt')
optdepends=('gtk2: for using the GTK+ interface'
'tk: for using the Tk interface'
'libxaw3d: for using the Xaw interface'
'sndio: for using the sndio audio output'
'freepats: additional files for MIDI audio synthesis')
backup=('etc/timidity++/timidity.cfg'
'etc/conf.d/timidity')
install=timidity.install
source=(https://downloads.sourceforge.net/timidity/TiMidity++-${pkgver}.tar.xz
https://deb.debian.org/debian/pool/main/t/timidity/timidity_${_debver}-${_debrel}.debian.tar.xz
timidity.cfg
timidity-jack.patch
timidity-tk86.patch
timidity-sndio.patch
timidity.confd
timidity.initd)
sha512sums=('d8fc06fa36e4dd42de80c61943da4cd9aec5f8aaf31057a9ededa633d2d48e64c4e53391378d82a7a46ffe4f96c756b010ea9727270f80b134ae1f8bad535bd3'
'3219c3f17b2b558643eb0c886984fba13d3e5954a7a0b9443910f601da7aea9205e4964545c589de70e937987e2fdbe0bd8b1b12f1fa0b76c9dc7cafdb17cd57'
'054cd39bef913314e9901171566398af6280236531ac13ece683eaeb642c52b3280116adaa6328054c94bd79b0ab88c253281e386012a2c6d67f4b85c38e4859'
'51c075da04aeedca4edecb5a7f1926ccb80637b550f8fafca6d68be466cd4353a77bbb832878941919ec354c279a6014403e995b9152a47a3817c99890a4afeb'
'f7c711fd7aaf924b4469f61780f8b6a282c11246e093b121597a098190ee3ab96964dcc0eb772dfe8232eb95bcfa8819e105eb0f7956b723f84a4df13e72ca98'
'641900474a89d844aa6857d1f2cd42f2e732fda2a0d7032901e4c73f3345e8e8806b84a379a8bf190c4cc80a2245d7b11640d5163cc9aebfeaa413feff40d155'
'63f11625298f214955d8d36690f18288c246c7701324be1e03d056dda145f2bd92f9fdd484061263cdd702260f8c808d9bbdb8c5a27a7a23ee7d1c08cb4dbfed'
'5ce0f8fcd9da26383455ba3fb931f01a0c07d54b4c5b05d0a3bc338bea509078dd9c6b01a5cc8d4a320ebae9e620040aea9ee9ceed71ed393210b753a181ae88')
prepare() {
cd TiMidity++-${pkgver}
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
# Debian patches
export QUILT_PATCHES=debian/patches
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
export QUILT_DIFF_ARGS='--no-timestamps'
mv "$srcdir"/debian .
quilt push -av
else
patch -p1 -i "${srcdir}/timidity-tk86.patch"
fi
patch -p1 -i "${srcdir}/timidity-jack.patch"
patch -p1 -i "${srcdir}/timidity-sndio.patch"
autoreconf -vfi
}
build() {
if [ $(uname -s) = HyperbolaBSD ]; then
_enable_ksnd=sun
elif [ $(uname -o) = GNU/Linux ]; then
_enable_ksnd=alsa
fi
cd TiMidity++-${pkgver}
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--with-default-path=/etc/timidity++/ \
--enable-server \
--enable-alsaseq \
--enable-spectrogram \
--enable-network \
--enable-xft \
--enable-audio=${_enable_ksnd},jack,sndio,ao,portaudio,flac,vorbis,speex \
--enable-dynamic=ncurses,tcltk,vt100,xaw,gtk
make
}
package() {
cd TiMidity++-${pkgver}
make DESTDIR="${pkgdir}" install
# configuration
install -Dm644 "${srcdir}/timidity.cfg" "${pkgdir}/etc/timidity++/timidity.cfg"
# services, only openrc for the moment
install -Dm644 "${srcdir}/timidity.confd" "${pkgdir}/etc/conf.d/timidity"
install -Dm755 "${srcdir}/timidity.initd" "${pkgdir}/etc/init.d/timidity"
# license
install -Dm644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

View File

@@ -0,0 +1,11 @@
diff -Naur TiMidity++-2.14.0-orig/timidity/jack_a.c TiMidity++-2.14.0/timidity/jack_a.c
--- TiMidity++-2.14.0-orig/timidity/jack_a.c 2014-09-26 22:08:51.531559553 -0400
+++ TiMidity++-2.14.0/timidity/jack_a.c 2014-09-26 22:11:12.864659285 -0400
@@ -508,6 +508,7 @@
pthread_cond_wait(&ctx->cond, &ctx->lock);
}
/* fallthrough */
+ case PM_REQ_PLAY_START:
case PM_REQ_DISCARD:
ctx->running = 0;
ringbuf_clear(&ctx->rbuf);

View File

@@ -0,0 +1,255 @@
diff --git a/configure.in b/configure.in
index 4f10340..c532167 100644
--- a/configure.in
+++ b/configure.in
@@ -859,8 +859,9 @@ dnl speex(S): Ogg Speex
dnl gogo(g): MP3 GOGO
dnl jack(j): JACK
dnl ao(O): Libao
+dnl sndio(o): sndio
-audio_targets='default oss alsa sun hpux irix mme sb_dsp w32 alib nas arts esd vorbis flac gogo portaudio npipe jack ao'
+audio_targets='default oss alsa sun hpux irix mme sb_dsp w32 alib nas arts esd vorbis flac gogo portaudio npipe jack ao sndio'
AC_ARG_WITH(nas-library,
AS_HELP_STRING([--with-nas-library=library], [NAS absolute library path(Don't use -laudio)]))
@@ -888,6 +889,7 @@ AC_ARG_ENABLE(audio,
npipe: Named Pipe(windows)
jack: JACK
ao: Libao
+ sndio: sndio
vorbis: Ogg Vorbis
flac: FLAC / OggFLAC
speex: Ogg Speex
@@ -914,7 +916,7 @@ AC_ARG_WITH(default-output,
[Specify default output mode (optional):
(default|alsa|alib|arts|nas|
esd|wav|au|aiff|list|vorbis|flac|speex|
- gogo|portaudio|npipe|jack|ao)]),
+ gogo|portaudio|npipe|jack|ao|sndio)]),
[ if test "$enable_audio" != no; then
DEFAULT_PLAYMODE=$withval
eval "au_enable_$DEFAULT_PLAYMODE=yes"
@@ -1356,6 +1358,22 @@ else
AC_MSG_RESULT(no)
fi
+dnl sndio
+AC_MSG_CHECKING(enable_audio=sndio)
+if test "x$au_enable_sndio" = xyes; then
+ AC_MSG_RESULT([yes, configuring sndio])
+ AC_CHECK_HEADERS(sndio.h)
+ if test "x${ac_cv_header_sndio_h}" = xyes ; then
+ EXTRADEFS="$EXTRADEFS -DAU_SNDIO"
+ SYSEXTRAS="$SYSEXTRAS sndio_a.c"
+ EXTRALIBS="$EXTRALIBS -lsndio"
+ else
+ AC_MSG_WARN(Couldn't configure sndio.)
+ fi
+else
+ AC_MSG_RESULT(no)
+fi
+
dnl ogg's vorbis
AC_MSG_CHECKING(enable_audio=vorbis)
if test "x$au_enable_vorbis" = xyes; then
@@ -1511,6 +1529,7 @@ case ".$DEFAULT_PLAYMODE" in
.gogo) TIMIDITY_OUTPUT_ID=g ;;
.jack) TIMIDITY_OUTPUT_ID=j ;;
.ao) TIMIDITY_OUTPUT_ID=O ;;
+ .sndio) TIMIDITY_OUTPUT_ID=o ;;
*) TIMIDITY_OUTPUT_ID= ;;
esac
AC_MSG_RESULT($DEFAULT_PLAYMODE/$TIMIDITY_OUTPUT_ID)
diff --git a/timidity/Makefile.am b/timidity/Makefile.am
index 4802b5f..d8e52b8 100644
--- a/timidity/Makefile.am
+++ b/timidity/Makefile.am
@@ -139,6 +139,7 @@ EXTRA_timidity_SOURCES = \
mfnode.h \
nas_a.c \
portaudio_a.c \
+ sndio_a.c \
npipe_a.c \
sun_a.c \
vorbis_a.c \
diff --git a/timidity/output.c b/timidity/output.c
index 2fec198..84dac8e 100644
--- a/timidity/output.c
+++ b/timidity/output.c
@@ -116,6 +116,10 @@ extern PlayMode nas_play_mode;
extern PlayMode ao_play_mode;
#endif /* AU_AO */
+#ifdef AU_SNDIO
+extern PlayMode sndio_play_mode;
+#endif /* AU_SNDIO */
+
#ifndef __MACOS__
/* These are always compiled in. */
extern PlayMode raw_play_mode, wave_play_mode, au_play_mode, aiff_play_mode;
@@ -142,6 +146,10 @@ PlayMode *play_mode_list[] = {
&ao_play_mode,
#endif /* AU_AO */
+#if defined(AU_SNDIO)
+ &sndio_play_mode,
+#endif /* AU_SNDIO */
+
#if defined(AU_ARTS)
&arts_play_mode,
#endif /* AU_ARTS */
diff --git b/timidity/sndio_a.c b/timidity/sndio_a.c
new file mode 100644
index 0000000..22ad939
--- /dev/null
+++ b/timidity/sndio_a.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2008 IWATA Ray <iwata@quasiquote.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+#include <sndio.h>
+
+#include "timidity.h"
+#include "output.h"
+#include "controls.h"
+#include "timer.h"
+#include "instrum.h"
+#include "playmidi.h"
+#include "miditrace.h"
+
+static int open_output(void); /* 0=success, 1=warning, -1=fatal error */
+static void close_output(void);
+static int output_data(char *buf, int32 nbytes);
+static int acntl(int request, void *arg);
+
+/* export the playback mode */
+
+#define dpm sndio_play_mode
+
+PlayMode dpm = {
+ DEFAULT_RATE, PE_SIGNED|PE_16BIT, PF_PCM_STREAM,
+ -1,
+ {0}, /* default: get all the buffer fragments you can */
+ "sndio mode", 'o',
+ NULL,
+ open_output,
+ close_output,
+ output_data,
+ acntl
+};
+
+static struct sio_hdl *sndio_ctx;
+
+static int open_output(void)
+{
+ static struct sio_par par, newpar;
+
+ sndio_ctx = sio_open(NULL, SIO_PLAY, 0);
+ if (sndio_ctx == NULL) {
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "sio_open() failed");
+ return -1;
+ }
+
+ sio_initpar(&par);
+
+ par.sig = 1;
+ par.pchan = (dpm.encoding & PE_MONO) ? 1 : 2;
+ par.le = SIO_LE_NATIVE;
+ par.rate = dpm.rate;
+ if (dpm.encoding & PE_24BIT) {
+ par.bits = 24;
+ par.bps = 3;
+ } else if (dpm.encoding & PE_16BIT) {
+ par.bits = 16;
+ par.bps = 2;
+ } else {
+ par.bits = 8;
+ par.bps = 1;
+ }
+
+ if (!sio_setpar(sndio_ctx, &par)) {
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "sio_setpar() failed");
+ return -1;
+ }
+
+ if (sio_getpar(sndio_ctx, &newpar) == 0) {
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "sio_getpar() failed");
+ return -1;
+ }
+ if (newpar.sig != par.sig ||
+ newpar.le != par.le ||
+ newpar.pchan != par.pchan ||
+ newpar.bits != par.bits ||
+ newpar.bps != par.bps ||
+ newpar.rate * 1000 > par.rate * 1005 ||
+ newpar.rate * 1000 < par.rate * 995) {
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "couldn't set output play parameters");
+ return -1;
+ }
+
+ if (!sio_start(sndio_ctx)) {
+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "sio_start() failed");
+ return -1;
+ }
+ return 0;
+}
+
+static int output_data(char *buf, int32 nbytes)
+{
+ if (!sio_write(sndio_ctx, buf, nbytes)) {
+ ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "sio_write() failed");
+ return -1;
+ }
+ return 0;
+}
+
+static void close_output(void)
+{
+ if (sndio_ctx != NULL) {
+ sio_close(sndio_ctx);
+ sndio_ctx = NULL;
+ }
+}
+
+static int acntl(int request, void *arg)
+{
+ switch(request) {
+ case PM_REQ_DISCARD:
+ case PM_REQ_PLAY_START: /* Called just before playing */
+ case PM_REQ_PLAY_END: /* Called just after playing */
+ return 0;
+ }
+ return -1;
+}
+
diff --git a/timidity/timidity.c b/timidity/timidity.c
index 4a4d601..894f55a 100644
--- a/timidity/timidity.c
+++ b/timidity/timidity.c
@@ -4049,7 +4049,8 @@ static int parse_opt_h(const char *arg)
" `l' linear encoding" NLS
" `U' U-Law encoding" NLS
" `A' A-Law encoding" NLS
-" `x' byte-swapped output" NLS, fp);
+" `x' byte-swapped output" NLS
+" `o' signed output" NLS, fp);
fputs(NLS, fp);
fputs("Alternative output format long options:" NLS
" --output-stereo" NLS

View File

@@ -0,0 +1,39 @@
--- a/interface/tk_c.c
+++ b/interface/tk_c.c
@@ -65,6 +65,9 @@
#define TKPROGPATH PKGLIBDIR "/tkmidity.tcl"
#endif /* TKPROGPATH */
+#if (TCL_MAJOR_VERSION < 8)
+#define Tcl_GetStringResult(interp) (interp->result)
+#endif
static void ctl_refresh(void);
static void ctl_total_time(int tt);
@@ -117,7 +120,7 @@
static void start_panel(void);
-#define MAX_TK_MIDI_CHANNELS 16
+#define MAX_TK_MIDI_CHANNELS 32
typedef struct {
int reset_panel;
@@ -933,7 +936,7 @@
}
/* evaluate Tcl script */
-static char *v_eval(char *fmt, ...)
+static const char *v_eval(char *fmt, ...)
{
char buf[256];
va_list ap;
@@ -941,7 +944,7 @@
vsnprintf(buf, sizeof(buf), fmt, ap);
Tcl_Eval(my_interp, buf);
va_end(ap);
- return my_interp->result;
+ return Tcl_GetStringResult(my_interp);
}
static const char *v_get2(const char *v1, const char *v2)

29
timidity++/timidity.cfg Normal file
View File

@@ -0,0 +1,29 @@
# details on this file and other examples see here:
# http://www.onicos.com/staff/iz/timidity/dist/cfg/sndfont.cfg
# http://www.onicos.com/staff/iz/timidity/dist/cfg/
#----------------------------------------------------------------
# SoundFont extension configuration
#
# soundfont <filename> [order={0|1}] [remove]
# <filename> is the path of SoundFont file.
# order: 0(preload) or 1(load after GUS).
# remove: disable specified soundfont.
#
# font exclude <tonebank> [<preset> [<keynote>]]
# font order {0|1} <tonebank> [<preset> [<keynote>]]
# <tonebank>: 0-127
#
# font exclude 128 [<drumset> [<key>]]
# font order {0|1} 128 [<drumset> [<key>]]
#----------------------------------------------------------------
# change the next line to point to a soundfont you have
# soundfonts can be found e.g. here: http://www.hammersound.net/
# soundfont /usr/share/soundfonts/DX7Piano.SF2
# you can do manipulations of the soundfont you load like this:
# e.g. removing drumset 99
# font exclude 128 99
# load drum samples after GUS patches
# font order 1 128

31
timidity++/timidity.confd Normal file
View File

@@ -0,0 +1,31 @@
# TIMIDITY_OPTS
# Command line arguments to be passed to timidity. -iA is always used
# Common options:
# -Os : Output to ALSA pcm device
# -Oo : Output to sndio device
# -Oe : Output to esd
# -On : Output to NAS
#
# -B<n>,<m> : Set number of buffer fragments(n), and buffer size(2^m)
#
# -EFreverb=0 : Disable MIDI reverb effect control
# -EFreverb=1[,level] : Enable MIDI reverb effect control
# `level' is optional to specify reverb level [0..127]
# This effect is only available in stereo
# (default)
# -EFreverb=2 : Global reverb effect
#
# See the timidity(1) man page for more info.
TIMIDITY_OPTS="-B2,8 -Os -EFreverb=0"
#TIMIDITY_OPTS="-Oo -EFreverb=0"
# TIMIDITY_PCM_NAME
# This option can be used to choose an alternate ALSA pcm device. This will
# be most useful for users of the dmix alsa plugin or those with multiple
# cards. If you don't know what this is, chances are you want the default.
#TIMIDITY_PCM_NAME="hw:0"
#LADSPA plugins library path
LADSPA_PATH="/usr/lib/ladspa"

22
timidity++/timidity.initd Normal file
View File

@@ -0,0 +1,22 @@
#!/sbin/openrc-run
# Copyright 2019 Hyperbola Project
# Distributed under the terms of the GNU General Public License v2
depend() {
after alsasound esound sndiod
}
start() {
ebegin "Starting TiMidity++ Virtual Midi Sequencer"
test -n "$TIMIDITY_PCM_NAME" && export TIMIDITY_PCM_NAME
start-stop-daemon --start --background --chdir /var/lib/timidity \
--user timidity --group audio --make-pidfile --pidfile /run/timidity.pid \
--exec /usr/bin/timidity -- -iA ${TIMIDITY_OPTS}
eend $?
}
stop() {
ebegin "Stopping TiMidity++"
start-stop-daemon --stop --quiet --pidfile /run/timidity.pid
eend $?
}

View File

@@ -0,0 +1,27 @@
post_install() {
if ! getent passwd timidity &>/dev/null; then
useradd -r -g audio -d /var/lib/timidity -s /bin/nologin timidity >/dev/null
fi
if ! groups timidity | grep audio &>/dev/null; then
gpasswd -a timidity audio >/dev/null
fi
timidity_shell=$(getent passwd timidity | cut -d: -f7)
if [ "$timidity_shell" != '/bin/nologin' ]; then
chsh -s /bin/nologin timidity &>/dev/null
fi
if [[ ! -d /var/lib/timidity ]]; then
mkdir -p /var/lib/timidity
fi
chown -R timidity:audio /var/lib/timidity
}
post_upgrade() {
post_install
}
post_remove() {
echo "-- You may want to remove /var/lib/timidity"
if getent passwd timidity &>/dev/null; then
userdel timidity >/dev/null
fi
}