SUMMARY="An advanced MIDI sequencer"
DESCRIPTION="Sequitur is a BeOS-native MIDI sequencer with a MIDI processing \
add-on architecture. It allows you to record, compose, store, and play back \
music from your computer. Sequitur is designed for people who like to tinker \
with their music. It facilitates rapid, dynamic, and radical processing of \
your performance.

Features:

* An add-on architecture for processing MIDI and performing MIDI effects. \
Change a track's velocity, apply echo, add chorus, change its key signature, \
etc.
* MIDI processing is integrated with editing: Paint with echo effects, paint \
chords in key, etc.
* Easily rearrange songs with familiar phrase operations.
* Customize your interface with skinning.
* Achieve special effects with tool properties: Turn on gradual delete and \
slowly rub out MIDI events.
* Record, edit, and playback note, program change, control change, and pitch \
bend MIDI data.
* Read and write standard MIDI files."
HOMEPAGE="https://github.com/HaikuArchives/Sequitur"
COPYRIGHT="2001 Eric Hackborn"
LICENSE="Public Domain"
REVISION="3"
srcGitRev="d7a863be31802132f7d5c76dc50e78e6f100ac13"
SOURCE_URI="https://github.com/HaikuArchives/Sequitur/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="a56672bad0c52034ad4de8700fd00eb441ce50d2e1a4dfcc7a2ed6756046ea66"
SOURCE_DIR="Sequitur-$srcGitRev"

ARCHITECTURES="all"

USER_SETTINGS_FILES="
	settings/Sequitur directory
	"

PROVIDES="
	sequitur = $portVersion
	app:Sequitur = $portVersion
	"
REQUIRES="
	haiku
	lib:libpng16
	lib:libz
	"

SUMMARY_devices="Legacy device definitions for Sequitur"
DESCRIPTION_devices="This package contains device definitions for legacy \
devices for the MIDI sequencer Sequitur. Included are definitions for:

- Alesis QS8 (Program)
- E-mu EOS
- E-mu Planet Earth
- E-mu Proteus 2000
- E-mu Xtreme Lead-1
- Roland JV-1010
- Roland MT-32
- Roland V-Drums TD-8
- Waldorf MicroQ"
PROVIDES_devices="
	sequitur_devices = $portVersion
	"
REQUIRES_devices="
	sequitur == $portVersion base
	"

BUILD_REQUIRES="
	haiku_devel
	devel:libpng16
	devel:libz
	"
BUILD_PREREQUIRES="
	makefile_engine
	cmd:gcc
	cmd:make
	"

# For the time being the _debuginfo package has to be generated separately, as
# currently all resources would be stripped as well (TODO). For that, uncomment
# the following defineDebugInfoPackage() and comment the strip&xres block in
# the INSTALL() below.
#
#defineDebugInfoPackage sequitur \
#	$appsDir/Sequitur/lib/libAmKernel.so \
#	$appsDir/Sequitur/Sequitur \
#	$appsDir/Sequitur/add-ons/Filters/ArpChorus \
#	$appsDir/Sequitur/add-ons/Filters/ArpConsole \
#	$appsDir/Sequitur/add-ons/Filters/ArpControllerLimiter \
#	$appsDir/Sequitur/add-ons/Filters/ArpControllerMap \
#	$appsDir/Sequitur/add-ons/Filters/ArpControllerRange \
#	$appsDir/Sequitur/add-ons/Filters/ArpCopy \
#	$appsDir/Sequitur/add-ons/Filters/ArpDan \
#	$appsDir/Sequitur/add-ons/Filters/ArpDianne \
#	$appsDir/Sequitur/add-ons/Filters/ArpDissolve \
#	$appsDir/Sequitur/add-ons/Filters/ArpDuration \
#	$appsDir/Sequitur/add-ons/Filters/ArpEatDuplicates \
#	$appsDir/Sequitur/add-ons/Filters/ArpEcho \
#	$appsDir/Sequitur/add-ons/Filters/ArpEric \
#	$appsDir/Sequitur/add-ons/Filters/ArpErode \
#	$appsDir/Sequitur/add-ons/Filters/ArpEventMap \
#	$appsDir/Sequitur/add-ons/Filters/ArpInverse \
#	$appsDir/Sequitur/add-ons/Filters/ArpKeyboardSplitter \
#	$appsDir/Sequitur/add-ons/Filters/ArpMerge \
#	$appsDir/Sequitur/add-ons/Filters/ArpMetronome \
#	$appsDir/Sequitur/add-ons/Filters/ArpMonophobic \
#	$appsDir/Sequitur/add-ons/Filters/ArpMotionControl \
#	$appsDir/Sequitur/add-ons/Filters/ArpMotionSplitter \
#	$appsDir/Sequitur/add-ons/Filters/ArpNote \
#	$appsDir/Sequitur/add-ons/Filters/ArpOnKey \
#	$appsDir/Sequitur/add-ons/Filters/ArpOscillator \
#	$appsDir/Sequitur/add-ons/Filters/ArpPandemic \
#	$appsDir/Sequitur/add-ons/Filters/ArpParticleDecay \
#	$appsDir/Sequitur/add-ons/Filters/ArpPinkNoise \
#	$appsDir/Sequitur/add-ons/Filters/ArpQuantize \
#	$appsDir/Sequitur/add-ons/Filters/ArpReverse \
#	$appsDir/Sequitur/add-ons/Filters/ArpRubberStamp \
#	$appsDir/Sequitur/add-ons/Filters/ArpSelective \
#	$appsDir/Sequitur/add-ons/Filters/ArpShortShift \
#	$appsDir/Sequitur/add-ons/Filters/ArpTilTheEnd \
#	$appsDir/Sequitur/add-ons/Filters/ArpTimeStretch \
#	$appsDir/Sequitur/add-ons/Filters/ArpTranspose \
#	$appsDir/Sequitur/add-ons/Filters/ArpUncertainChorus \
#	$appsDir/Sequitur/add-ons/Filters/ArpUncertainShuttle \
#	$appsDir/Sequitur/add-ons/Filters/ArpUnquantize \
#	$appsDir/Sequitur/add-ons/Filters/ArpUnstack \
#	$appsDir/Sequitur/add-ons/Filters/ArpVaccine \
#	$appsDir/Sequitur/add-ons/Filters/ArpVelociTease \
#	$appsDir/Sequitur/add-ons/Filters/ArpVelocityMap \
#	$appsDir/Sequitur/add-ons/Filters/ArpVelocitySplitter \
#	$appsDir/Sequitur/add-ons/Filters/ArpWipeOut

BUILD()
{
	cd Sequitur
	make $jobArgs
}

INSTALL()
{
	cd Sequitur

# strip debug info and re-add resources
# -------------------------------------
	strip -S lib/libAmKernel.so
	strip -S Sequitur
	xres -o Sequitur Sequitur.rsrc SequiturSkin.rsrc

	pushd add-ons/Filters
	strip -S *
	for i in * ; do
		xres -o $i ../../../AmFilters/$i.rsrc
	done
	popd
# -------------------------------------

	cacheDir=`finddir B_USER_CACHE_DIRECTORY`/Sequitur

	mkdir -p $appsDir/Sequitur/lib \
				$appsDir/Sequitur/add-ons \
				$appsDir/Sequitur/Devices \
				$appsDir/Sequitur/Documentation \
				$appsDir/Sequitur/Examples \
				$appsDir/Sequitur/Motions \
				$appsDir/Sequitur/MultiFilters \
				$appsDir/Sequitur/Skins \
				$appsDir/Sequitur/Tools \
				$cacheDir

	cp -a lib/libAmKernel.so $appsDir/Sequitur/lib
	cp -rL add-ons $appsDir/Sequitur/
	cp -r Devices $appsDir/Sequitur/
	cp -r Documentation $appsDir/Sequitur/
	cp -r Examples $appsDir/Sequitur/
	cp -r Motions $appsDir/Sequitur/
	cp -r MultiFilters $appsDir/Sequitur/
	cp -r Skins $appsDir/Sequitur/
	cp -r Tools $appsDir/Sequitur/
	cp -a Sequitur $appsDir/Sequitur/

	# Remove documentation files that are generated by Sequitur
	rm $appsDir/Sequitur/Documentation/UsersGuide/images/gen_*.png
	rm $appsDir/Sequitur/Documentation/UsersGuide/*_generated.html

	# Sequitur generates the filters and tools guide on the fly in the $cacheDir.
	# Link the two generated guides back into the Documentation folder.
	ln -s $cacheDir/a_filters_generated.html $appsDir/Sequitur/Documentation/UsersGuide
	ln -s $cacheDir/b_tools_generated.html $appsDir/Sequitur/Documentation/UsersGuide

	addAppDeskbarSymlink $appsDir/Sequitur/Sequitur

	# legacy devices package
	packageEntries devices \
		"$appsDir/Sequitur/Devices/Alesis QS8 (Program)" \
		"$appsDir/Sequitur/Devices/E-mu EOS" \
		"$appsDir/Sequitur/Devices/E-mu Planet Earth" \
		"$appsDir/Sequitur/Devices/E-mu Proteus 2000" \
		"$appsDir/Sequitur/Devices/E-mu Xtreme Lead-1" \
		"$appsDir/Sequitur/Devices/Roland JV-1010" \
		"$appsDir/Sequitur/Devices/Roland MT-32" \
		"$appsDir/Sequitur/Devices/Roland V-Drums TD-8" \
		"$appsDir/Sequitur/Devices/Waldorf MicroQ"
}
