[Demudi-commits] r30 - / vkeybd vkeybd/trunk vkeybd/trunk/debian vkeybd/trunk/pixmaps
Free Ekanayaka
free-guest@haydn.debian.org
Thu, 28 Oct 2004 04:29:04 -0600
Author: free-guest
Date: 2004-10-28 04:28:42 -0600 (Thu, 28 Oct 2004)
New Revision: 30
Added:
vkeybd/
vkeybd/tags/
vkeybd/trunk/
vkeybd/trunk/.cvsignore
vkeybd/trunk/ChangeLog
vkeybd/trunk/Makefile
vkeybd/trunk/README
vkeybd/trunk/debian/
vkeybd/trunk/debian/changelog
vkeybd/trunk/debian/control
vkeybd/trunk/debian/copyright
vkeybd/trunk/debian/dirs
vkeybd/trunk/debian/docs
vkeybd/trunk/debian/manpages
vkeybd/trunk/debian/rules
vkeybd/trunk/debian/sftovkb.sgml
vkeybd/trunk/debian/tmp
vkeybd/trunk/debian/vkeybd.menu
vkeybd/trunk/debian/vkeybd.sgml
vkeybd/trunk/debian/watch
vkeybd/trunk/fskip.c
vkeybd/trunk/itypes.h
vkeybd/trunk/malloc.c
vkeybd/trunk/oper_alsa.c
vkeybd/trunk/oper_awe.c
vkeybd/trunk/oper_midi.c
vkeybd/trunk/pixmaps/
vkeybd/trunk/pixmaps/vkeybd_16x16.png
vkeybd/trunk/pixmaps/vkeybd_32x32.png
vkeybd/trunk/pixmaps/vkeybd_48x48.png
vkeybd/trunk/sffile.c
vkeybd/trunk/sffile.h
vkeybd/trunk/sftovkb.1
vkeybd/trunk/sftovkb.c
vkeybd/trunk/util.h
vkeybd/trunk/vkb.c
vkeybd/trunk/vkb.h
vkeybd/trunk/vkb_device.c
vkeybd/trunk/vkeybd.1
vkeybd/trunk/vkeybd.desktop
vkeybd/trunk/vkeybd.list
vkeybd/trunk/vkeybd.man
vkeybd/trunk/vkeybd.spec
vkeybd/trunk/vkeybd.tcl
vkeybd/trunk/vkeybdmap
vkeybd/trunk/vkeybdmap-german
Log:
[svn-inject] Installing original source of vkeybd
Added: vkeybd/trunk/.cvsignore
===================================================================
--- vkeybd/trunk/.cvsignore 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/.cvsignore 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,2 @@
+vkeybd
+sftovkb
Added: vkeybd/trunk/ChangeLog
===================================================================
--- vkeybd/trunk/ChangeLog 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/ChangeLog 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,35 @@
+2004-08-31 ver.0.1.17
+ * bind left and right keys to shift keybase.
+ * removed 'q' key binding, added ctrl-q instead.
+ * save keymap file separately in ~/.vkeybdmap.
+ default file is load from /usr/share/vkeybd/vkeybdmap.
+ * save octave value to the config file.
+
+2004-03-03 ver.0.1.16
+ * added desktop file and icon png files (courtesy of Ivo Clarysse).
+ * fixed fskip.c.
+
+2003-11-20 ver.0.1.15
+ * fixed the compilation with ALSA 1.0.0.
+ * fix for ladcca-0.4.0 by Jacob Meuser.
+2003-08-19 ver.0.1.14
+ * added the support of standard "--x=y" style options.
+ * send program change immediately in ALSA mode.
+ * added --laddca option. set "no" as default.
+
+2003-07-03 ver.0.1.13a
+ * fixed for new LADCCA API
+ * removed debug messages
+
+2003-01-23 ver.0.1.13
+ * fixed compile warnings (with the recent tcl/tk)
+ * LADCCA support
+ * README clean up
+ * added vkeybdrc_german example by Matthias Nagorni
+
+2002-07-25 ver.0.1.12
+ * don't override default key-bindings if defined
+ * fixed for the newer tcl/tk
+
+2002-02-22 ver.0.1.11a
+ * fixed mouse motion on black keys
Added: vkeybd/trunk/Makefile
===================================================================
--- vkeybd/trunk/Makefile 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/Makefile 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,125 @@
+#
+# Makefile for vkeybd
+# copyright (c) 1997-2000 by Takashi Iwai
+#
+
+VERSION = 0.1.16
+
+#
+# installation directory
+#
+PREFIX = /usr
+# binary and Tcl script are put there
+BIN_DIR = $(PREFIX)/bin
+# man page
+MAN_SUFFIX = 1
+MAN_DIR = $(PREFIX)/share/man
+
+# data directory (/usr/share)
+DATA_DIR = $(PREFIX)/share
+
+#
+# preset and keyboard file are put here
+#
+VKBLIB_DIR = $(DATA_DIR)/vkeybd
+
+#
+# device selections -- multiple avaialble
+# to disable the device, set value 0 (do not comment out!)
+#
+USE_AWE = 1
+USE_MIDI = 1
+USE_ALSA = 1
+USE_LADCCA = 0
+
+#
+# Tcl/Tk library -- depends on your distribution
+#
+TCL_VERSION = 8.4
+TCLLIB = -ltcl$(TCL_VERSION)
+TCLINC = -I/usr/include/tcl8.4
+TKLIB = -ltk$(TCL_VERSION)
+TKINC =
+XLIB = -L/usr/X11R6/lib -lX11
+XINC = -I/usr/X11R6/include
+EXTRALIB += -ldl
+
+#----------------------------------------------------------------
+# device definitions
+#----------------------------------------------------------------
+
+# AWE device
+ifeq (1,$(USE_AWE))
+DEVICES += -DVKB_USE_AWE
+DEVOBJS += oper_awe.o
+endif
+
+# MIDI device
+ifeq (1,$(USE_MIDI))
+DEVICES += -DVKB_USE_MIDI
+DEVOBJS += oper_midi.o
+endif
+
+# ALSA sequencer
+ifeq (1,$(USE_ALSA))
+DEVICES += -DVKB_USE_ALSA
+DEVOBJS += oper_alsa.o
+EXTRALIB += -lasound
+endif
+
+#
+# LADCCA stuff
+#
+ifeq (1,$(USE_LADCCA))
+LADCCACFLAGS = $(shell pkg-config --cflags ladcca-1.0) \
+ $(shell pkg-config --exists ladcca-1.0 && echo "-DHAVE_LADCCA" )
+LADCCALIBS = $(shell pkg-config --libs ladcca-1.0)
+DEVICES += $(LADCCACFLAGS)
+EXTRALIB += $(LADCCALIBS)
+endif
+
+#----------------------------------------------------------------
+# dependencies
+#----------------------------------------------------------------
+
+VKB_TCLFILE = $(VKBLIB_DIR)/vkeybd.tcl
+
+CFLAGS = -Wall -O -DVKB_TCLFILE=\"$(VKB_TCLFILE)\" \
+ -DVKBLIB_DIR=\"$(VKBLIB_DIR)\"\
+ -DVERSION_STR=\"$(VERSION)\"\
+ $(DEVICES) $(XINC) $(TCLINC) $(TKINC) $(LADCCACFLAGS)
+
+TARGETS = vkeybd sftovkb
+
+all: $(TARGETS)
+
+vkeybd: vkb.o vkb_device.o $(DEVOBJS) $(EXTRAOBJS)
+ $(CC) -o $@ $^ $(TKLIB) $(TCLLIB) $(XLIB) $(EXTRALIB) -lm
+
+sftovkb: sftovkb.o sffile.o malloc.o fskip.o
+ $(CC) -o $@ $^ -lm
+
+install: $(TARGETS) vkeybd.tcl vkeybd.list vkeybdmap*
+ mkdir -p $(DESTDIR)$(BIN_DIR)
+ install -c -m 755 vkeybd $(DESTDIR)$(BIN_DIR)
+ install -c -m 755 sftovkb $(DESTDIR)$(BIN_DIR)
+ rm -f $(DESTDIR)$(BIN_DIR)/vkeybd.tcl
+ mkdir -p $(DESTDIR)$(VKBLIB_DIR)
+ install -c -m 444 vkeybd.tcl $(DESTDIR)$(VKBLIB_DIR)
+ install -c -m 444 vkeybd.list $(DESTDIR)$(VKBLIB_DIR)
+ install -c -m 444 vkeybdmap* $(DESTDIR)$(VKBLIB_DIR)
+
+install-man:
+ mkdir -p $(DESTDIR)$(MAN_DIR)/man$(MAN_SUFFIX)
+ install -c -m 444 vkeybd.man $(DESTDIR)$(MAN_DIR)/man$(MAN_SUFFIX)/vkeybd.$(MAN_SUFFIX)
+
+install-desktop:
+ mkdir -p $(DESTDIR)$(DATA_DIR)/applications
+ install -c -m 644 vkeybd.desktop $(DESTDIR)$(DATA_DIR)/applications
+ mkdir -p $(DESTDIR)$(DATA_DIR)/pixmaps
+ install -c -m 644 pixmaps/*.png $(DESTDIR)$(DATA_DIR)/pixmaps
+
+install-all: install install-man install-desktop
+
+clean:
+ rm -f *.o $(TARGETS)
Added: vkeybd/trunk/README
===================================================================
--- vkeybd/trunk/README 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/README 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,276 @@
+====================================================================
+ VIRTUAL KEYBOARD ver.0.1.17
+ Takashi Iwai <tiwai@suse.de>
+====================================================================
+
+GENERAL NOTES
+-------------
+
+This is a virtual keyboard for AWE, MIDI and ALSA drivers.
+It's a simple fake of a MIDI keyboard on X-windows system.
+Enjoy a music with your mouse and "computer" keyboard :-)
+
+The program requires Tcl7.5/Tk4.1 or newer libraries.
+This program supports:
+ - ALSA sequencer (ver.0.5.x or 0.9.x)
+ - AWE driver on OSS (ver.0.4.3)
+ - MIDI device on OSS and ALSA
+Since the most of the part is written by Tcl/Tk script, it'll be not
+so difficult to apply this program to other systems.
+
+
+INSTALLATION
+------------
+
+1. Edit Makefile
+
+You may need to modify Makefile for your system.
+The following values can be configurable:
+
+ - PREFIX
+ Destination directory prefix (e.g. /usr/local)
+ - BIN_DIR
+ Destination directory where the program will be installed.
+ - VKLIB_DIR
+ Directory where vkeybd Tcl file, key list and preset list files
+ are stored.
+ - MAN_DIR
+ Man page prefix directory (e.g. /usr/local/man)
+ - MAN_SUFFIX
+ Man page prefix
+
+ - USE_ALSA
+ - USE_AWE
+ - USE_MIDI
+ Device selection. Multiple devices are available.
+ To disable a device, set the value 0. Do not undefine it.
+ At least one of them must have non-zero value.
+
+ - USE_LADCCA
+ Supports LADCCA (http://pkl.net/~node/software/)
+ Set 1 to add the this support.
+
+ - TCLLIB
+ Tcl library for linking, given as "-lxxx"
+ - TCLINC
+ Tcl include path option for cc, given as "-Ixxx"
+ - TKLIB, XLIB
+ Tk and X libraries (-lxxx)
+ - TKINC, XINC
+ Tk and X include path option (-Ixxx)
+ - EXTRALIB
+ Other required library (-lxxx)
+
+2. Run make.
+
+3. Install via "make install".
+
+
+USAGE
+-----
+
+Load the soundfont via sfxload utility before using this program.
+Then, just start vkeybd. The following command line options are
+accpted.
+
+Common Options:
+ --device mode
+ Use the specified mode for output device.
+ The argument are "awe", "midi" or "alsa", for AWE/OSS,
+ MIDI/OSS and ALSA devices, respectively.
+ Default is alsa.
+ --config file
+ Use the specified file as config file (see below)
+ --preset file
+ Use the specified file as preset list file (see below)
+ --channel num
+ Specify the channel to be played for normal instruments.
+ Valid only for MIDI and ALSA devices. Default is 0.
+ --drum num
+ Specify the channel to be played for drum instruments.
+ Valid only for MIDI and ALSA devices. Default is 9.
+ --octave num
+ Specify the number of octaves to display keys.
+ Default is 3.
+
+ALSA Device Option:
+ --addr client:port or 's'
+ Set ALSA client and port numbers to be connected.
+ If argument begins with 's', the port is opened as subscription
+ port, and events are sent to all subscribers. Otherwise,
+ vkeybd connects directly to the specified port.
+ Default is 's'.
+ --name string
+ Specify the name of client/port. Some applications like
+ tk707 check the client/port name whether it is a valid MIDI
+ device port. This options makes vkeybd possible to "fake"
+ as a real MIDI device.
+ --ladcca bool
+ Specify the support of LADCCA. Give yes or no as the
+ argument. The default value is no.
+
+OSS Sequencer Device Option:
+ --seqdev file
+ Specify the device file path for sequencer access.
+ As default /dev/sequencer is used.
+ --seqidx num
+ Specify the synth device index for AWE32/64 WaveTable.
+ If negative value is given, the device is auto-probed.
+ Default value is -1.
+
+MIDI Device Option:
+ --mididev file
+ Speicfy the file path of MIDI device.
+ Default value is /dev/midi.
+
+
+FILE MENU
+---------
+
+"Connection" shows whether the vkeybd connects to the device.
+On OSS system, only one application is allowed to access sequencer
+device. Thus, if one wants to play another program even using another
+device, he needs to disconnect vkeybd once. On ALSA or OSS emulation
+on ALSA, you don't have to switch vkeybd off, since multiple access is
+allowed.
+
+With "Save Config", the current keymap and view configuration are
+saved on ~/.vkeybdrc config file. This file will be read at the next
+invoke.
+
+VIEW MENU
+---------
+
+Thie menu shows the check buttons to toggle the display of control
+buttons.
+
+With "Key/Velocity" button, a key and a velocity scale bars are
+shown. The key scale indicates the lowest note value of the visible
+keyboard (as default 48 = C4). The velocity scale bar is used to
+change the velocity of each note-on.
+
+With "Control" button, controls for the current channel and for the
+MIDI continous-controls are enabled. The channel number is increased
+or decreased by clicking the right or left button around the shown
+channel number. The bank and preset are remembered for each channel.
+You may choose the CC to be adjusted by pull-down menu, which
+indicates "ModWheel" as default. Then change the parameter value with
+the scale bar at the right side.
+
+With "Pitch" button, you may adjust pitch wheel. The pitch goes
+back to the center position when you click the "Pitch Clear" button
+at the left.
+
+With "Program" button, the selection list of playing instrument is
+toggled. The shown presets are read from preset list file.
+
+KEYBOARD
+--------
+
+Each visible key is mapped on your computer keyboard from 'z' to '\'.
+On the version 0.1.11, the key auto-repeat is filtered so that only
+one note is generated. Thus you no longer have to turn off auto
+repeat via "xset -r".
+
+The key assignment can be changed by editting the config file
+~/.vkeybdmap. Once save the current configuration via File/Save Keymap
+menu. The config file is the Tcl source, and you may change the list
+of keymap as you wish.
+
+The keymap is a list of elements consisting on the key symbol and the
+corresponding note offset. The key symbol is the X key symbol for
+assigned key, and note offset is the shifted note number from note key
+of beginning of keyboard, which is changed by "Key" scalebar.
+See the next section for details.
+
+CHANGING THE KEYMAP
+-------------------
+
+The step for changing the keymap manually is like this.
+
+1. Save the current configuration by "File / Save Keymap" menu.
+ You'll have ~/.vkeybdmap file.
+
+2. Edit it using your favorite text editor.
+ There is a list of keymap definitions such as
+
+ set keymap {
+ {a 8}
+ {z 9}
+ {s 10}
+ {x 11}
+ ....
+
+ The first element of each keymap is the key-symbol of X11.
+ you can get the key-symbol for your computer keyboard by xev:
+
+ 2a. Start xev on a terminal.
+
+ % xev
+
+ You'll get a small window.
+
+ 2b. Move the cursor pointer into the window.
+ Many X11 events will be displayed in realtime on the terminal.
+ Depending on the window manager, you'll need to click the
+ window to choose focus.
+
+ 2c. Push the key you want to use.
+ The key-push/release event will be shown on the terminal like below.
+
+ KeyRelease event, serial 26, synthetic NO, window 0x1600001,
+ root 0x3f, subw 0x0, time 4352873, (88,98), root:(1185,149),
+ state 0x0, keycode 49 (keysym 0xff1b, Escape), same_screen YES,
+ XLookupString gives 1 bytes: "
+
+ Then you know the key-symbol is "Escape" (see keysym entry).
+
+ The second element of each keymap is the MIDI note offset from the
+ base note. If the key is set to 48 on the vkeybd and if you have a
+ keymap entry like {Escape 15}, the key 63 (15+48) will be played
+ when you push Escape key.
+
+3. Restart vkeybd.
+
+
+PRESET LIST FILE
+----------------
+
+The preset list file is used to describe the list of MIDI preset
+names. If the command line option is omitted, the default preset list
+file "~/vkeybd.list", "~/.vkeybd.list" and "$vkblib/vkeybd.list" are
+searched sequentially. The preset list will appear when "Program"
+toggle button is on, and you can select your favorite sound from the
+list.
+
+The preset list file can be converted from soundfont file via sftovkb
+utility included in this package. For example,
+ % sftovkb /usr/local/lib/sfbank/synthgm.sbk > vkeybd.list
+The only command line argument is the soundfont file name. This must
+be a full path name.
+
+
+ACKNOWLEDGMENT
+--------------
+
+The desktop pixmaps are by courtesy of Ivo Clarysse.
+
+
+COPYRIGHT
+---------
+
+Copyright (C) 1997-2000 Takashi Iwai
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Added: vkeybd/trunk/debian/changelog
===================================================================
--- vkeybd/trunk/debian/changelog 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/changelog 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,32 @@
+vkeybd (0.1.17-1) unstable; urgency=low
+
+ * First Debian upload (closes: 193256), sponsored by
+ Cosimo Alfarano <kalfa@debian.org>
+
+ -- Free Ekanayaka <free@agnula.org> Wed, 6 Oct 2004 21:31:07 +0200
+
+vkeybd (0.1.16-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Free Ekanayaka <free@agnula.org> Thu, 8 Apr 2004 18:59:33 +0200
+
+vkeybd (0.1.11-1) unstable; urgency=low
+
+ * Rebuilt for Debian unstable.
+ * Using tcl/tk 8.4 instead of 8.3
+
+ -- Free Ekanayaka <free@agnula.org> Thu, 8 Apr 2004 16:28:18 +0200
+
+vkeybd (0.1.11-0test2) unstable; urgency=low
+
+ * Added template man page
+
+ -- Free Ekanayaka <free@agnula.org> Wed, 26 Nov 2003 10:18:47 +0600
+
+vkeybd (0.1.11-0test1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Free Ekanayaka <free@agnula.org> Wed, 9 Jul 2003 11:28:20 +0200
+
Added: vkeybd/trunk/debian/control
===================================================================
--- vkeybd/trunk/debian/control 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/control 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,14 @@
+Source: vkeybd
+Section: sound
+Priority: optional
+Maintainer: Free Ekanayaka <free@centrotemporeale.it>
+Build-Depends: docbook-to-man, debhelper (>> 3.0.0), tcl8.4-dev, tk8.4-dev, xlibs-dev, libasound2-dev
+Standards-Version: 3.5.2
+
+Package: vkeybd
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Virtual Keyboard program
+ This program allows you to use the Linux AWE32 driver, OSS MIDI sequencer,
+ or ALSA MIDI sequencer and provides "virtual" keyboard (the musical type),
+ which can be "played" using the keyboard or mouse under X11.
Added: vkeybd/trunk/debian/copyright
===================================================================
--- vkeybd/trunk/debian/copyright 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/copyright 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,22 @@
+This package was debianized by Free Ekanayaka <free@centrotemporeale.it> on
+Thu, 5 Jun 2003 15:24:12 +0200.
+
+It was downloaded from http: http://mitglied.lycos.de/iwai/alsa.html
+
+
+Upstream Author: Takashi Iwai <tiwai@suse.de>
+
+Copyright (C) 1996 Takashi Iwai
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
Added: vkeybd/trunk/debian/dirs
===================================================================
--- vkeybd/trunk/debian/dirs 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/dirs 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
Added: vkeybd/trunk/debian/docs
===================================================================
--- vkeybd/trunk/debian/docs 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/docs 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1 @@
+README
Added: vkeybd/trunk/debian/manpages
===================================================================
--- vkeybd/trunk/debian/manpages 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/manpages 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,2 @@
+vkeybd.1
+sftovkb.1
Added: vkeybd/trunk/debian/rules
===================================================================
--- vkeybd/trunk/debian/rules 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/rules 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,96 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatibility version to use.
+export DH_COMPAT=3
+
+
+
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -g
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+ INSTALL_PROGRAM += -s
+endif
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+
+ touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ /usr/bin/docbook-to-man debian/vkeybd.sgml > vkeybd.1
+ /usr/bin/docbook-to-man debian/sftovkb.sgml > sftovkb.1
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/vkeybd.
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/vkeybd
+ #$(MAKE) install-man DESTDIR=$(CURDIR)/debian/vkeybd
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+# dh_installdebconf
+ dh_installdocs
+ dh_installexamples
+ dh_installmenu
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_installinit
+ dh_installcron
+ dh_installman
+ dh_installinfo
+# dh_undocumented
+ dh_installchangelogs
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_makeshlibs
+ dh_installdeb
+# dh_perl
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Property changes on: vkeybd/trunk/debian/rules
___________________________________________________________________
Name: svn:executable
+
Added: vkeybd/trunk/debian/sftovkb.sgml
===================================================================
--- vkeybd/trunk/debian/sftovkb.sgml 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/sftovkb.sgml 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,97 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+ page: `docbook-to-man manpage.sgml > manpage.1'. You may view
+ the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+ less'. A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+ docbook-to-man $< > $@
+
+
+ The docbook-to-man binary is found in the docbook-to-man package.
+ Please remember that if you create the nroff version in one of the
+ debian/rules file targets (such as build), you will need to include
+ docbook-to-man in your Build-Depends control field.
+
+ -->
+
+ <!-- Fill in your name for Free and Ekanayaka. -->
+ <!ENTITY dhfirstname "<firstname>Free</firstname>">
+ <!ENTITY dhsurname "<surname>Ekanayaka</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>November 17, 2003</date>">
+ <!-- 1 should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>1</manvolnum>">
+ <!ENTITY dhemail "<email>free@agnula.org</email>">
+ <!ENTITY dhusername "Free Ekanayaka">
+ <!ENTITY dhucpackage "<refentrytitle>DeMuDi undocumented package</refentrytitle>">
+ <!ENTITY dhpackage "%NAME%">
+
+ <!ENTITY debian "<productname>Debian</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+ <!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2003</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+ <refmeta>
+ &dhucpackage;
+
+ &dhsection;
+ </refmeta>
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+
+ <refpurpose>program included in the DeMuDi distribution</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>DESCRIPTION</title>
+
+ <para>This program was packaged by the AGNULA team for the
+ DeMuDi project (http://www.agnula.org).</para>
+
+ <para>A manual page for this application has not been provided
+ yet.</para>
+
+ </refsect1>
+ <refsect1>
+ <title>SEE ALSO</title>
+
+ <para>info (1), whatis (1), apropos (1), dpkg (8), locate (1),
+ find (1), updatedb (1), undocumented (2), man (7), missing (7)</para>
+ </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
+
+
Added: vkeybd/trunk/debian/tmp
===================================================================
--- vkeybd/trunk/debian/tmp 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/tmp 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,14 @@
+Source: vkeybd
+Section: sound
+Priority: optional
+Maintainer: Free Ekanayaka <free@centrotemporeale.it>
+Build-Depends: docbook-to-man, debhelper (>> 3.0.0), tcl8.3-dev, tk8.3-dev, xlibs-dev, libasound2-dev
+Standards-Version: 3.5.2
+
+Package: vkeybd
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Virtual Keyboard program
+ This program allows you to use the Linux AWE32 driver, OSS MIDI sequencer,
+ or ALSA MIDI sequencer and provides "virtual" keyboard (the musical type),
+ which can be "played" using the keyboard or mouse under X11.
Added: vkeybd/trunk/debian/vkeybd.menu
===================================================================
--- vkeybd/trunk/debian/vkeybd.menu 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/vkeybd.menu 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,9 @@
+?package(vkeybd):needs="x11" \
+ title="MIDI Virtual Keyboard" \
+ section="Apps/Sound" \
+ longtitle="MIDI based Virtual Keyboard program" \
+ description="This program is a 'virtual' keyboard, which allows you \
+to play notes on the AWE32 (using the Linux AWE32 driver) by pressing keys \
+on your computer's keyboard, or by using the mouse." \
+ command="/usr/bin/vkeybd"\
+ hints="MIDI"
Added: vkeybd/trunk/debian/vkeybd.sgml
===================================================================
--- vkeybd/trunk/debian/vkeybd.sgml 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/vkeybd.sgml 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,97 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+ page: `docbook-to-man manpage.sgml > manpage.1'. You may view
+ the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+ less'. A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+ docbook-to-man $< > $@
+
+
+ The docbook-to-man binary is found in the docbook-to-man package.
+ Please remember that if you create the nroff version in one of the
+ debian/rules file targets (such as build), you will need to include
+ docbook-to-man in your Build-Depends control field.
+
+ -->
+
+ <!-- Fill in your name for Free and Ekanayaka. -->
+ <!ENTITY dhfirstname "<firstname>Free</firstname>">
+ <!ENTITY dhsurname "<surname>Ekanayaka</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>November 17, 2003</date>">
+ <!-- 1 should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>1</manvolnum>">
+ <!ENTITY dhemail "<email>free@agnula.org</email>">
+ <!ENTITY dhusername "Free Ekanayaka">
+ <!ENTITY dhucpackage "<refentrytitle>DeMuDi undocumented package</refentrytitle>">
+ <!ENTITY dhpackage "vkeybd">
+
+ <!ENTITY debian "<productname>Debian</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+ <!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2003</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+ <refmeta>
+ &dhucpackage;
+
+ &dhsection;
+ </refmeta>
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+
+ <refpurpose>program included in the DeMuDi distribution</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>DESCRIPTION</title>
+
+ <para>This program was packaged by the AGNULA team for the
+ DeMuDi project (http://www.agnula.org).</para>
+
+ <para>A manual page for this application has not been provided
+ yet.</para>
+
+ </refsect1>
+ <refsect1>
+ <title>SEE ALSO</title>
+
+ <para>info (1), whatis (1), apropos (1), dpkg (8), locate (1),
+ find (1), updatedb (1), undocumented (2), man (7), missing (7)</para>
+ </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
+
+
Added: vkeybd/trunk/debian/watch
===================================================================
--- vkeybd/trunk/debian/watch 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/debian/watch 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,4 @@
+version=2
+
+# Pattern Version
+http://www.alsa-project.org/~iwai/alsa.html vkeybd-(.*)\.tar\.gz debian uupdate
Added: vkeybd/trunk/fskip.c
===================================================================
--- vkeybd/trunk/fskip.c 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/fskip.c 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,22 @@
+/*----------------------------------------------------------------
+ * skip file position
+ *----------------------------------------------------------------*/
+
+#include <stdio.h>
+
+void fskip(int size, FILE *fd, int seekable)
+{
+ if (seekable)
+ fseek(fd, size, SEEK_CUR);
+ else {
+ char tmp[1024];
+ while (size >= (int)sizeof(tmp)) {
+ size -= fread(tmp, 1, sizeof(tmp), fd);
+
+ }
+ while (size > 0)
+ size -= fread(tmp, 1, size, fd);
+ }
+}
+
+
Added: vkeybd/trunk/itypes.h
===================================================================
--- vkeybd/trunk/itypes.h 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/itypes.h 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,43 @@
+/*================================================================
+ * integer types
+ *================================================================*/
+
+#ifndef ITYPES_H_DEF
+#define ITYPES_H_DEF
+
+/* 8bit bytes */
+typedef unsigned char byte;
+
+/* 16bit integers */
+typedef unsigned short uint16;
+typedef short int16;
+
+/* 32bit long integers */
+typedef unsigned int uint32;
+typedef int int32;
+
+/**/
+typedef union uint32rec {
+ byte b8[4];
+ uint16 b16[4];
+ uint32 b32;
+} uint32rec;
+
+/* vp=uint32rec, cp=char* */
+#define get32rec(vp,cp) memcpy(vp, cp, 4)
+
+#if 1
+/* little endian */
+#define swapi(x) x
+#define swapl(x) x
+
+#else
+/* big endian */
+#define swapi(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
+#define swapl(x) ((((x)&0xFF)<<24) | \
+ (((x)&0xFF00)<<8) | \
+ (((x)&0xFF0000)>>8) | \
+ (((x)>>24)&0xFF))
+#endif
+
+#endif
Added: vkeybd/trunk/malloc.c
===================================================================
--- vkeybd/trunk/malloc.c 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/malloc.c 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,24 @@
+/*
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+void *safe_malloc(int size)
+{
+ void *p;
+ p = (void*)calloc(size, 1);
+ if (p == NULL) {
+ fprintf(stderr, "can't malloc buffer for size %d!!\n", size);
+ exit(1);
+ }
+ return p;
+}
+
+void safe_free(void *buf)
+{
+ if (buf)
+ free(buf);
+}
Added: vkeybd/trunk/oper_alsa.c
===================================================================
--- vkeybd/trunk/oper_alsa.c 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/oper_alsa.c 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,316 @@
+/*
+ * operator for ALSA sequencer
+ *
+ * Virtual Tiny Keyboard
+ *
+ * Copyright (c) 1997-2000 by Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "vkb.h"
+#include <unistd.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#ifdef USE_OLD_ALSA
+#include <sys/asoundlib.h>
+#else
+#include <alsa/asoundlib.h>
+#endif
+
+#if SND_LIB_MAJOR > 0 || SND_LIB_MINOR >= 6
+#define snd_seq_flush_output(x) snd_seq_drain_output(x)
+#define snd_seq_set_client_group(x,name) /*nop*/
+#define my_snd_seq_open(seqp) snd_seq_open(seqp, "hw", SND_SEQ_OPEN_OUTPUT, 0)
+#else
+/* SND_SEQ_OPEN_OUT causes oops on early version of ALSA */
+#define my_snd_seq_open(seqp) snd_seq_open(seqp, SND_SEQ_OPEN)
+#endif
+
+/*
+ * functions
+ */
+static int seq_open(Tcl_Interp *ip, void **private_return);
+static void seq_close(Tcl_Interp *ip, void *private);
+static void note_on(Tcl_Interp *ip, void *private, int note, int vel);
+static void note_off(Tcl_Interp *ip, void *private, int note, int vel);
+static void control(Tcl_Interp *ip, void *private, int type, int val);
+static void program(Tcl_Interp *ip, void *private, int bank, int type);
+static void bender(Tcl_Interp *ip, void *private, int bend);
+static void chorus_mode(Tcl_Interp *ip, void *private, int mode);
+static void reverb_mode(Tcl_Interp *ip, void *private, int mode);
+static void send_event(int do_flush);
+
+
+#define DEFAULT_NAME "Virtual Keyboard"
+
+/*
+ * definition of device information
+ */
+
+static vkb_oper_t alsa_oper = {
+ seq_open,
+ seq_close,
+ program,
+ note_on,
+ note_off,
+ control,
+ bender,
+ chorus_mode,
+ reverb_mode,
+};
+
+static vkb_optarg_t alsa_opts[] = {
+ {"addr", "subscriber", "--addr client:port or 'subscriber' : ALSA sequencer destination"},
+ {"name", DEFAULT_NAME, "--name string : use the specified string as client/port names"},
+#ifdef HAVE_LADCCA
+ {"ladcca", "no", "--ladcca <yes|no> : support LADCCA (default = no)"},
+#endif
+ {NULL},
+};
+
+vkb_devinfo_t alsa_devinfo = {
+ "alsa", /* device id */
+ "ALSA sequencer", /* name */
+ 0, /* delayed open */
+ &alsa_oper, /* operators */
+ alsa_opts, /* command line options */
+};
+
+/*
+ */
+
+static snd_seq_t *seq_handle = NULL;
+static int my_client, my_port;
+static int seq_client, seq_port;
+static int chan_no;
+
+#ifdef HAVE_LADCCA
+static cca_client_t * cca_client = NULL;
+#endif
+
+/*
+ * parse address string
+ */
+
+#define ADDR_DELIM ".:"
+
+static int parse_addr(const char *arg, int *client, int *port)
+{
+ char *p;
+
+ if (isdigit(*arg)) {
+ if ((p = strpbrk(arg, ADDR_DELIM)) == NULL)
+ return -1;
+ *client = atoi(arg);
+ *port = atoi(p + 1);
+ } else {
+ if (*arg == 's' || *arg == 'S') {
+ *client = SND_SEQ_ADDRESS_SUBSCRIBERS;
+ *port = 0;
+ } else
+ return -1;
+ }
+ return 0;
+}
+
+
+/*
+ * open device
+ */
+
+static int
+seq_open(Tcl_Interp *ip, void **private_return)
+{
+ const char *var, *name;
+ unsigned int caps;
+
+ /* copy from Tcl variables */
+ if ((var = Tcl_GetVar2(ip, "optvar", "addr", TCL_GLOBAL_ONLY)) != NULL) {
+ if (parse_addr(var, &seq_client, &seq_port) < 0) {
+ vkb_error(ip, "invalid argument --addr %s\n", var);
+ return 0;
+ }
+ }
+
+ if (my_snd_seq_open(&seq_handle) < 0) {
+ vkb_error(ip, "can't open sequencer device");
+ return 0;
+ }
+
+ /* get my client id */
+ my_client = snd_seq_client_id(seq_handle);
+
+ /* tell the ladcca server our client id */
+#ifdef HAVE_LADCCA
+ if ((var = Tcl_GetVar2(ip, "optvar", "ladcca", TCL_GLOBAL_ONLY)) != NULL) {
+ if (*var == 'y' || *var == 'Y' || *var == '1') {
+ cca_client = cca_init (cca_args,
+ "vkeybd",
+ my_client, CCA_PROTOCOL_VERSION);
+ if (cca_enabled (cca_client)) {
+ cca_event_t * event;
+ unsigned char id[2];
+ event = cca_event_new_with_type (CCA_Alsa_Client_ID);
+ id[0] = snd_seq_client_id (seq_handle);
+ id[1] = '\0';
+ cca_event_set_string (event, id);
+ cca_send_event (cca_client, event);
+ }
+ }
+ }
+#endif /* HAVE_LADCCA */
+
+ /* set client info */
+ if ((var = Tcl_GetVar2(ip, "optvar", "name", TCL_GLOBAL_ONLY)) != NULL)
+ snd_seq_set_client_name(seq_handle, var);
+ else
+ snd_seq_set_client_name(seq_handle, DEFAULT_NAME);
+ snd_seq_set_client_group(seq_handle, "input");
+
+ /* create port */
+ caps = SND_SEQ_PORT_CAP_READ;
+ if (seq_client == SND_SEQ_ADDRESS_SUBSCRIBERS)
+ caps |= SND_SEQ_PORT_CAP_SUBS_READ;
+ if ((var = Tcl_GetVar2(ip, "optvar", "name", TCL_GLOBAL_ONLY)) != NULL)
+ name = var;
+ else
+ name = DEFAULT_NAME;
+ my_port = snd_seq_create_simple_port(seq_handle, name, caps,
+ SND_SEQ_PORT_TYPE_MIDI_GENERIC |
+ SND_SEQ_PORT_TYPE_APPLICATION);
+ if (my_port < 0) {
+ vkb_error(ip, "can't create port\n");
+ snd_seq_close(seq_handle);
+ return 0;
+ }
+
+ if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) {
+ /* subscribe to MIDI port */
+ if (
+#ifdef HAVE_LADCCA
+ !cca_enabled (cca_client) &&
+#endif
+ snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) {
+ vkb_error(ip, "can't subscribe to MIDI port (%d:%d)\n", seq_client, seq_port);
+ snd_seq_close(seq_handle);
+ return 0;
+ }
+ }
+
+ {
+ char tmp[128];
+ sprintf(tmp, "wm title . \"Virtual Keyboard ver.1.9 \\[%d:%d\\]\"", my_client, my_port);
+ Tcl_Eval(ip, tmp);
+ }
+
+ return 1;
+}
+
+
+static void
+seq_close(Tcl_Interp *ip, void *private)
+{
+ snd_seq_close(seq_handle);
+}
+
+
+/*
+ */
+
+static snd_seq_event_t ev;
+
+static void
+send_event(int do_flush)
+{
+ snd_seq_ev_set_direct(&ev);
+ snd_seq_ev_set_source(&ev, my_port);
+ snd_seq_ev_set_dest(&ev, seq_client, seq_port);
+
+ snd_seq_event_output(seq_handle, &ev);
+ if (do_flush)
+ snd_seq_flush_output(seq_handle);
+}
+
+static void
+note_on(Tcl_Interp *ip, void *private, int note, int vel)
+{
+ snd_seq_ev_set_noteon(&ev, chan_no, note, vel);
+ send_event(1);
+}
+
+static void
+note_off(Tcl_Interp *ip, void *private, int note, int vel)
+{
+ snd_seq_ev_set_noteoff(&ev, chan_no, note, vel);
+ send_event(1);
+}
+
+static void
+control(Tcl_Interp *ip, void *private, int type, int val)
+{
+ snd_seq_ev_set_controller(&ev, chan_no, type, val);
+ send_event(1);
+}
+
+static void
+program(Tcl_Interp *ip, void *private, int bank, int preset)
+{
+ vkb_get_int(ip, "channel", &chan_no);
+ if (bank == 128)
+ vkb_get_int(ip, "drum", &chan_no);
+ else {
+ snd_seq_ev_set_controller(&ev, 0, 0, bank);
+ send_event(0);
+ }
+
+ snd_seq_ev_set_pgmchange(&ev, chan_no, preset);
+ send_event(1);
+}
+
+static void
+bender(Tcl_Interp *ip, void *private, int bend)
+{
+ snd_seq_ev_set_pitchbend(&ev, chan_no, bend);
+ send_event(1);
+}
+
+static void
+chorus_mode(Tcl_Interp *ip, void *private, int mode)
+{
+ static unsigned char sysex[11] = {
+ 0xf0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x38, 0, 0, 0xf7,
+ };
+ sysex[8] = mode;
+ snd_seq_ev_set_sysex(&ev, 11, sysex);
+ send_event(1);
+ snd_seq_ev_set_fixed(&ev); /* reset */
+}
+
+static void
+reverb_mode(Tcl_Interp *ip, void *private, int mode)
+{
+ static unsigned char sysex[11] = {
+ 0xf0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x30, 0, 0, 0xf7,
+ };
+ sysex[8] = mode;
+ snd_seq_ev_set_sysex(&ev, 11, sysex);
+ send_event(1);
+ snd_seq_ev_set_fixed(&ev); /* reset */
+}
+
Added: vkeybd/trunk/oper_awe.c
===================================================================
--- vkeybd/trunk/oper_awe.c 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/oper_awe.c 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,239 @@
+/*
+ * operator for AWE32/64 on OSS
+ *
+ * Virtual Tiny Keyboard
+ *
+ * Copyright (c) 1997-2000 by Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define USE_NO_CONST
+
+#include "vkb.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#ifdef __FreeBSD__
+# include <machine/soundcard.h>
+# include <awe_voice.h>
+#elif defined(linux)
+# include <linux/soundcard.h>
+# include <linux/awe_voice.h>
+#endif
+
+/*
+ * functions
+ */
+static int seq_open(Tcl_Interp *ip, void **private_return);
+static void seq_close(Tcl_Interp *ip, void *private);
+static void program(Tcl_Interp *ip, void *private, int bank, int preset);
+static void note_on(Tcl_Interp *ip, void *private, int note, int vel);
+static void note_off(Tcl_Interp *ip, void *private, int note, int vel);
+static void control(Tcl_Interp *ip, void *private, int type, int val);
+static void bender(Tcl_Interp *ip, void *private, int bend);
+static void chorus_mode(Tcl_Interp *ip, void *private, int mode);
+static void reverb_mode(Tcl_Interp *ip, void *private, int mode);
+
+/*
+ * OSS sequencer stuff
+ */
+int seqfd;
+SEQ_DEFINEBUF(128);
+
+void
+seqbuf_dump(void)
+{
+ if (_seqbufptr) {
+ if (write(seqfd, _seqbuf, _seqbufptr) == -1) {
+ perror("write sequencer");
+ exit(1);
+ }
+ }
+ _seqbufptr = 0;
+}
+
+/*
+ * definition of device information
+ */
+
+static vkb_oper_t awe_oper = {
+ seq_open,
+ seq_close,
+ program,
+ note_on,
+ note_off,
+ control,
+ bender,
+ chorus_mode,
+ reverb_mode,
+};
+
+#define SEQUENCER_DEV "/dev/sequencer"
+
+static vkb_optarg_t awe_opts[] = {
+ {"seqdev", SEQUENCER_DEV, "--seqdev device : OSS sequencer device file"},
+ {"seqidx", "-1", "--seqidx device : speicfy synth index"},
+ {NULL},
+};
+
+vkb_devinfo_t awe_devinfo = {
+ "awe", /* id */
+ "OSS AWE32/64 Synth", /* name */
+ 1, /* delayed open */
+ &awe_oper, /* operators */
+ awe_opts, /* options */
+};
+
+
+/*
+ * for OSS interface
+ */
+
+SEQ_USE_EXTBUF();
+extern int seqfd;
+static int awe_dev;
+
+/*
+ * open device
+ */
+static int
+seq_open(Tcl_Interp *ip, void **private_return)
+{
+ const char *var;
+ const char *seqdev = SEQUENCER_DEV;
+ int nrsynths;
+ struct synth_info card_info;
+ int i;
+
+ if ((var = Tcl_GetVar2(ip, "optvar", "seqdev", TCL_GLOBAL_ONLY)) != NULL && *var)
+ seqdev = var;
+
+ if ((seqfd = open(seqdev, O_WRONLY, 0)) < 0) {
+ vkb_error(ip, "can't open sequencer device '%s'", seqdev);
+ return 0;
+ }
+
+ if (ioctl(seqfd, SNDCTL_SEQ_NRSYNTHS, &nrsynths) == -1) {
+ vkb_error(ip, "there is no soundcard installed");
+ close(seqfd);
+ return 0;
+ }
+
+ awe_dev = -1;
+ vkb_get_int(ip, "seqidx", &awe_dev);
+ if (awe_dev >= 0) {
+ card_info.device = awe_dev;
+ if (ioctl(seqfd, SNDCTL_SYNTH_INFO, &card_info) == -1) {
+ vkb_error(ip, "cannot get info on soundcard %d", awe_dev);
+ close(seqfd);
+ return 0;
+ }
+ if (card_info.synth_type != SYNTH_TYPE_SAMPLE
+ || card_info.synth_subtype != SAMPLE_TYPE_AWE32) {
+ vkb_error(ip, "invalid synth device number %d\n", awe_dev);
+ close(seqfd);
+ return 0;
+ }
+ } else {
+ /* auto-probe */
+ for (i = 0; i < nrsynths; i++) {
+ card_info.device = i;
+ if (ioctl(seqfd, SNDCTL_SYNTH_INFO, &card_info) == -1) {
+ vkb_error(ip, "cannot get info on soundcard %d", i);
+ close(seqfd);
+ return 0;
+ }
+ if (card_info.synth_type == SYNTH_TYPE_SAMPLE
+ && card_info.synth_subtype == SAMPLE_TYPE_AWE32) {
+ awe_dev = i;
+ break;
+ }
+ }
+ if (awe_dev < 0) {
+ vkb_error(ip, "No AWE synth device is found\n");
+ close(seqfd);
+ return 0;
+ }
+ }
+
+ /* use MIDI channel mode */
+ AWE_SET_CHANNEL_MODE(awe_dev, AWE_PLAY_MULTI);
+ /* toggle drum flag if bank #128 is received */
+ AWE_MISC_MODE(awe_dev, AWE_MD_TOGGLE_DRUM_BANK, 1);
+
+ return 1;
+}
+
+/*
+ * close device
+ */
+static void
+seq_close(Tcl_Interp *ip, void *private)
+{
+ close(seqfd);
+}
+
+static void
+program(Tcl_Interp *ip, void *private, int bank, int preset)
+{
+ SEQ_CONTROL(awe_dev, 0, CTL_BANK_SELECT, bank);
+ SEQ_SET_PATCH(awe_dev, 0, preset);
+ /* no dumpbuf */
+}
+
+static void
+note_on(Tcl_Interp *ip, void *private, int note, int vel)
+{
+ SEQ_START_NOTE(awe_dev, 0, note, vel);
+ SEQ_DUMPBUF();
+}
+
+static void
+note_off(Tcl_Interp *ip, void *private, int note, int vel)
+{
+ SEQ_STOP_NOTE(awe_dev, 0, note, vel);
+ SEQ_DUMPBUF();
+}
+
+static void
+control(Tcl_Interp *ip, void *private, int type, int val)
+{
+ SEQ_CONTROL(awe_dev, 0, type, val);
+ SEQ_DUMPBUF();
+}
+
+static void
+bender(Tcl_Interp *ip, void *private, int bend)
+{
+ SEQ_BENDER(awe_dev, 0, bend + 8192);
+ SEQ_DUMPBUF();
+}
+
+static void
+chorus_mode(Tcl_Interp *ip, void *private, int mode)
+{
+ AWE_CHORUS_MODE(awe_dev, mode);
+ SEQ_DUMPBUF();
+}
+
+static void
+reverb_mode(Tcl_Interp *ip, void *private, int mode)
+{
+ AWE_REVERB_MODE(awe_dev, mode);
+ SEQ_DUMPBUF();
+}
+
Added: vkeybd/trunk/oper_midi.c
===================================================================
--- vkeybd/trunk/oper_midi.c 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/oper_midi.c 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,195 @@
+/*
+ * operator for MIDI device
+ *
+ * Virtual Tiny Keyboard
+ *
+ * Copyright (c) 1997-2000 by Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define USE_NO_CONST
+
+#include "vkb.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#ifdef __FreeBSD__
+# include <machine/soundcard.h>
+#elif defined(linux)
+# include <linux/soundcard.h>
+#endif
+
+
+/*
+ * functions
+ */
+static int seq_open(Tcl_Interp *ip, void **private_return);
+static void seq_close(Tcl_Interp *ip, void *private);
+static void note_on(Tcl_Interp *ip, void *private, int note, int vel);
+static void note_off(Tcl_Interp *ip, void *private, int note, int vel);
+static void program(Tcl_Interp *ip, void *private, int bank, int preset);
+static void control(Tcl_Interp *ip, void *private, int type, int val);
+static void bender(Tcl_Interp *ip, void *private, int bend);
+static void chorus_mode(Tcl_Interp *ip, void *private, int mode);
+static void reverb_mode(Tcl_Interp *ip, void *private, int mode);
+
+
+/*
+ * definition of device information
+ */
+
+static vkb_oper_t midi_oper = {
+ seq_open,
+ seq_close,
+ program,
+ note_on,
+ note_off,
+ control,
+ bender,
+ chorus_mode,
+ reverb_mode,
+};
+
+#define MIDI_DEV "/dev/midi"
+
+static vkb_optarg_t midi_opts[] = {
+ {"mididev", MIDI_DEV, "--mididev device : OSS midi device file"},
+ {NULL},
+};
+
+vkb_devinfo_t midi_devinfo = {
+ "midi", /* id */
+ "MIDI device", /* name */
+ 1, /* delayed open */
+ &midi_oper, /* operators */
+ midi_opts, /* options */
+};
+
+
+/*
+ * for OSS interface
+ */
+
+static FILE *fp;
+static int chan_no;
+
+/*
+ */
+
+static int
+seq_open(Tcl_Interp *ip, void **private_return)
+{
+ const char *mididev = MIDI_DEV;
+ const char *var;
+
+ var = Tcl_GetVar2(ip, "optvar", "mididev", TCL_GLOBAL_ONLY);
+ if (var != NULL && *var)
+ mididev = var;
+ if ((fp = fopen(mididev, "w")) == NULL) {
+ vkb_error(ip, "can't open midi device file '%s'\n", mididev);
+ return 0;
+ }
+
+ return 1;
+}
+
+static void
+seq_close(Tcl_Interp *ip, void *private)
+{
+ fclose(fp);
+}
+
+/*
+ */
+
+static void
+note_on(Tcl_Interp *ip, void *private, int note, int vel)
+{
+ putc(MIDI_NOTEON | chan_no, fp);
+ putc(note, fp);
+ putc(vel, fp);
+ fflush(fp);
+}
+
+static void
+note_off(Tcl_Interp *ip, void *private, int note, int vel)
+{
+ putc(MIDI_NOTEOFF | chan_no, fp);
+ putc(0xf8, fp);
+ putc(note, fp);
+ putc(vel, fp);
+ fflush(fp);
+}
+
+static void
+program(Tcl_Interp *ip, void *private, int bank, int preset)
+{
+ vkb_get_int(ip, "channel", &chan_no);
+ if (bank == 128)
+ vkb_get_int(ip, "drum", &chan_no);
+ else {
+ putc(MIDI_CTL_CHANGE | chan_no, fp);
+ putc(CTL_BANK_SELECT, fp);
+ putc(bank, fp);
+ }
+ putc(MIDI_PGM_CHANGE | chan_no, fp);
+ putc(preset, fp);
+ /* no dumpbuf here */
+}
+
+static void
+control(Tcl_Interp *ip, void *private, int type, int val)
+{
+ putc(MIDI_CTL_CHANGE | chan_no, fp);
+ putc(type, fp);
+ putc(val, fp);
+ fflush(fp);
+}
+
+static void
+bender(Tcl_Interp *ip, void *private, int bend)
+{
+ bend += 8192;
+ putc(MIDI_PITCH_BEND | chan_no, fp);
+ putc(bend & 0x7f, fp);
+ putc((bend >> 7) & 0x7f, fp);
+ fflush(fp);
+}
+
+static void
+chorus_mode(Tcl_Interp *ip, void *private, int mode)
+{
+ static unsigned char sysex[11] = {
+ 0xf0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x38, 0, 0, 0xf7,
+ };
+ int i;
+ sysex[8] = mode;
+ for (i = 0; i < 11; i++)
+ putc(sysex[i], fp);
+}
+
+static void
+reverb_mode(Tcl_Interp *ip, void *private, int mode)
+{
+ static unsigned char sysex[11] = {
+ 0xf0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x30, 0, 0, 0xf7,
+ };
+ int i;
+ sysex[8] = mode;
+ for (i = 0; i < 11; i++)
+ putc(sysex[i], fp);
+}
+
Added: vkeybd/trunk/pixmaps/vkeybd_16x16.png
===================================================================
(Binary files differ)
Property changes on: vkeybd/trunk/pixmaps/vkeybd_16x16.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: vkeybd/trunk/pixmaps/vkeybd_32x32.png
===================================================================
(Binary files differ)
Property changes on: vkeybd/trunk/pixmaps/vkeybd_32x32.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: vkeybd/trunk/pixmaps/vkeybd_48x48.png
===================================================================
(Binary files differ)
Property changes on: vkeybd/trunk/pixmaps/vkeybd_48x48.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: vkeybd/trunk/sffile.c
===================================================================
--- vkeybd/trunk/sffile.c 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/sffile.c 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,627 @@
+/*================================================================
+ * sffile.c
+ * read SoundFont file (SBK/SF2) and store the layer lists
+ *
+ * Copyright (C) 1996,1997 Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *================================================================*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "sffile.h"
+#include "util.h"
+
+
+/*================================================================
+ * preset / instrument bag record
+ *================================================================*/
+
+typedef struct _SFBags {
+ int nbags;
+ uint16 *bag;
+ int ngens;
+ SFGenRec *gen;
+} SFBags;
+
+static SFBags prbags, inbags;
+
+
+/*----------------------------------------------------------------
+ * function prototypes
+ *----------------------------------------------------------------*/
+
+#define NEW(type,nums) (type*)safe_malloc(sizeof(type) * (nums))
+
+#define READCHUNK(var,fd) fread(&var, 8, 1, fd)
+#define READID(var,fd) fread(var, 4, 1, fd)
+#define READSTR(var,fd) fread(var, 20, 1, fd)
+#define READDW(var,fd) fread(&var, 4, 1, fd)
+#define READW(var,fd) fread(&var, 2, 1, fd)
+#define READB(var,fd) fread(&var, 1, 1, fd)
+#define SKIPB(fd) {char dummy; fread(&dummy, 1, 1, fd);}
+#define SKIPW(fd) {short dummy; fread(&dummy, 2, 1, fd);}
+#define SKIPDW(fd) {int dummy; fread(&dummy, 4, 1, fd);}
+
+static int seekable;
+#define FSKIP(size,fd) fskip(size, fd, seekable)
+
+
+/*----------------------------------------------------------------*/
+
+static int chunkid(char *id);
+static int process_list(int size, SFInfo *sf, FILE *fd);
+static int process_info(int size, SFInfo *sf, FILE *fd);
+static int process_sdta(int size, SFInfo *sf, FILE *fd);
+static int process_pdta(int size, SFInfo *sf, FILE *fd);
+static void load_sample_names(int size, SFInfo *sf, FILE *fd);
+static void load_preset_header(int size, SFInfo *sf, FILE *fd);
+static void load_inst_header(int size, SFInfo *sf, FILE *fd);
+static void load_bag(int size, SFBags *bagp, FILE *fd);
+static void load_gen(int size, SFBags *bagp, FILE *fd);
+static void load_sample_info(int size, SFInfo *sf, FILE *fd);
+static void convert_layers(SFInfo *sf);
+static void generate_layers(SFHeader *hdr, SFHeader *next, SFBags *bags);
+static void free_layer(SFHeader *hdr);
+
+
+/*----------------------------------------------------------------
+ * id numbers
+ *----------------------------------------------------------------*/
+
+enum {
+ /* level 0; chunk */
+ UNKN_ID, RIFF_ID, LIST_ID, SFBK_ID,
+ /* level 1; id only */
+ INFO_ID, SDTA_ID, PDTA_ID,
+ /* info stuff; chunk */
+ IFIL_ID, ISNG_ID, IROM_ID, INAM_ID, IVER_ID, IPRD_ID, ICOP_ID,
+ /* sample data stuff; chunk */
+ SNAM_ID, SMPL_ID,
+ /* preset stuff; chunk */
+ PHDR_ID, PBAG_ID, PMOD_ID, PGEN_ID,
+ /* inst stuff; chunk */
+ INST_ID, IBAG_ID, IMOD_ID, IGEN_ID,
+ /* sample header; chunk */
+ SHDR_ID,
+};
+
+
+/*================================================================
+ * load a soundfont file
+ *================================================================*/
+
+int load_soundfont(SFInfo *sf, FILE *fd, int is_seekable)
+{
+ SFChunk chunk;
+
+ seekable = is_seekable;
+
+ sf->preset = NULL;
+ sf->sample = NULL;
+ sf->inst = NULL;
+ sf->sf_name = NULL;
+
+ prbags.bag = inbags.bag = NULL;
+ prbags.gen = inbags.gen = NULL;
+
+ /* check RIFF file header */
+ READCHUNK(chunk, fd);
+ if (chunkid(chunk.id) != RIFF_ID) {
+ fprintf(stderr, "*** not a RIFF file\n");
+ return -1;
+ }
+ /* check file id */
+ READID(chunk.id, fd);
+ if (chunkid(chunk.id) != SFBK_ID) {
+ fprintf(stderr, "*** not a SoundFont file\n");
+ return -1;
+ }
+
+ for (;;) {
+ READCHUNK(chunk, fd);
+ if (feof(fd))
+ break;
+ else if (chunkid(chunk.id) == LIST_ID) {
+ if (process_list(chunk.size, sf, fd))
+ break;
+ } else {
+ fprintf(stderr, "*** illegal id in level 0: %4.4s %4d\n",
+ chunk.id, chunk.size);
+ FSKIP(chunk.size, fd);
+ }
+ }
+
+ /* parse layer structure */
+ convert_layers(sf);
+
+ /* free private tables */
+ if (prbags.bag) free(prbags.bag);
+ if (prbags.gen) free(prbags.gen);
+ if (inbags.bag) free(inbags.bag);
+ if (inbags.gen) free(inbags.gen);
+
+ return 0;
+}
+
+
+/*================================================================
+ * free buffer
+ *================================================================*/
+
+void free_soundfont(SFInfo *sf)
+{
+ int i;
+ if (sf->preset) {
+ for (i = 0; i < sf->npresets; i++)
+ free_layer(&sf->preset[i].hdr);
+ free(sf->preset);
+ }
+ if (sf->inst) {
+ for (i = 0; i < sf->ninsts; i++)
+ free_layer(&sf->inst[i].hdr);
+ free(sf->inst);
+ }
+ if (sf->sample) free(sf->sample);
+ if (sf->sf_name) free(sf->sf_name);
+}
+
+
+/*----------------------------------------------------------------
+ * get id value from 4bytes ID string
+ *----------------------------------------------------------------*/
+
+static int chunkid(char *id)
+{
+ static struct idstring {
+ char *str;
+ int id;
+ } idlist[] = {
+ {"RIFF", RIFF_ID},
+ {"LIST", LIST_ID},
+ {"sfbk", SFBK_ID},
+ {"INFO", INFO_ID},
+ {"sdta", SDTA_ID},
+ {"snam", SNAM_ID},
+ {"smpl", SMPL_ID},
+ {"pdta", PDTA_ID},
+ {"phdr", PHDR_ID},
+ {"pbag", PBAG_ID},
+ {"pmod", PMOD_ID},
+ {"pgen", PGEN_ID},
+ {"inst", INST_ID},
+ {"ibag", IBAG_ID},
+ {"imod", IMOD_ID},
+ {"igen", IGEN_ID},
+ {"shdr", SHDR_ID},
+ {"ifil", IFIL_ID},
+ {"isng", ISNG_ID},
+ {"irom", IROM_ID},
+ {"iver", IVER_ID},
+ {"INAM", INAM_ID},
+ {"IPRD", IPRD_ID},
+ {"ICOP", ICOP_ID},
+ };
+
+ int i;
+
+ for (i = 0; i < sizeof(idlist)/sizeof(idlist[0]); i++) {
+ if (strncmp(id, idlist[i].str, 4) == 0)
+ return idlist[i].id;
+ }
+
+ return UNKN_ID;
+}
+
+
+/*================================================================
+ * process a list chunk
+ *================================================================*/
+
+static int process_list(int size, SFInfo *sf, FILE *fd)
+{
+ SFChunk chunk;
+
+ /* read the following id string */
+ READID(chunk.id, fd); size -= 4;
+
+ switch (chunkid(chunk.id)) {
+ case INFO_ID:
+ return process_info(size, sf, fd);
+ case SDTA_ID:
+ return process_sdta(size, sf, fd);
+ case PDTA_ID:
+ return process_pdta(size, sf, fd);
+ default:
+ fprintf(stderr, "*** illegal id in level 1: %4.4s\n", chunk.id);
+ FSKIP(size, fd); /* skip it */
+ return 0;
+ }
+}
+
+
+/*================================================================
+ * process info list
+ *================================================================*/
+
+static int process_info(int size, SFInfo *sf, FILE *fd)
+{
+ sf->infopos = ftell(fd);
+ sf->infosize = size;
+
+ /* parse the buffer */
+ while (size > 0) {
+ SFChunk chunk;
+
+ /* read a sub chunk */
+ READCHUNK(chunk, fd); size -= 8;
+ if (feof(fd))
+ return -1;
+
+ switch (chunkid(chunk.id)) {
+ case IFIL_ID:
+ /* soundfont file version */
+ READW(sf->version, fd);
+ READW(sf->minorversion, fd);
+ break;
+ case INAM_ID:
+ /* name of the font */
+ sf->sf_name = (char*)safe_malloc(chunk.size + 1);
+ fread(sf->sf_name, 1, chunk.size, fd);
+ sf->sf_name[chunk.size] = 0;
+ break;
+ default:
+ FSKIP(chunk.size, fd);
+ break;
+ }
+ size -= chunk.size;
+ }
+ return 0;
+}
+
+
+/*================================================================
+ * process sample data list
+ *================================================================*/
+
+static int process_sdta(int size, SFInfo *sf, FILE *fd)
+{
+ while (size > 0) {
+ SFChunk chunk;
+
+ /* read a sub chunk */
+ READCHUNK(chunk, fd); size -= 8;
+ if (feof(fd))
+ return -1;
+
+ switch (chunkid(chunk.id)) {
+ case SNAM_ID:
+ /* sample name list */
+ load_sample_names(chunk.size, sf, fd);
+ break;
+ case SMPL_ID:
+ /* sample data starts from here */
+ sf->samplepos = ftell(fd);
+ sf->samplesize = chunk.size;
+ FSKIP(chunk.size, fd);
+ break;
+ default:
+ FSKIP(chunk.size, fd);
+ break;
+ }
+ size -= chunk.size;
+ }
+ return 0;
+}
+
+
+/*================================================================
+ * process preset data list
+ *================================================================*/
+
+static int process_pdta(int size, SFInfo *sf, FILE *fd)
+{
+ while (size > 0) {
+ SFChunk chunk;
+
+ /* read a subchunk */
+ READCHUNK(chunk, fd); size -= 8;
+ if (feof(fd))
+ return -1;
+
+ switch (chunkid(chunk.id)) {
+ case PHDR_ID:
+ load_preset_header(chunk.size, sf, fd);
+ break;
+ case PBAG_ID:
+ load_bag(chunk.size, &prbags, fd);
+ break;
+ case PGEN_ID:
+ load_gen(chunk.size, &prbags, fd);
+ break;
+ case INST_ID:
+ load_inst_header(chunk.size, sf, fd);
+ break;
+ case IBAG_ID:
+ load_bag(chunk.size, &inbags, fd);
+ break;
+ case IGEN_ID:
+ load_gen(chunk.size, &inbags, fd);
+ break;
+ case SHDR_ID:
+ load_sample_info(chunk.size, sf, fd);
+ break;
+ case PMOD_ID: /* ignored */
+ case IMOD_ID: /* ingored */
+ default:
+ FSKIP(chunk.size, fd);
+ break;
+ }
+ size -= chunk.size;
+ }
+ return 0;
+}
+
+
+/*----------------------------------------------------------------
+ * store sample name list; sf1 only
+ *----------------------------------------------------------------*/
+
+static void load_sample_names(int size, SFInfo *sf, FILE *fd)
+{
+ int i, nsamples;
+ if (sf->version > 1) {
+ fprintf(stderr, "*** version 2 has obsolete format??\n");
+ FSKIP(size, fd);
+ return;
+ }
+
+ /* each sample name has a fixed lentgh (20 bytes) */
+ nsamples = size / 20;
+ if (sf->sample == NULL) {
+ sf->nsamples = nsamples;
+ sf->sample = NEW(SFSampleInfo, sf->nsamples);
+ } else if (sf->nsamples != nsamples) {
+ fprintf(stderr, "*** different # of samples ?? (%d : %d)\n",
+ sf->nsamples, nsamples);
+ FSKIP(size, fd);
+ return;
+ }
+
+ /* read each name from file */
+ for (i = 0; i < sf->nsamples; i++) {
+ READSTR(sf->sample[i].name, fd);
+ }
+}
+
+
+/*----------------------------------------------------------------
+ * preset header list
+ *----------------------------------------------------------------*/
+
+static void load_preset_header(int size, SFInfo *sf, FILE *fd)
+{
+ int i;
+
+ sf->npresets = size / 38;
+ sf->preset = NEW(SFPresetHdr, sf->npresets);
+ for (i = 0; i < sf->npresets; i++) {
+ READSTR(sf->preset[i].hdr.name, fd);
+ READW(sf->preset[i].preset, fd);
+ READW(sf->preset[i].bank, fd);
+ READW(sf->preset[i].hdr.bagNdx, fd);
+ SKIPDW(fd); /* lib; ignored*/
+ SKIPDW(fd); /* genre; ignored */
+ SKIPDW(fd); /* morph; ignored */
+ /* initialize layer table; it'll be parsed later */
+ sf->preset[i].hdr.nlayers = 0;
+ sf->preset[i].hdr.layer = NULL;
+ }
+}
+
+
+/*----------------------------------------------------------------
+ * instrument header list
+ *----------------------------------------------------------------*/
+
+static void load_inst_header(int size, SFInfo *sf, FILE *fd)
+{
+ int i;
+
+ sf->ninsts = size / 22;
+ sf->inst = NEW(SFInstHdr, sf->ninsts);
+ for (i = 0; i < sf->ninsts; i++) {
+ READSTR(sf->inst[i].hdr.name, fd);
+ READW(sf->inst[i].hdr.bagNdx, fd);
+ /* iniitialize layer table; it'll be parsed later */
+ sf->inst[i].hdr.nlayers = 0;
+ sf->inst[i].hdr.layer = NULL;
+ }
+}
+
+
+/*----------------------------------------------------------------
+ * load preset/instrument bag list on the private table
+ *----------------------------------------------------------------*/
+
+static void load_bag(int size, SFBags *bagp, FILE *fd)
+{
+ int i;
+
+ size /= 4;
+ bagp->bag = NEW(uint16, size);
+ for (i = 0; i < size; i++) {
+ READW(bagp->bag[i], fd);
+ SKIPW(fd); /* mod; ignored */
+ }
+ bagp->nbags = size;
+}
+
+
+/*----------------------------------------------------------------
+ * load preset/instrument generator list on the private table
+ *----------------------------------------------------------------*/
+
+static void load_gen(int size, SFBags *bagp, FILE *fd)
+{
+ int i;
+
+ size /= 4;
+ bagp->gen = NEW(SFGenRec, size);
+ for (i = 0; i < size; i++) {
+ READW(bagp->gen[i].oper, fd);
+ READW(bagp->gen[i].amount, fd);
+ }
+ bagp->ngens = size;
+}
+
+
+/*----------------------------------------------------------------
+ * load sample info list
+ *----------------------------------------------------------------*/
+
+static void load_sample_info(int size, SFInfo *sf, FILE *fd)
+{
+ int i;
+ int in_rom;
+
+ /* the record size depends on the soundfont version */
+ if (sf->version > 1) {
+ /* SF2 includes sample name and other infos */
+ sf->nsamples = size / 46;
+ sf->sample = NEW(SFSampleInfo, sf->nsamples);
+ } else {
+ /* SBK; sample name may be read already */
+ int nsamples = size / 16;
+ if (sf->sample == NULL) {
+ sf->nsamples = nsamples;
+ sf->sample = NEW(SFSampleInfo, sf->nsamples);
+ } else if (sf->nsamples != nsamples) {
+#if 0
+ fprintf(stderr, "*** different # of infos ?? (%d : %d)\n",
+ sf->nsamples, nsamples);
+ FSKIP(size, fd);
+ return;
+#endif
+ /* overwrite it */
+ sf->nsamples = nsamples;
+ }
+ }
+
+ in_rom = 1; /* data may start from ROM samples */
+ for (i = 0; i < sf->nsamples; i++) {
+ if (sf->version > 1) /* SF2 only */
+ READSTR(sf->sample[i].name, fd);
+ READDW(sf->sample[i].startsample, fd);
+ READDW(sf->sample[i].endsample, fd);
+ READDW(sf->sample[i].startloop, fd);
+ READDW(sf->sample[i].endloop, fd);
+ if (sf->version > 1) { /* SF2 only */
+ READDW(sf->sample[i].samplerate, fd);
+ READB(sf->sample[i].originalPitch, fd);
+ READB(sf->sample[i].pitchCorrection, fd);
+ READW(sf->sample[i].samplelink, fd);
+ READW(sf->sample[i].sampletype, fd);
+ } else { /* for SBK; set missing infos */
+ sf->sample[i].samplerate = 44100;
+ sf->sample[i].originalPitch = 60;
+ sf->sample[i].pitchCorrection = 0;
+ sf->sample[i].samplelink = 0;
+ /* the first RAM data starts from address 0 */
+ if (sf->sample[i].startsample == 0)
+ in_rom = 0;
+ if (in_rom)
+ sf->sample[i].sampletype = 0x8001;
+ else
+ sf->sample[i].sampletype = 1;
+ }
+ }
+}
+
+
+/*================================================================
+ * convert from bags to layers
+ *================================================================*/
+
+static void convert_layers(SFInfo *sf)
+{
+ int i;
+
+ if (prbags.bag == NULL || prbags.gen == NULL ||
+ inbags.bag == NULL || inbags.gen == NULL) {
+ fprintf(stderr, "*** illegal bags / gens\n");
+ return;
+ }
+
+ for (i = 0; i < sf->npresets - 1; i++) {
+ generate_layers(&sf->preset[i].hdr,
+ &sf->preset[i+1].hdr,
+ &prbags);
+ }
+ for (i = 0; i < sf->ninsts - 1; i++) {
+ generate_layers(&sf->inst[i].hdr,
+ &sf->inst[i+1].hdr,
+ &inbags);
+ }
+}
+
+
+/*----------------------------------------------------------------
+ * generate layer lists from stored bags
+ *----------------------------------------------------------------*/
+
+static void generate_layers(SFHeader *hdr, SFHeader *next, SFBags *bags)
+{
+ int i;
+ SFGenLayer *layp;
+
+ hdr->nlayers = next->bagNdx - hdr->bagNdx;
+ if (hdr->nlayers < 0) {
+ fprintf(stderr, "illegal layer numbers %d\n", hdr->nlayers);
+ return;
+ }
+ if (hdr->nlayers == 0)
+ return;
+ hdr->layer = (SFGenLayer*)safe_malloc(sizeof(SFGenLayer) * hdr->nlayers);
+ layp = hdr->layer;
+ for (layp = hdr->layer, i = hdr->bagNdx; i < next->bagNdx; layp++, i++) {
+ int genNdx = bags->bag[i];
+ layp->nlists = bags->bag[i+1] - genNdx;
+ if (layp->nlists < 0) {
+ fprintf(stderr, "illegal list numbers %d\n", layp->nlists);
+ return;
+ }
+ layp->list = (SFGenRec*)safe_malloc(sizeof(SFGenRec) * layp->nlists);
+ memcpy(layp->list, &bags->gen[genNdx],
+ sizeof(SFGenRec) * layp->nlists);
+ }
+}
+
+/*----------------------------------------------------------------
+ * free a layer
+ *----------------------------------------------------------------*/
+
+static void free_layer(SFHeader *hdr)
+{
+ int i;
+ for (i = 0; i < hdr->nlayers; i++) {
+ SFGenLayer *layp = &hdr->layer[i];
+ if (layp->nlists > 0)
+ free(layp->list);
+ }
+ if (hdr->nlayers > 0)
+ free(hdr->layer);
+}
Added: vkeybd/trunk/sffile.h
===================================================================
--- vkeybd/trunk/sffile.h 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/sffile.h 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,138 @@
+/*================================================================
+ * sffile.h
+ * SoundFont file (SBK/SF2) format defintions
+ *
+ * Copyright (C) 1996,1997 Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *================================================================*/
+
+#ifndef SFFILE_H_DEF
+#define SFFILE_H_DEF
+
+#include <stdio.h>
+#include "itypes.h"
+
+/* chunk record header */
+typedef struct _SFChunk {
+ char id[4];
+ int32 size;
+} SFChunk;
+
+/* generator record */
+typedef struct _SFGenRec {
+ int16 oper;
+ int16 amount;
+} SFGenRec;
+
+/* layered generators record */
+typedef struct _SFGenLayer {
+ int nlists;
+ SFGenRec *list;
+} SFGenLayer;
+
+/* header record */
+typedef struct _SFHeader {
+ char name[20];
+ uint16 bagNdx;
+ /* layered stuff */
+ int nlayers;
+ SFGenLayer *layer;
+} SFHeader;
+
+/* preset header record */
+typedef struct _SFPresetHdr {
+ SFHeader hdr;
+ uint16 preset, bank;
+ /*int32 lib, genre, morphology;*/ /* not used */
+} SFPresetHdr;
+
+/* instrument header record */
+typedef struct _SFInstHdr {
+ SFHeader hdr;
+} SFInstHdr;
+
+/* sample info record */
+typedef struct _SFSampleInfo {
+ char name[20];
+ int32 startsample, endsample;
+ int32 startloop, endloop;
+ /* ver.2 additional info */
+ int32 samplerate;
+ byte originalPitch;
+ byte pitchCorrection;
+ uint16 samplelink;
+ uint16 sampletype; /*1=mono, 2=right, 4=left, 8=linked, $8000=ROM*/
+ /* optional info */
+ int32 size; /* sample size */
+ int32 loopshot; /* short-shot loop size */
+} SFSampleInfo;
+
+
+/*----------------------------------------------------------------
+ * soundfont file info record
+ *----------------------------------------------------------------*/
+
+typedef struct _SFInfo {
+ /* file name */
+ char *sf_name;
+
+ /* version of this file */
+ int16 version, minorversion;
+ /* sample position (from origin) & total size (in bytes) */
+ long samplepos;
+ int32 samplesize;
+
+ /* raw INFO chunk list */
+ long infopos, infosize;
+
+ /* preset headers */
+ int npresets;
+ SFPresetHdr *preset;
+
+ /* sample infos */
+ int nsamples;
+ SFSampleInfo *sample;
+
+ /* instrument headers */
+ int ninsts;
+ SFInstHdr *inst;
+
+} SFInfo;
+
+
+/*----------------------------------------------------------------
+ * functions
+ *----------------------------------------------------------------*/
+
+/* sffile.c */
+int load_soundfont(SFInfo *sf, FILE *fp, int is_seekable);
+void free_soundfont(SFInfo *sf);
+void save_soundfont(SFInfo *sf, FILE *fin, FILE *fout);
+void load_textinfo(SFInfo *sf, FILE *fp);
+
+
+/* sample.c */
+void correct_samples(SFInfo *sf);
+extern int auto_add_blank;
+
+/* parsesf.c */
+int convert_soundfont(SFInfo *sf, int check_samples);
+extern int default_bank;
+extern int default_chorus, default_reverb;
+extern int default_volume;
+
+
+#endif
Added: vkeybd/trunk/sftovkb.1
===================================================================
--- vkeybd/trunk/sftovkb.1 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/sftovkb.1 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,68 @@
+.\" $Header: /aolnet/dev/src/CVS/sgml/docbook-to-man/cmd/docbook-to-man.sh,v 1.1.1.1 1998/11/13 21:31:59 db3l Exp $
+.\"
+.\" transcript compatibility for postscript use.
+.\"
+.\" synopsis: .P! <file.ps>
+.\"
+.de P!
+.fl
+\!!1 setgray
+.fl
+\\&.\"
+.fl
+\!!0 setgray
+.fl \" force out current output buffer
+\!!save /psv exch def currentpoint translate 0 0 moveto
+\!!/showpage{}def
+.fl \" prolog
+.sy sed -e 's/^/!/' \\$1\" bring in postscript file
+\!!psv restore
+.
+.de pF
+.ie \\*(f1 .ds f1 \\n(.f
+.el .ie \\*(f2 .ds f2 \\n(.f
+.el .ie \\*(f3 .ds f3 \\n(.f
+.el .ie \\*(f4 .ds f4 \\n(.f
+.el .tm ? font overflow
+.ft \\$1
+..
+.de fP
+.ie !\\*(f4 \{\
+. ft \\*(f4
+. ds f4\"
+' br \}
+.el .ie !\\*(f3 \{\
+. ft \\*(f3
+. ds f3\"
+' br \}
+.el .ie !\\*(f2 \{\
+. ft \\*(f2
+. ds f2\"
+' br \}
+.el .ie !\\*(f1 \{\
+. ft \\*(f1
+. ds f1\"
+' br \}
+.el .tm ? font underflow
+..
+.ds f1\"
+.ds f2\"
+.ds f3\"
+.ds f4\"
+'\" t
+.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n
+.TH "DeMuDi undocumented package" "1"
+.SH "NAME"
+% \(em program included in the DeMuDi distribution
+.SH "DESCRIPTION"
+.PP
+This program was packaged by the AGNULA team for the
+DeMuDi project (http://www.agnula.org).
+.PP
+A manual page for this application has not been provided
+yet.
+.SH "SEE ALSO"
+.PP
+info (1), whatis (1), apropos (1), dpkg (8), locate (1),
+find (1), updatedb (1), undocumented (2), man (7), missing (7)
+.\" created by instant / docbook-to-man, Thu 08 Apr 2004, 19:00
Added: vkeybd/trunk/sftovkb.c
===================================================================
--- vkeybd/trunk/sftovkb.c 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/sftovkb.c 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,72 @@
+/*
+ * convert from SoundFont file to vkeybd preset list file
+ *
+ * Copyright (c) 1999-2000 by Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include "util.h"
+#include "sffile.h"
+
+/* parse soundfont file and give the preset list */
+int main(int argc, char **argv)
+{
+ FILE *fp;
+ SFInfo sf;
+ int i;
+
+ if (argc < 2) {
+ fprintf(stderr, "usage: sftovkb soundfont\n");
+ exit(1);
+ }
+
+ /*fprintf(stderr, "opening %s..\n", argv[1]);*/
+ if ((fp = fopen(argv[1], "r")) == NULL) {
+ fprintf(stderr, "can't open soundfont file\n");
+ exit(1);
+ }
+ if (load_soundfont(&sf, fp, TRUE)) {
+ fprintf(stderr, "fail to read soundfont file\n");
+ exit(1);
+ }
+ fclose(fp);
+
+ for (i = 0; i < sf.npresets-1; i++) {
+ char *p;
+ /* convert illegal characters */
+ for (p = sf.preset[i].hdr.name; *p; p++) {
+ if (!isprint(*p) || *p == '{' || *p == '}')
+ *p = ' ';
+ else if (*p == '[')
+ *p = '(';
+ else if (*p == ']')
+ *p = ')';
+ }
+ printf("%d %d %s\n",
+ sf.preset[i].bank,
+ sf.preset[i].preset,
+ sf.preset[i].hdr.name);
+ }
+ free_soundfont(&sf);
+ return 0;
+}
+
Added: vkeybd/trunk/util.h
===================================================================
--- vkeybd/trunk/util.h 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/util.h 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,43 @@
+/*================================================================
+ * utility routines
+ *================================================================*/
+
+#ifndef UTIL_H_DEF
+#define UTIL_H_DEF
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#define numberof(ary) (sizeof(ary)/sizeof(ary[0]))
+#ifndef offsetof
+#define offsetof(s_type,field) ((int)(((char*)(&(((s_type*)NULL)->field)))-((char*)NULL)))
+#endif
+
+#define BITON(var,flag) ((var) |= (flag))
+#define BITOFF(var,flag) ((var) &= ~(flag))
+#define BITSWT(var,flag) ((var) ^= (flag))
+
+extern int verbose, debug;
+#define DEBUG(LVL,XXX) {if (verbose > LVL) { XXX; }}
+
+/* cmpopen.c */
+int CmpSearchFile(char *name);
+char *CmpExtension(int type);
+FILE *CmpOpenFile(char *name, int *flag);
+void CmpCloseFile(FILE *fp, int flag);
+
+/* malloc.c */
+void *safe_malloc(int size);
+void safe_free(void *ptr);
+
+/* signal.c */
+void add_signal(int sig, void (*handler)(), int exit_after);
+
+/* fskip.c */
+void fskip(int size, FILE *fd, int seekable);
+
+#endif
Added: vkeybd/trunk/vkb.c
===================================================================
--- vkeybd/trunk/vkb.c 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkb.c 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,374 @@
+/*
+ * main routine
+ *
+ * Virtual Tiny Keyboard
+ *
+ * Copyright (c) 1997-2000 by Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "vkb.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <tk.h>
+
+#ifndef Tk_Main
+#define Tk_Main(argc, argv, proc) \
+ Tk_MainEx(argc, argv, proc, Tcl_CreateInterp())
+#endif
+
+/*
+ */
+
+#define DEF_INST_CHAN_NO "0"
+#define DEF_DRUM_CHAN_NO "9"
+#define DEF_OCTAVES "3"
+
+/*
+ * prototypes
+ */
+
+static int usage(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int seq_on(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int seq_off(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int seq_start_note(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int seq_stop_note(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int seq_control(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int seq_program(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int seq_bender(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int seq_chorus_mode(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int seq_reverb_mode(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[]);
+static int vkb_app_init(Tcl_Interp *interp);
+
+/*
+ * local common variables
+ */
+static void *private;
+static int seq_opened = 0;
+static int seq_bank = 0, seq_preset = 0;
+static int seq_bend = 0;
+static vkb_oper_t *oper;
+
+#ifdef HAVE_LADCCA
+cca_args_t * cca_args = NULL;
+#endif
+
+/*
+ * main routine
+ */
+
+int main(int argc, char **argv)
+{
+ char **nargv;
+ int c, nargc;
+
+#ifdef HAVE_LADCCA
+ cca_args = cca_extract_args(&argc, &argv);
+#endif /* HAVE_LADCCA */
+
+ nargc = argc + 1;
+ if ((nargv = (char**)malloc(sizeof(char*) * nargc)) == NULL) {
+ fprintf(stderr, "vkeybd: can't malloc\n");
+ exit(1);
+ }
+ nargv[0] = "-f";
+ nargv[1] = VKB_TCLFILE;
+ for (c = 1; c < argc; c++)
+ nargv[c+1] = argv[c];
+
+ /* copy the default device operator */
+ if (vkb_num_devices <= 0) {
+ fprintf(stderr, "vkeybd: no device is defined\n");
+ exit(1);
+ }
+
+ /* call Tk main routine */
+ Tk_Main(nargc, nargv, vkb_app_init);
+
+ return 0;
+}
+
+
+/*
+ * print usage
+ */
+static int
+usage(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ int i;
+
+ fprintf(stderr, "vkeybd -- virtual keyboard\n");
+ fprintf(stderr, " version %s\n", VERSION_STR);
+ fprintf(stderr, "Copyright (c) 1997-2000 Takashi Iwai\n");
+ fprintf(stderr, "usage: vkeybd [-options]\n");
+ fprintf(stderr, "* general options:\n");
+ fprintf(stderr, " --device mode : specify output device (default = %s)\n", vkb_device[0]->name);
+ fprintf(stderr, " --keymap file : use own keymap file\n");
+ fprintf(stderr, " --preset file : use preset list file\n");
+ fprintf(stderr, " --channel number : specify instrument channel (0-15) (default = %s)\n", DEF_INST_CHAN_NO);
+ fprintf(stderr, " --drum number : specify drum channel (0-15) (default = %s)\n", DEF_DRUM_CHAN_NO);
+ fprintf(stderr, " --octave number : specify octaves of displaying keys (default = %s)\n", DEF_OCTAVES);
+ fprintf(stderr, "* output devices:\n");
+
+ for (i = 0; i < vkb_num_devices; i++) {
+ vkb_optarg_t *p;
+ fprintf(stderr, " %s = %s\n", vkb_device[i]->name, vkb_device[i]->desc);
+ if (! (p = vkb_device[i]->opts))
+ continue;
+ for (; p->name; p++)
+ fprintf(stderr, " %s (default = %s)\n",
+ p->desc, p->defval);
+ }
+ return TCL_OK;
+}
+
+
+
+/*
+ * Tcl commands to sequencer device
+ */
+
+/* open device */
+static int
+seq_on(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ int i;
+ const char *var;
+
+ if (seq_opened)
+ return TCL_OK;
+ if (! (var = Tcl_GetVar2(interp, "optvar", "device", TCL_GLOBAL_ONLY))) {
+ vkb_error(interp, "no output device defined");
+ return TCL_ERROR;
+ }
+ oper = NULL;
+ for (i = 0; i < vkb_num_devices && vkb_device[i]; i++) {
+ if (strcmp(vkb_device[i]->name, var) == 0) {
+ oper = vkb_device[i]->oper;
+ break;
+ }
+ }
+ if (! oper) {
+ vkb_error(interp, "no output device defined");
+ return TCL_ERROR;
+ }
+
+ if (argc > 1 && vkb_device[i]->delayed_open)
+ return TCL_OK;
+
+ if (oper->open(interp, &private)) {
+ seq_opened = 1;
+ Tcl_SetVar(interp, "seqswitch", "1", TCL_GLOBAL_ONLY);
+ if (oper->program)
+ oper->program(interp, private, seq_bank, seq_preset);
+ if (oper->bender)
+ oper->bender(interp, private, seq_bend);
+ }
+
+ return TCL_OK;
+}
+
+/* close device */
+static int
+seq_off(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ if (seq_opened) {
+ oper->close(interp, private);
+ seq_opened = 0;
+ Tcl_SetVar(interp, "seqswitch", "0", TCL_GLOBAL_ONLY);
+ }
+ return TCL_OK;
+}
+
+static int
+seq_start_note(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ int note, vel;
+ if (argc < 3)
+ return TCL_ERROR;
+ if (! seq_opened)
+ return TCL_OK;
+ note = atoi(argv[1]);
+ vel = atoi(argv[2]);
+ if (oper->noteon)
+ oper->noteon(interp, private, note, vel);
+ return TCL_OK;
+}
+
+static int
+seq_stop_note(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ int note, vel;
+ if (argc < 3)
+ return TCL_ERROR;
+ if (! seq_opened)
+ return TCL_OK;
+ note = atoi(argv[1]);
+ vel = atoi(argv[2]);
+ if (oper->noteoff)
+ oper->noteoff(interp, private, note, vel);
+ return TCL_OK;
+}
+
+static int
+seq_control(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ int type, val;
+ if (argc < 3)
+ return TCL_ERROR;
+ if (! seq_opened)
+ return TCL_OK;
+ type = atoi(argv[1]);
+ val = atoi(argv[2]);
+ if (oper->control)
+ oper->control(interp, private, type, val);
+ return TCL_OK;
+}
+
+static int
+seq_program(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ if (argc < 3)
+ return TCL_ERROR;
+ seq_bank = atoi(argv[1]);
+ seq_preset = atoi(argv[2]);
+ if (! seq_opened)
+ return TCL_OK;
+ if (oper->program)
+ oper->program(interp, private, seq_bank, seq_preset);
+ return TCL_OK;
+}
+
+static int
+seq_bender(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ if (argc < 2)
+ return TCL_ERROR;
+ seq_bend = atoi(argv[1]);
+ if (! seq_opened)
+ return TCL_OK;
+ if (oper->bender)
+ oper->bender(interp, private, seq_bend);
+ return TCL_OK;
+}
+
+static int
+seq_chorus_mode(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ if (argc < 2)
+ return TCL_ERROR;
+ if (seq_on(clientData, interp, argc, argv) != TCL_OK)
+ return TCL_ERROR;
+ if (oper->chorus_mode)
+ oper->chorus_mode(interp, private, atoi(argv[1]));
+ return TCL_OK;
+}
+
+static int
+seq_reverb_mode(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ if (argc < 2)
+ return TCL_ERROR;
+ if (seq_on(clientData, interp, argc, argv) != TCL_OK)
+ return TCL_ERROR;
+ if (oper->reverb_mode)
+ oper->reverb_mode(interp, private, atoi(argv[1]));
+ return TCL_OK;
+}
+
+
+/*
+ * Misc. functions
+ */
+
+void
+vkb_error(Tcl_Interp *ip, char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ fputs("ERROR: ", stderr);
+ vfprintf(stderr, fmt, ap);
+ putc('\n', stderr);
+ va_end(ap);
+}
+
+int
+vkb_get_int(Tcl_Interp *ip, char *opt, int *ret)
+{
+ const char *var;
+ if ((var = Tcl_GetVar2(ip, "optvar", opt, TCL_GLOBAL_ONLY)) != NULL && *var) {
+ *ret = atoi(var);
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * Initialize Tcl/Tk components
+ */
+static int
+vkb_app_init(Tcl_Interp *interp)
+{
+ int i;
+
+ if (Tcl_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (Tk_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+ Tcl_CreateCommand(interp, "usage", usage,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateCommand(interp, "SeqOn", seq_on,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateCommand(interp, "SeqOff", seq_off,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateCommand(interp, "SeqStartNote", seq_start_note,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateCommand(interp, "SeqStopNote", seq_stop_note,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateCommand(interp, "SeqControl", seq_control,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateCommand(interp, "SeqProgram", seq_program,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateCommand(interp, "SeqBender", seq_bender,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateCommand(interp, "SeqChorusMode", seq_chorus_mode,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateCommand(interp, "SeqReverbMode", seq_reverb_mode,
+ (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+
+ for (i = 0; i < vkb_num_devices; i++) {
+ vkb_optarg_t *p;
+ if (! (p = vkb_device[i]->opts))
+ continue;
+ for (; p->name; p++) {
+ Tcl_SetVar2(interp, "optvar", p->name, p->defval, TCL_GLOBAL_ONLY);
+ }
+ }
+
+ Tcl_SetVar2(interp, "optvar", "device", vkb_device[0]->name, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "optvar", "libpath", VKBLIB_DIR, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "optvar", "channel", DEF_INST_CHAN_NO, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "optvar", "drum", DEF_DRUM_CHAN_NO, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "optvar", "octave", DEF_OCTAVES, TCL_GLOBAL_ONLY);
+
+ return TCL_OK;
+}
+
Added: vkeybd/trunk/vkb.h
===================================================================
--- vkeybd/trunk/vkb.h 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkb.h 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,79 @@
+/*
+ * Virtual Tiny Keyboard
+ *
+ * Copyright (c) 1997-2000 by Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef VKB_H_DEF
+#define VKB_H_DEF
+
+#include <tcl.h>
+
+#ifdef HAVE_LADCCA
+#include <ladcca/ladcca.h>
+#endif
+
+#ifndef VKB_TCLFILE
+#define VKB_TCLFILE "/usr/local/bin/vkeybd.tcl"
+#endif
+
+/*
+ * device operator
+ */
+typedef struct vkb_oper_t {
+ int (*open)(Tcl_Interp *ip, void **private_return);
+ void (*close)(Tcl_Interp *ip, void *private);
+ void (*program)(Tcl_Interp *ip, void *private, int bank, int prg); /* bank=128: drum */
+ void (*noteon)(Tcl_Interp *ip, void *private, int note, int vel);
+ void (*noteoff)(Tcl_Interp *ip, void *private, int note, int vel);
+ void (*control)(Tcl_Interp *ip, void *private, int type, int val);
+ void (*bender)(Tcl_Interp *ip, void *private, int bend); /* -8192 to 8192 */
+ void (*chorus_mode)(Tcl_Interp *ip, void *private, int mode);
+ void (*reverb_mode)(Tcl_Interp *ip, void *private, int mode);
+} vkb_oper_t;
+
+/*
+ * Tcl global option variables
+ */
+typedef struct vkb_optarg_t {
+ char *name;
+ char *defval;
+ char *desc;
+} vkb_optarg_t;
+
+/*
+ * device information
+ */
+typedef struct vkb_devinfo_t {
+ char *name;
+ char *desc;
+ int delayed_open;
+ vkb_oper_t *oper;
+ vkb_optarg_t *opts;
+} vkb_devinfo_t;
+
+extern int vkb_num_devices;
+extern vkb_devinfo_t *vkb_device[];
+
+void vkb_error(Tcl_Interp *ip, char *fmt, ...);
+int vkb_get_int(Tcl_Interp *ip, char *opt, int *ret);
+
+#ifdef HAVE_LADCCA
+extern cca_args_t *cca_args;
+#endif
+
+#endif
Added: vkeybd/trunk/vkb_device.c
===================================================================
--- vkeybd/trunk/vkb_device.c 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkb_device.c 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,52 @@
+/*
+ * definition of operation table
+ *
+ * Virtual Tiny Keyboard
+ *
+ * Copyright (c) 1999-2000 by Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include "vkb.h"
+
+#define numberof(ary) (sizeof(ary)/sizeof(ary[0]))
+
+#ifdef VKB_USE_ALSA
+extern vkb_devinfo_t alsa_devinfo;
+#endif
+
+#ifdef VKB_USE_AWE
+extern vkb_devinfo_t awe_devinfo;
+#endif
+
+#ifdef VKB_USE_MIDI
+extern vkb_devinfo_t midi_devinfo;
+#endif
+
+vkb_devinfo_t *vkb_device[] = {
+#ifdef VKB_USE_ALSA
+ &alsa_devinfo,
+#endif
+#ifdef VKB_USE_AWE
+ &awe_devinfo,
+#endif
+#ifdef VKB_USE_MIDI
+ &midi_devinfo,
+#endif
+};
+
+int vkb_num_devices = numberof(vkb_device);
Added: vkeybd/trunk/vkeybd.1
===================================================================
--- vkeybd/trunk/vkeybd.1 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkeybd.1 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,68 @@
+.\" $Header: /aolnet/dev/src/CVS/sgml/docbook-to-man/cmd/docbook-to-man.sh,v 1.1.1.1 1998/11/13 21:31:59 db3l Exp $
+.\"
+.\" transcript compatibility for postscript use.
+.\"
+.\" synopsis: .P! <file.ps>
+.\"
+.de P!
+.fl
+\!!1 setgray
+.fl
+\\&.\"
+.fl
+\!!0 setgray
+.fl \" force out current output buffer
+\!!save /psv exch def currentpoint translate 0 0 moveto
+\!!/showpage{}def
+.fl \" prolog
+.sy sed -e 's/^/!/' \\$1\" bring in postscript file
+\!!psv restore
+.
+.de pF
+.ie \\*(f1 .ds f1 \\n(.f
+.el .ie \\*(f2 .ds f2 \\n(.f
+.el .ie \\*(f3 .ds f3 \\n(.f
+.el .ie \\*(f4 .ds f4 \\n(.f
+.el .tm ? font overflow
+.ft \\$1
+..
+.de fP
+.ie !\\*(f4 \{\
+. ft \\*(f4
+. ds f4\"
+' br \}
+.el .ie !\\*(f3 \{\
+. ft \\*(f3
+. ds f3\"
+' br \}
+.el .ie !\\*(f2 \{\
+. ft \\*(f2
+. ds f2\"
+' br \}
+.el .ie !\\*(f1 \{\
+. ft \\*(f1
+. ds f1\"
+' br \}
+.el .tm ? font underflow
+..
+.ds f1\"
+.ds f2\"
+.ds f3\"
+.ds f4\"
+'\" t
+.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n
+.TH "DeMuDi undocumented package" "1"
+.SH "NAME"
+vkeybd \(em program included in the DeMuDi distribution
+.SH "DESCRIPTION"
+.PP
+This program was packaged by the AGNULA team for the
+DeMuDi project (http://www.agnula.org).
+.PP
+A manual page for this application has not been provided
+yet.
+.SH "SEE ALSO"
+.PP
+info (1), whatis (1), apropos (1), dpkg (8), locate (1),
+find (1), updatedb (1), undocumented (2), man (7), missing (7)
+.\" created by instant / docbook-to-man, Thu 08 Apr 2004, 19:00
Added: vkeybd/trunk/vkeybd.desktop
===================================================================
--- vkeybd/trunk/vkeybd.desktop 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkeybd.desktop 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Application
+Name=vkeybd
+Comment=A virtual MIDI keyboard
+Exec=vkeybd
+Icon=vkeybd
Added: vkeybd/trunk/vkeybd.list
===================================================================
--- vkeybd/trunk/vkeybd.list 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkeybd.list 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,333 @@
+128 8 Room (SC-55)
+128 7 Room (SC-88)
+128 127 CM-64/32 Set (SC-55)
+128 57 Rhythm FX (SC-88)
+128 56 SFX (SC-55)
+128 50 Kick & Snare (SC-88)
+128 49 Ethnic (SC-88)
+128 48 Orchestra (SC-55)
+128 40 Brush (SC-55)
+128 32 Jazz (SC-55)
+128 26 Dance (SC-88)
+128 25 TR-909 (SC-55)
+128 24 Electronic (SC-55)
+128 16 Power (SC-55)
+128 1 Standard 2 (SC-88)
+128 0 Standard 1 (SC-55)
+0 123 Bird
+0 0 Piano 1
+0 1 Piano 2
+0 2 Piano 3
+0 3 Honky Tonk
+0 4 E.Piano 1
+0 5 E.Piano 2
+0 6 Harpsichord
+0 7 Clavinet
+0 8 Celesta
+0 9 Glockenspiel
+0 10 Music Box
+0 11 Vibraphone
+0 12 Marimba
+0 13 Xylophone
+0 14 Tubular Bells
+0 15 Dulcimer
+0 16 Organ 1
+0 17 Organ 2
+0 18 Organ 3
+0 19 Church Organ
+0 20 Reed Organ
+0 21 Accordion
+0 22 Harmonica
+0 23 Bandoneon
+0 24 Nylon Guitar
+0 25 Steel Guitar
+0 26 Jazz Guitar
+0 27 Clean Guitar
+0 28 Guitar Mutes
+0 29 Overdrive Guitar
+0 30 DistortionGuitar
+0 31 Guitar Harmonics
+0 32 Acoustic Bass
+0 33 Fingered Bass
+0 34 Picked Bass
+0 35 Fretless Bass
+0 36 Slap Bass 1
+0 37 Slap Bass 2
+0 38 Synth Bass 1
+0 39 Synth Bass 2
+0 40 Violin
+0 41 Viola
+0 42 Cello
+0 43 Contrabass
+0 44 Tremolo Strings
+0 45 Pizzicato
+0 46 Harp
+0 47 Timpani
+0 48 Strings
+0 49 Slow Strings
+0 50 Synth Strings 1
+0 51 Synth Strings 2
+0 52 Choir Aahs
+0 53 Voice Oohs
+0 54 Synth Vox
+0 55 Orchestra Hit
+0 56 Trumpet
+0 57 Trombone
+0 58 Tuba
+0 59 Mute Trumpet
+0 60 French Horns
+0 61 Brass
+0 62 Synth Brass 1
+0 63 Synth Brass 2
+0 64 Soprano Sax
+0 65 Alto Sax
+0 66 Tenor Sax
+0 67 Baritone Sax
+0 68 Oboe
+0 69 English Horn
+0 70 Bassoon
+0 71 Clarinet
+0 72 Piccolo
+0 73 Flute
+0 74 Recorder
+0 75 Pan Flute
+0 76 Bottle Chiff
+0 77 Shakuhachi
+0 78 Whistle
+0 79 Ocarina
+0 80 Square Wave
+0 81 Saw Wave
+0 82 Synth Calliope
+0 83 Chiffer Lead
+0 84 Charang
+0 85 Solo Vox
+0 86 5th Saw Wave
+0 87 Bass & Lead
+0 88 Fantasia
+0 89 Warm Pad
+0 90 Poly Synth
+0 91 Space Voice
+0 92 Bowed Glass
+0 93 Metal Pad
+0 94 Halo Pad
+0 95 Sweep Pad
+0 96 Ice Rain
+0 97 Soundtrack
+0 98 Crystal
+0 99 Atmosphere
+0 100 Brightness
+0 101 Goblin
+0 102 Echo Drops
+0 103 Star Theme
+0 104 Sitar
+0 105 Banjo
+0 106 Shamisen
+0 107 Koto
+0 108 Kalimba
+0 109 Bagpipe
+0 110 Fiddle
+0 111 Shenai
+0 112 Tinker Bell
+0 113 Agogo
+0 114 Steel Drum
+0 115 Wood Block
+0 116 Taiko Drum
+0 117 Melodic Tom
+0 118 Synth Drum
+0 119 Reverse Cymbal
+0 120 Fret Noise
+0 121 Breath Noise
+0 122 Seashore
+0 124 Telephone
+0 125 Helicopter
+0 126 Applause
+0 127 Gunshot
+1 120 Cut Noise
+2 120 String Slap
+1 121 Fl. Key Click
+1 122 Rain
+2 122 Thunder
+3 122 Wind
+4 122 Stream
+5 122 Bubble
+1 123 Dog
+2 123 Horse-Gallop
+1 124 Telephone 2
+2 124 Door Creaking
+3 124 Door
+4 124 Scratch
+5 124 Windchime
+1 125 Car-Engine
+2 125 Car-Stop
+3 125 Car-Pass
+4 125 Car-Crash
+5 125 Siren
+6 125 Train
+7 125 Jetplane
+8 125 Starship
+9 125 Burst Noise
+1 126 Laughing
+2 126 Screaming
+3 126 Punch
+4 126 Heart Beat
+5 126 Footsteps
+1 127 Machine Gun
+2 127 Lasergun
+3 127 Explosion
+8 4 Detuned Rhodes
+8 5 Detuned EP2
+8 6 Coupled Harpsichord
+8 14 Church Bell
+8 16 Detuned Organ 1
+8 17 Detuned Organ 2
+8 19 Detuned Organ 3
+8 21 Italian Accordion
+8 24 Ukulele
+8 25 12 St. Guitar
+16 25 Mandolin
+8 26 Hawaiian Guitar
+8 27 Chorus Guitar
+8 28 Funk Guitar
+8 30 FeedBack Guitar
+8 31 Guitar Feedback
+8 38 SynthBass 3
+8 39 SynthBass 4
+8 48 Orchestra Pad
+8 50 Syn Strings 3
+8 61 Brass 2
+8 62 Synth Brass 3
+8 63 Synth Brass 4
+8 80 Sine Wave
+8 107 Taisho Koto
+8 115 Castanets
+8 116 Concert BD
+8 117 Melo Tom 2
+8 118 808 Tom
+127 0 Acou Piano 1
+127 1 Acou Piano 2
+127 2 Acou Piano 3
+127 3 Elec Piano 1
+127 4 Elec Piano 2
+127 5 Elec Piano 3
+127 6 Elec Piano 4
+127 7 Honky Tonk MT
+127 8 Elec Organ 1
+127 9 Elec Organ 2
+127 10 Elec Organ 3
+127 11 Elec Organ 4
+127 12 Pipe Organ 1
+127 13 Pipe Organ 2
+127 14 Pipe Organ 3
+127 15 Accordion MT
+127 16 Harpsichord 1
+127 17 Harpsichord 2
+127 18 Harpsichord 3
+127 19 Clavinet 1
+127 20 Clavinet 2
+127 21 Clavinet 3
+127 22 Celesta 1
+127 23 Celesta 2
+127 24 Syn Brass 1 MT
+127 25 Syn Brass 2 MT
+127 26 Syn Brass 3 MT
+127 27 Syn Brass 4 MT
+127 28 Syn Bass 1 MT
+127 29 Syn Bass 2 MT
+127 30 Synth Bass 3
+127 31 Synth Bass 4
+127 32 Fantasy MT
+127 33 Harmo Pad
+127 34 Choral
+127 35 Glasses
+127 36 Soundtrack MT
+127 37 Atmosphere MT
+127 38 Warm Bell
+127 39 Funny Vox
+127 40 Echo Bell
+127 41 Ice Rain MT
+127 42 Oboe 2001
+127 43 Echo Pan
+127 44 Dr Solo
+127 45 School Daze
+127 46 Bellsinger
+127 47 Square Wave MT
+127 48 String Sect 1
+127 49 String Sect 2
+127 50 String Sect 3
+127 51 Pizzicato MT
+127 52 Violin 1
+127 53 Violin 2
+127 54 Cello 1
+127 55 Cello 2
+127 56 Contrabass MT
+127 57 Harp 1
+127 58 Harp 2
+127 59 Guitar 1
+127 60 Guitar 2
+127 61 Elec Guit 1
+127 62 Elec Guit 2
+127 63 Sitar MT
+127 64 Acoustic Bass 1
+127 65 Acoustic Bass 2
+127 66 Elec Bass 1
+127 67 Elec Bass 2
+127 68 Slap Bass 1 MT
+127 69 Slap Bass 2 MT
+127 70 Fretless Bass 1
+127 71 Fretless Bass 2
+127 72 Flute 1
+127 73 Flute 2
+127 74 Piccolo 1
+127 75 Piccolo 2
+127 76 Recorder MT
+127 77 Pan Pipes MT
+127 78 Sax 1
+127 79 Sax 2
+127 80 Sax 3
+127 81 Sax 4
+127 82 Clarinet 1
+127 83 Clarinet 2
+127 84 Oboe MT
+127 85 English Horn MT
+127 86 Bassoon MT
+127 87 Harmonica MT
+127 88 Trumpet 1
+127 89 Trumpet 2
+127 90 Trombone 1
+127 91 Trombone 2
+127 92 French Horn 1
+127 93 French Horn 2
+127 94 Tuba MT
+127 95 Brass Sect 1
+127 96 Brass Sect 2
+127 97 Vibraphone 1
+127 98 Vibraphone 2
+127 99 Synth Mallet
+127 100 Wind Chime
+127 101 Glockenspiel MT
+127 102 Tube Bell
+127 103 Xyolophone MT
+127 104 Marimba MT
+127 105 Koto MT
+127 106 Sho
+127 107 Shakuhachi MT
+127 108 Whistle 1
+127 109 Whistle 2
+127 110 Bottle Blow
+127 111 Breath Pipe
+127 112 Timpani MT
+127 113 Melodic Tom MT
+127 114 Deep Snare
+127 115 Elec Perc 1
+127 116 Elec Perc 2
+127 117 Taiko
+127 118 Taiko Rim
+127 119 Cymbal
+127 120 Castanets MT
+127 121 Triangle
+127 122 Orche Hit
+127 123 Telephone MT
+127 124 Bird Tweet
+127 125 One Note Jam
+127 126 Water Bell
+127 127 Jungle Tune
Added: vkeybd/trunk/vkeybd.man
===================================================================
--- vkeybd/trunk/vkeybd.man 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkeybd.man 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,198 @@
+.TH vkeybd 1 "January 1, 2000"
+.LO 1
+.SH NAME
+vkeybd \- virtual keyboard on X
+
+.SH SYNOPSIS
+.B vkeybd
+[\-options]
+
+.SH DESCRIPTION
+.B vkeybd
+is a virtual keyboard for AWE/OSS, MIDI/OSS and ALSA drivers.
+It's a simple fake of a MIDI keyboard on X-windows system.
+Enjoy a music with your mouse and
+.I computer
+keyboard :-)
+
+.SH OPTIONS
+.SS "Common Options"
+.TP
+.B \--device mode
+Use the specified mode for output device.
+The argument are
+.B awe,
+.B midi
+or
+.B alsa,
+for AWE/OSS, MIDI/OSS and ALSA devices, respectively.
+Default is
+.B alsa.
+.TP
+.B \--config file
+Use the specified file as config file (see section "KEYBOARD").
+.TP
+.B \--preset file
+Use the specified file as preset list file (see section "PRESET LIST FILE").
+.TP
+.B \--channel num
+Specify the channel to be played for normal instruments.
+Valid only for MIDI and ALSA devices. Default is 0.
+.TP
+.B \--drum num
+Specify the channel to be played for drum instruments.
+Valid only for MIDI and ALSA devices. Default is 9.
+.TP
+.B \--octave num
+Specify the number of octaves to display keys.
+Default is 3.
+
+.SS "ALSA Device Option"
+.TP
+.B \--addr destination
+Set ALSA client and port numbers to be connected.
+If argument begins with 's' or 'S', the port is opened as subscription
+port, and events are sent to all connected subscribers. The port can be
+connected to other ports via
+.B aconnect(1).
+Otherwise,
+.B vkeybd
+connects directly to the specified port. The argument must be
+a form like client:port or client.port, where client and port are index
+numbers listed in
+.B /proc/asound/seq/clients.
+Default is 's'.
+.TP
+.B \--name string
+Specify the name of client/port. Some applications like tk707
+check the client/port name whether it is a valid MIDI device port.
+This options makes vkeybd possible to "fake" as a real MIDI device.
+
+.SS "OSS Sequencer Device Options"
+.TP
+.B \--seqdev file
+Specify the device file path for sequencer access.
+As default
+.B /dev/sequencer
+is used.
+.TP
+.B \--seqidx num
+Specify the synth device index for AWE32/64 WaveTable.
+If negative value is given, the device is auto-probed.
+Default value is -1.
+
+.SS "MIDI Device Option"
+.TP
+.B \--mididev num
+Speicfy the file path of MIDI device.
+Default value is /dev/midi.
+
+.SH "FILE MENU"
+.I Connection
+shows whether the
+.B vkeybd
+connects to the device.
+On OSS system, only one application is allowed to access sequencer
+device. Thus, if one wants to play another program even using another
+device, he needs to disconnect
+.B vkeybd
+once. On ALSA or OSS emulation
+on ALSA, you don't have to switch
+.B vkeybd
+off, since multiple access is allowed.
+
+With
+.I "Save Config",
+the current keymap and view configuration are
+saved on
+.B ~/.vkeybdrc
+config file. This file will be read at the next
+invoke.
+
+.SH "VIEW MENU"
+Thie menu shows the check buttons to toggle the display of control
+buttons.
+
+With
+.I Key/Velocity
+button, a key and a velocity scale bars are
+shown. The key scale indicates the lowest note value of the visible
+keyboard (as default 48 = C4). The velocity scale bar is used to
+change the velocity of each note-on.
+
+With
+.I Control
+button, controls for the current channel and for the
+MIDI continous-controls are enabled. The channel number is increased
+or decreased by clicking the right or left button around the shown
+channel number. The bank and preset are remembered for each channel.
+You may choose the CC to be adjusted by pull-down menu, which
+indicates
+.I ModWheel
+as default. Then change the parameter value with
+the scale bar at the right side.
+
+With
+.I Pitch
+button, you may adjust pitch wheel. The pitch goes
+back to the center position when you click the
+.I "Pitch Clear"
+button at the left.
+
+With
+.I Program
+button, the selection list of playing instrument is
+toggled. The shown presets are read from preset list file.
+
+.SH "KEYBOARD"
+Each visible key is mapped on your computer keyboard from 'z' to '\\'.
+To use the computer keyboard, you should turn off auto repeat on your
+X display via
+.B xset(1)
+:
+.IP "" 4
+% xset -r
+.PP
+
+The key assignment can be changed by editting the config file
+.B ~/.vkeybdrc.
+Once save the current configuration via
+.I "File/Save Config"
+menu. The config file is the Tcl source, and you may change the list
+of keymap as you wish.
+
+The keymap is a list of elements consisting on the key symbol and the
+corresponding note offset. The key symbol is the X key symbol for
+assigned key, and note offset is the shifted note number from note key
+of beginning of keyboard, which is changed by
+.I Key
+scalebar.
+For example, when a pair of {a 8} is defined and the lowest MIDI key
+is 48, a MIDI note 56 will be turned on by pressing the key 'a'.
+
+.SH "PRESET LIST FILE"
+The preset list file is used to describe the list of MIDI preset
+names. If the command line option is omitted, the default preset list
+file
+.B ~/vkeybd.list,
+.B ~/.vkeybd.list
+and
+.B $vkblib/vkeybd.list
+are searched sequentially. The preset list will appear when
+.I Program
+toggle button is on, and you can select a tone to be played from the list.
+.PP
+The preset list file can be converted from
+.B SoundFont(tm)
+file via
+.B sftovkb(1)
+utility. For example,
+.IP "" 4
+% sftovkb synthgm.sbk > vkeybd.list
+.PP
+
+.SH "SEE ALSO"
+sftovkb(1), X(1), xset(1), aconnect(1)
+
+.SH AUTHOR
+Takashi Iwai <tiwai@suse.de>
Added: vkeybd/trunk/vkeybd.spec
===================================================================
--- vkeybd/trunk/vkeybd.spec 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkeybd.spec 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,91 @@
+%define ver 0.1.10
+
+Summary: Virtual Keyboard
+Name: vkeybd
+Version: %ver
+Release: 1
+Copyright: GPL
+Group: Applications/Sound
+Source: http://members.tripod.de/iwai/vkeybd-%{ver}.tgz
+BuildRoot: /tmp/rpmtest
+URL: http//members.tripod.de/iwai/awedrv.html
+%description
+====================================================================
+ VIRTUAL KEYBOARD ver.0.1.10
+ Takashi Iwai <tiwai@suse.de>
+====================================================================
+
+This is a virtual keyboard for AWE, MIDI and ALSA drivers.
+It's a simple fake of a MIDI keyboard on X-windows system.
+Enjoy a music with your mouse and "computer" keyboard :-)
+
+The program requires Tcl7.5/Tk4.1 or newer libraries.
+This program supports:
+ - ALSA driver ver.0.5.x (default)
+ - AWE driver ver.0.4.3 on OSS
+ - Raw MIDI device on OSS and ALSA
+%prep
+%setup
+%build
+make PREFIX=/usr
+
+%install
+make PREFIX="$RPM_BUILD_ROOT"/usr install-all
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+/usr/bin/*
+/usr/man/*
+%dir /usr/share/vkeybd
+
+%doc README
+
+%package -n vkeybd-ossonly
+====================================================================
+ VIRTUAL KEYBOARD ver.0.1.10
+ Takashi Iwai <tiwai@suse.de>
+====================================================================
+
+This is a virtual keyboard for AWE, MIDI and ALSA drivers.
+It's a simple fake of a MIDI keyboard on X-windows system.
+Enjoy a music with your mouse and "computer" keyboard :-)
+
+The program requires Tcl7.5/Tk4.1 or newer libraries.
+This program supports:
+ - AWE driver ver.0.4.3 on OSS
+ - Raw MIDI device on OSS
+%description
+====================================================================
+ VIRTUAL KEYBOARD ver.0.1.10
+ Takashi Iwai <tiwai@suse.de>
+====================================================================
+
+This is a virtual keyboard for AWE, MIDI and ALSA drivers.
+It's a simple fake of a MIDI keyboard on X-windows system.
+Enjoy a music with your mouse and "computer" keyboard :-)
+
+The program requires Tcl7.5/Tk4.1 or newer libraries.
+This program supports:
+ - ALSA driver ver.0.5.x (default)
+ - AWE driver ver.0.4.3 on OSS
+ - Raw MIDI device on OSS and ALSA
+%prep
+%setup
+%build
+make PREFIX=/usr USE_ALSA=0
+
+%install
+make PREFIX="$RPM_BUILD_ROOT"/usr USE_ALSA=0 install-all
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+/usr/bin/*
+/usr/man/*
+%dir /usr/share/vkeybd
+
+%doc README
+
Added: vkeybd/trunk/vkeybd.tcl
===================================================================
--- vkeybd/trunk/vkeybd.tcl 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkeybd.tcl 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,783 @@
+#!/usr/bin/wish -f
+#
+# Virtual Tiny Keyboard
+#
+# Copyright (c) 1997-2000 by Takashi Iwai
+#
+# turn off auto-repeat on your X display by "xset -r"
+#
+
+#----------------------------------------------------------------
+# default files
+#----------------------------------------------------------------
+
+# preset list file
+set defpresetfile vkeybd.list
+set defconfig vkeybdrc
+set defkeymap vkeybdmap
+
+#----------------------------------------------------------------
+# keyboard size (width & height)
+
+set keywid 18
+set keyhgt 72
+
+#----------------------------------------------------------------
+# keyboard octaves
+
+set optvar(octave) 3
+
+#----------------------------------------------------------------
+# create virtual keyboard
+
+proc CheckKeymap {target} {
+ global keymap keywin
+ foreach i $keymap {
+ set key [lindex $i 0]
+ if {$key == $target} {
+ return 0
+ }
+ }
+ return 1
+}
+
+proc IncKeyBase {} {
+ global keybase optvar
+ if {$keybase < [expr 120 - ($optvar(octave) * 12)]} {
+ set keybase [expr $keybase + 12]
+ }
+}
+
+proc DecKeyBase {} {
+ global keybase optvar
+ if {$keybase >= 12} {
+ set keybase [expr $keybase - 12]
+ }
+}
+
+proc KeybdCreate {w} {
+ global keycolor keywid keyitem keyindex keyhgt keymap keywin
+ global optvar
+
+ set keywin $w
+
+ canvas $w -width [expr $keywid * $optvar(octave) * 7] -height $keyhgt -bd 1 -bg black
+ set numkeys [expr $optvar(octave) * 12]
+ pack $w -side top
+ for {set i 0} {$i < $numkeys} {incr i} {
+ set octave [expr ($i / 12) * 7]
+ set j [expr $i % 12]
+ if {$j >= 5} {incr j}
+ if {$j % 2 == 0} {
+ set x1 [expr ($octave + $j / 2) * $keywid]
+ set x2 [expr $x1 + $keywid]
+ set y1 0
+ set y2 $keyhgt
+ set id [$w create rectangle $x1 $y1 $x2 $y2 -width 1\
+ -fill white -outline black -tags ebony]
+ set keycolor($i) white
+ } else {
+ set x1 [expr ($octave + $j / 2) * $keywid + $keywid * 6/10]
+ set x2 [expr $x1 + $keywid * 8/10 - 1]
+ set y1 0
+ set y2 [expr $keyhgt * 6 / 10]
+ set id [$w create rectangle $x1 $y1 $x2 $y2 -width 1\
+ -fill black -outline white -tags ivory]
+ set keycolor($i) black
+ }
+ set keyitem($i) $id
+ set keyindex($id) $i
+ $w bind $id <Button-1> [list KeyStart $i 1]
+ $w bind $id <ButtonRelease-1> [list KeyStop $i 1]
+ $w bind $id <Motion> [list KeyMotion $i %x %y %s]
+ }
+ $w lower ebony
+
+ foreach i $keymap {
+ set key [lindex $i 0]
+ set note [lindex $i 1]
+ bind $w <KeyPress-$key> [list KeyQueue 1 $note 0]
+ bind $w <KeyRelease-$key> [list KeyQueue 0 $note 0]
+ }
+
+ #
+ # some special key sequences
+ #
+ if [CheckKeymap Escape] {
+ bind $w <Key-Escape> {SeqOff; ResetControls}
+ }
+ bind $w <Control-c> {exit 0}
+ bind $w <Control-q> {exit 0}
+ bind $w <Key-Up> {IncKeyBase}
+ bind $w <Key-Right> {IncKeyBase}
+ bind $w <Key-Down> {DecKeyBase}
+ bind $w <Key-Left> {DecKeyBase}
+ focus $w
+}
+
+#----------------------------------------------------------------
+# key press/release, filter autorepeats
+#
+# a nice hack by Roger E Critchlow Jr <rec@elf.org>
+#
+
+set KeyEventQueue {}
+
+proc KeyQueue {type note time} {
+ global KeyEventQueue
+ lappend KeyEventQueue $type $note $time
+ after idle KeyProcessQueue
+}
+
+proc KeyProcessQueue {} {
+ global KeyEventQueue
+ while {1} {
+ switch [llength $KeyEventQueue] {
+ 0 return
+ 3 {
+ foreach {type note time} $KeyEventQueue break
+ KeyProcess $type $note $time
+ set KeyEventQueue [lrange $KeyEventQueue 3 end]
+ }
+ default {
+ foreach {type1 note1 time1 type2 note2 time2} $KeyEventQueue break
+ if {$note1 == $note2 && $time1 == $time2 && $type1 == 0 && $type2 == 1} {
+ set KeyEventQueue [lrange $KeyEventQueue 6 end]
+ continue;
+ } else {
+ KeyProcess $type1 $note1 $time1
+ set KeyEventQueue [lrange $KeyEventQueue 3 end]
+ }
+ }
+ }
+ }
+}
+
+proc KeyProcess {type note time} {
+ if {$type} {
+ KeyStart $note 0
+ } else {
+ KeyStop $note 0
+ }
+}
+
+#----------------------------------------------------------------
+# note on/off
+
+# base key note and default velocity
+set keybase 48
+set keyvel 127
+set activekey ""
+
+proc KeyStart {key button} {
+ global keybase keywin keyitem keyvel activekey
+ SeqOn
+ if {$button == 1} {
+ set activekey $keyitem($key)
+ }
+ $keywin itemconfigure $keyitem($key) -fill blue
+ set key [expr $key + $keybase]
+ SeqStartNote $key $keyvel
+}
+
+proc KeyStop {key button} {
+ global keybase keywin keyitem keyindex keycolor activekey
+ SeqOn
+ if {$button == 1 && $activekey != ""} {
+ set key $keyindex($activekey)
+ set activekey ""
+ }
+ $keywin itemconfigure $keyitem($key) -fill $keycolor($key)
+ set key [expr $key + $keybase]
+ SeqStopNote $key 0
+}
+
+proc KeyMotion {key x y s} {
+ global activekey keywin keyitem keyindex
+ if {($s & 256) == 0} {
+ if {$activekey != ""} {
+ KeyStop $keyindex($activekey) 1
+ }
+ return
+ }
+ set new [lindex [$keywin find overlapping $x $y $x $y] end]
+ if {$new != $activekey} {
+ if {$activekey != ""} {
+ KeyStop $keyindex($activekey) 1
+ }
+ if {$new != ""} {
+ KeyStart $keyindex($new) 1
+ }
+ }
+}
+#----------------------------------------------------------------
+# midi controls
+
+set controls {
+ {"ModWheel" 1 0}
+ {"Volume" 7 127}
+ {"Express" 11 127}
+ {"Panning" 10 64}
+ {"Reverb" 91 0}
+ {"Chorus" 93 0}
+ {"Sustain" 64 0}
+ {"Sostenuto" 66 0}
+}
+
+proc ResetControls {{send_seq 0}} {
+ global controls curctrl ctrlval
+ foreach i $controls {
+ set type [lindex $i 1]
+ set ctrlval($type) [lindex $i 2]
+ if {$send_seq} {SeqControl $type $ctrlval($type)}
+ }
+ # all sounds off
+ SeqControl 120 0
+}
+
+proc NewControl {w ctrl} {
+ global curctrl ctrlval
+ set type [lindex $ctrl 1]
+ set curctrl $type
+ $w.ctrl configure -text [lindex $ctrl 0]
+ $w.val configure -variable ctrlval($type)
+ SeqControl $type $ctrlval($type)
+}
+
+#----------------------------------------------------------------
+# program selection
+
+# make a bank and preset list from preset file
+
+proc MakeLists {w} {
+ global sflist bankvar bankmode optvar
+
+ set sflist {}
+ if {[file readable $optvar(preset)]} {
+ ReadSF $optvar(preset) sflist
+ }
+
+ if {$sflist == {}} {
+ lappend sflist [list 0 0 "Piano"]
+ }
+
+ foreach i $sflist {
+ set bank [lindex $i 0]
+ set bankvar($bank) 1
+ }
+
+ $w.b.list delete 0 end
+ $w.b.list insert end "all"
+ foreach i [lsort -integer [array names bankvar]] {
+ $w.b.list insert end [format "%03d" $i]
+ }
+ set bankmode all
+
+ MakePresets $w
+}
+
+# read preset table
+
+proc ReadSF {fname var} {
+ upvar $var listp
+ set file [open $fname r]
+ if {$file == ""} {
+ puts stderr "can't open file $fname."
+ return
+ }
+ while {1} {
+ set line [string trim [gets $file]]
+ if {$line == ""} {break}
+ if {[string match "#*" $line]} {continue}
+ set bank [lindex $line 0]
+ set preset [lindex $line 1]
+ set name [lrange $line 2 [llength $line]]
+ lappend listp [list $bank $preset $name]
+ }
+
+ close $file
+}
+
+
+
+# compare two preset list elements
+
+proc listcmp {a b} {
+ set v [expr [lindex $a 0] - [lindex $b 0]]
+ if {$v == 0} {
+ set v [expr [lindex $a 1] - [lindex $b 1]]
+ }
+ return $v
+}
+
+# make preset list
+
+proc MakePresets {w} {
+ global sflist bankmode
+ $w.p.list delete 0 end
+ foreach i [lsort -command listcmp $sflist] {
+ set str [eval format "%03d:%03d:%s" $i]
+ if {$bankmode == "all" || $bankmode == [lindex $i 0]} {
+ $w.p.list insert end $str
+ }
+ }
+}
+
+# change the current channel
+
+proc InitPreset {} {
+ global chanbank chanpreset
+ for {set i 0} {$i < 16} {incr i} {
+ if {$i == 9} {
+ set chanbank($i) 128
+ } else {
+ set chanbank($i) 0
+ }
+ set chanpreset($i) 0
+ }
+}
+
+proc DecrChannel {} {
+ global optvar chanbank chanpreset
+ if {$optvar(channel) > 0} {
+ set optvar(channel) [expr $optvar(channel) - 1]
+ # all sounds off
+ SeqControl 120 0
+ SeqProgram $chanbank($optvar(channel)) $chanpreset($optvar(channel))
+ }
+}
+
+proc IncrChannel {} {
+ global optvar chanbank chanpreset
+ if {$optvar(channel) < 15} {
+ incr optvar(channel)
+ # all sounds off
+ SeqControl 120 0
+ SeqProgram $chanbank($optvar(channel)) $chanpreset($optvar(channel))
+ }
+}
+
+# remake preset list from selected bank listbox
+
+proc BankSelect {w coord} {
+ global bankmode
+ set idx [$w.b.list nearest $coord]
+ if {$idx == ""} {return}
+ set sel [$w.b.list get $idx]
+ if {$sel == "all"} {
+ set mode all
+ } else {
+ scan $sel "%d" mode
+ }
+ if {$mode != $bankmode} {
+ set bankmode $mode
+ MakePresets $w
+ }
+ $w.b.label configure -text "Bank:$bankmode"
+}
+
+# set the selected preset to sequencer
+
+proc ProgSelect {w coord} {
+ global sflist chanpreset chanbank optvar
+ set idx [$w.p.list nearest $coord]
+ if {$idx == ""} {return}
+ set sel [$w.p.list get $idx]
+ set lp [split $sel :]
+ scan [lindex $lp 0] "%d" bank
+ scan [lindex $lp 1] "%d" preset
+ set name [join [string range $lp 8 end]]
+ set chanbank($optvar(channel)) $bank
+ set chanpreset($optvar(channel)) $preset
+ SeqProgram $bank $preset
+ $w.p.label configure -text "Preset:$name"
+}
+
+#----------------------------------------------------------------
+# make a listbox
+
+proc my-listbox {w title width height {dohoriz 0}} {
+ frame $w
+ label $w.label -text $title -relief flat
+ pack $w.label -side top -fill x -anchor w
+ scrollbar $w.yscr -command "$w.list yview"
+ pack $w.yscr -side right -fill y
+ set lopt [list -width $width -height $height]
+ lappend lopt -selectmode single -exportselect 0
+ if {$dohoriz} {
+ scrollbar $w.xscr -command "$w.list xview" -orient horizontal
+ pack $w.xscr -side bottom -fill x
+ eval listbox $w.list -relief sunken -setgrid yes $lopt\
+ [list -yscroll "$w.yscr set"]\
+ [list -xscroll "$w.xscr set"]
+ } else {
+ eval listbox $w.list -relief sunken -setgrid yes $lopt\
+ [list -yscroll "$w.yscr set"]
+ }
+ pack $w.list -side left -fill both -expand yes
+ return $w.list
+}
+
+#----------------------------------------------------------------
+# create windows
+
+# toggle display of preset selection windows
+
+set disp(keyvel) 0
+set disp(ctrl) 0
+set disp(pitch) 0
+set disp(prog) 0
+
+proc ToggleView {w cvar} {
+ global disp
+ if {$disp($cvar)} {
+ pack $w.$cvar -side top -fill x
+ } else {
+ pack forget $w.$cvar
+ }
+}
+
+# toggle sequencer on/off
+
+set seqswitch 0
+proc ToggleSeqOn {w} {
+ global seqswitch
+ if {$seqswitch} {
+ SeqOn
+ } else {
+ SeqOff
+ ResetControls
+ }
+}
+
+
+# create the pulldown menues
+proc MenuCreate {{pw ""}} {
+ global env optvar defconfig defkeymap
+
+ if {$optvar(octave) < 1 || $optvar(octave) > 9} {
+ puts stderr "vkeybd: invalid octave too value $optvar(octave)"
+ set optvar(octave) 3
+ }
+
+ set w $pw.menubar
+ menu $w -tearoff 0
+
+ $w add cascade -menu $w.file -label "File" -underline 0
+ menu $w.file -tearoff 0
+ $w.file add checkbutton -label "Connection"\
+ -command "ToggleSeqOn $w.file.off"\
+ -variable seqswitch -underline 0
+ $w.file add command -label "Save Config" -command "SaveConfig $env(HOME)/.$defconfig" -underline 0
+ $w.file add command -label "Save Keymap" -command "SaveKeymap $env(HOME)/.$defkeymap" -underline 0
+ $w.file add command -label "Quit" -command {exit 0} -underline 0
+
+ $w add cascade -menu $w.view -label "View" -underline 0
+ menu $w.view -tearoff 0
+ $w.view add check -label "Key/Velocity" -variable disp(keyvel)\
+ -command [list ToggleView $pw keyvel]
+ $w.view add check -label "Controls" -variable disp(ctrl)\
+ -command [list ToggleView $pw ctrl]
+ $w.view add check -label "Pitchwheel" -variable disp(pitch)\
+ -command [list ToggleView $pw pitch]
+ $w.view add check -label "Program List" -variable disp(prog)\
+ -command [list ToggleView $pw prog]
+
+ $w add cascade -menu $w.reverb -label "Reverb" -underline 0
+ menu $w.reverb -tearoff 0
+ $w.reverb add radio -label "Room 1"\
+ -variable reverbmode -value 0 -command "SeqReverbMode 0"
+ $w.reverb add radio -label "Room 2"\
+ -variable reverbmode -value 1 -command "SeqReverbMode 1"
+ $w.reverb add radio -label "Room 3"\
+ -variable reverbmode -value 2 -command "SeqReverbMode 2"
+ $w.reverb add radio -label "Hall 1"\
+ -variable reverbmode -value 3 -command "SeqReverbMode 3"
+ $w.reverb add radio -label "Hall 2"\
+ -variable reverbmode -value 4 -command "SeqReverbMode 4"
+ $w.reverb add radio -label "Plate"\
+ -variable reverbmode -value 5 -command "SeqReverbMode 5"
+ $w.reverb add radio -label "Delay"\
+ -variable reverbmode -value 6 -command "SeqReverbMode 6"
+ $w.reverb add radio -label "Panning Delay"\
+ -variable reverbmode -value 7 -command "SeqReverbMode 7"
+
+ $w add cascade -menu $w.chorus -label "Chorus" -underline 0
+ menu $w.chorus -tearoff 0
+ $w.chorus add radio -label "Chorus 1"\
+ -variable chorusmode -value 0 -command "SeqChorusMode 0"
+ $w.chorus add radio -label "Chorus 2"\
+ -variable chorusmode -value 1 -command "SeqChorusMode 1"
+ $w.chorus add radio -label "Chorus 3"\
+ -variable chorusmode -value 2 -command "SeqChorusMode 2"
+ $w.chorus add radio -label "Chorus 4"\
+ -variable chorusmode -value 3 -command "SeqChorusMode 3"
+ $w.chorus add radio -label "Feedback"\
+ -variable chorusmode -value 4 -command "SeqChorusMode 4"
+ $w.chorus add radio -label "Flanger"\
+ -variable chorusmode -value 5 -command "SeqChorusMode 5"
+ $w.chorus add radio -label "Short Delay"\
+ -variable chorusmode -value 6 -command "SeqChorusMode 6"
+ $w.chorus add radio -label "Short Delay 2"\
+ -variable chorusmode -value 7 -command "SeqChorusMode 7"
+
+ global reverbmode chorusmode
+ set reverbmode 4
+ set chorusmode 2
+
+}
+
+# create the virtual keyboard panel
+
+proc PanelCreate {{pw ""}} {
+ global controls curctrl ctrlval optvar
+
+ set w $pw.ctrl
+ frame $w
+
+ frame $w.chan
+ label $w.chan.label -text "Channel"
+ button $w.chan.left -text "<" -command { DecrChannel }
+ label $w.chan.digit -textvariable optvar(channel)
+ button $w.chan.right -text ">" -command { IncrChannel }
+ pack $w.chan.label $w.chan.left $w.chan.digit $w.chan.right -side left -expand 1
+
+ frame $w.c
+ label $w.c.label -text "Control"
+ menubutton $w.c.ctrl -relief raised -width 9 -menu $w.c.ctrl.m
+ menu $w.c.ctrl.m
+ foreach i $controls {
+ set label [lindex $i 0]
+ set type [lindex $i 1]
+ $w.c.ctrl.m add radio -label $label\
+ -variable curctrl -value $type\
+ -command [list NewControl $w.c $i]
+ set ctrlval($type) [lindex $i 2]
+ }
+ $w.c.ctrl.m add separator
+ $w.c.ctrl.m add command -label "Reset" -command {ResetControls 1}
+ scale $w.c.val -orient horizontal -from 0 -to 127 -showvalue true\
+ -command {SeqControl $curctrl}
+ NewControl $w.c [lindex $controls 0]
+ pack $w.c.label $w.c.ctrl $w.c.val -side left -expand 1
+
+ pack $w.chan $w.c -side left -expand 1
+
+ #----------------------------------------------------------------
+
+ set w $pw.keyvel
+ frame $w
+ frame $w.k
+ label $w.k.label -text "Key"
+ scale $w.k.val -orient horizontal\
+ -from 0 -to [expr 120 - ($optvar(octave) * 12)] -resolution 12\
+ -showvalue true -variable keybase
+ pack $w.k.label $w.k.val -side left -expand 1
+
+ frame $w.v
+ label $w.v.label -text "Velocity"
+ scale $w.v.val -orient horizontal\
+ -from 0 -to 127\
+ -showvalue true -variable keyvel
+ pack $w.v.label $w.v.val -side left -expand 1
+
+ pack $w.k $w.v -side left -expand 1
+
+ #----------------------------------------------------------------
+
+ set w $pw.pitch
+ frame $w
+
+ global pitchbend
+ button $w.label -text "Pitch Clear" -command "set pitchbend 0; SeqBender 0"
+ scale $w.pitch -orient horizontal -from -8192 -to 8192 -showvalue 0\
+ -length 256 -variable pitchbend -command SeqBender
+ set pitchbend 0
+
+ pack $w.label $w.pitch -side left -expand 1
+
+ #----------------------------------------------------------------
+
+ set w $pw.prog
+ frame $w
+
+ my-listbox $w.p "Preset:" 28 10
+ my-listbox $w.b "Bank:all" 5 10
+ bind $w.b.list <Button-1> [list BankSelect $w %y]
+ bind $w.p.list <Button-1> [list ProgSelect $w %y]
+ pack $w.b $w.p -side left -expand 1
+
+ MakeLists $w
+
+ $pw. configure -menu $pw.menubar
+
+ ToggleView $pw keyvel
+ ToggleView $pw ctrl
+ ToggleView $pw pitch
+ ToggleView $pw prog
+
+ #----------------------------------------------------------------
+
+ KeybdCreate $pw.kbd
+ pack $pw.kbd -fill x -side bottom -pady 1
+}
+
+
+#----------------------------------------------------------------
+# search default path
+#
+proc SearchDefault {fname} {
+ global env optvar
+ set path "$env(HOME)/$fname"
+ if {[file readable $path]} {
+ return $path
+ }
+ set path "$env(HOME)/.$fname"
+ if {[file readable $path]} {
+ return $path
+ }
+ if {[info exists env(VKEYBD)]} {
+ set path "$env(VKEYBD)/$fname"
+ if {[file readable $path]} {
+ return $path
+ }
+ }
+ set path "$optvar(libpath)/$fname"
+ return $path
+}
+
+#
+# parse command line options
+#
+proc ParseOptions {argc argv} {
+ global optvar
+
+ for {set i 0} {$i <= $argc} {incr i} {
+ set arg [lindex $argv $i]
+ if {! [string match -* $arg]} {break}
+ set arg [string range $arg 2 end]
+ if {[string match *=* $arg]} {
+ set idx [string first = $arg]
+ set val [string range $arg [expr $idx + 1] end]
+ set arg [string range $arg 0 [expr $idx - 1]]
+ if {[info exists optvar($arg)]} {
+ set optvar($arg) $val
+ } else {
+ usage
+ exit 1
+ }
+ } else {
+ if {[info exists optvar($arg)]} {
+ incr i
+ set optvar($arg) [lindex $argv $i]
+ } else {
+ usage
+ exit 1
+ }
+ }
+ }
+}
+
+#
+# load config file
+#
+proc LoadConfig {fname} {
+ if {[file readable $fname]} {
+ source $fname
+ }
+}
+
+#
+# save config file
+#
+proc SaveConfig {fname} {
+ global disp optvar keymap
+ set file [open $fname w]
+ if {$file == ""} {
+ tk_messageBox -icon error -message "can't open file $fname." -type ok
+ return
+ }
+ puts $file "global disp optvar"
+ puts $file "set disp(keyvel) $disp(keyvel)"
+ puts $file "set disp(ctrl) $disp(ctrl)"
+ puts $file "set disp(pitch) $disp(pitch)"
+ puts $file "set disp(prog) $disp(prog)"
+ puts $file "set optvar(octave) $optvar(octave)"
+ close $file
+}
+
+#
+# Save Keymap config file (read by LoadConfig)
+#
+proc SaveKeymap {fname} {
+ global keymap
+ set file [open $fname w]
+ if {$file == ""} {
+ tk_messageBox -icon error -message "can't open file $fname." -type ok
+ return
+ }
+ puts $file "global keymap"
+ puts $file "set keymap {"
+ foreach i $keymap {
+ set key [lindex $i 0]
+ set note [lindex $i 1]
+ puts $file " {$key $note}"
+ }
+ puts $file "}"
+ close $file
+}
+
+#
+# read a non-tcl style keymap file
+#
+proc ReadKeymap {fname} {
+ global keymap
+ if {[file readable $fname]} {
+ set file [open $fname r]
+ if {$file == ""} {
+ puts stderr "can't open file $fname."
+ return
+ }
+ set keymap {}
+ while {1} {
+ set line [string trim [gets $file]]
+ if {$line == ""} {break}
+ lappend keymap [list [lindex $line 0] [lindex $line 1]]
+ }
+ close $file
+ }
+}
+
+#----------------------------------------------------------------
+# main ...
+#
+
+set optvar(devfile) ""
+if {! [info exists optvar(libpath)]} {
+ set optvar(libpath) "/etc"
+}
+
+set optvar(preset) [SearchDefault $defpresetfile]
+set optvar(config) [SearchDefault $defconfig]
+set optvar(keymap) [SearchDefault $defkeymap]
+set optvar(channel) 0
+
+ParseOptions $argc $argv
+
+LoadConfig $optvar(config)
+LoadConfig $optvar(keymap)
+
+# parse again to override optvar's in the config file
+ParseOptions $argc $argv
+
+InitPreset
+MenuCreate
+PanelCreate
+
+wm title . "Virtual Keyboard ver.0.1.17"
+wm iconname . "Virtual Keyboard"
+
+SeqOn preinit
+
+tkwait window .
+exit 0
Added: vkeybd/trunk/vkeybdmap
===================================================================
--- vkeybd/trunk/vkeybdmap 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkeybdmap 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,24 @@
+global keymap
+set keymap {
+ {a 8}
+ {z 9}
+ {s 10}
+ {x 11}
+ {c 12}
+ {f 13}
+ {v 14}
+ {g 15}
+ {b 16}
+ {n 17}
+ {j 18}
+ {m 19}
+ {k 20}
+ {comma 21}
+ {l 22}
+ {period 23}
+ {slash 24}
+ {apostrophe 25}
+ {backslash 26}
+ {grave 27}
+}
+
Added: vkeybd/trunk/vkeybdmap-german
===================================================================
--- vkeybd/trunk/vkeybdmap-german 2004-10-28 10:24:55 UTC (rev 29)
+++ vkeybd/trunk/vkeybdmap-german 2004-10-28 10:28:42 UTC (rev 30)
@@ -0,0 +1,57 @@
+global keymap
+set keymap {
+ {less 19}
+ {a 20}
+ {y 21}
+ {s 22}
+ {x 23}
+ {c 24}
+ {f 25}
+ {v 26}
+ {g 27}
+ {b 28}
+ {n 29}
+ {j 30}
+ {m 31}
+ {k 32}
+ {comma 33}
+ {l 34}
+ {period 35}
+ {minus 36}
+ {adiaeresis 37}
+ {numbersign 38}
+ {q 31}
+ {2 32}
+ {w 33}
+ {3 34}
+ {e 35}
+ {r 36}
+ {5 37}
+ {t 38}
+ {6 39}
+ {z 40}
+ {u 41}
+ {8 42}
+ {i 43}
+ {9 44}
+ {o 45}
+ {0 46}
+ {p 47}
+ {udiaeresis 48}
+ {plus 50}
+ {F1 0}
+ {F2 2}
+ {F3 4}
+ {F4 5}
+ {F5 7}
+ {F6 9}
+ {F7 11}
+ {F8 12}
+ {F9 14}
+ {Page_Up 13}
+ {Page_Down 10}
+ {Home 8}
+ {End 6}
+ {Insert 3}
+ {Delete 1}
+}