aboutsummaryrefslogtreecommitdiff
path: root/audio/stymulator
diff options
context:
space:
mode:
authorEmanuel Haupt <ehaupt@FreeBSD.org>2010-03-27 16:04:59 +0000
committerEmanuel Haupt <ehaupt@FreeBSD.org>2010-03-27 16:04:59 +0000
commit2915713856e30907cbd6b0a5e4f8a119e859c9d9 (patch)
treef7a621ec9aa834c98362c28c9ddd6b3d216f754a /audio/stymulator
parentf083343b438b30784a22042cbe041ba1bf0e49f1 (diff)
downloadports-2915713856e30907cbd6b0a5e4f8a119e859c9d9.tar.gz
ports-2915713856e30907cbd6b0a5e4f8a119e859c9d9.zip
Add stymulator, a command-line Yamaha YM2149 (.ym) chiptune player.
Notes
Notes: svn path=/head/; revision=251581
Diffstat (limited to 'audio/stymulator')
-rw-r--r--audio/stymulator/Makefile28
-rw-r--r--audio/stymulator/distinfo3
-rw-r--r--audio/stymulator/files/patch-Makefile39
-rw-r--r--audio/stymulator/files/patch-sound.cpp109
-rw-r--r--audio/stymulator/files/patch-sound.h21
-rw-r--r--audio/stymulator/files/patch-stsoundlib__Makefile38
-rw-r--r--audio/stymulator/files/patch-stsoundlib__Ymload.cpp233
-rw-r--r--audio/stymulator/files/patch-stsoundlib__lzh__Makefile20
-rw-r--r--audio/stymulator/files/patch-ui.c10
-rw-r--r--audio/stymulator/files/patch-ui.h10
-rw-r--r--audio/stymulator/files/patch-ym2wav.cpp14
-rw-r--r--audio/stymulator/files/patch-ymplayer.cpp104
-rw-r--r--audio/stymulator/pkg-descr5
13 files changed, 634 insertions, 0 deletions
diff --git a/audio/stymulator/Makefile b/audio/stymulator/Makefile
new file mode 100644
index 000000000000..d368c62ec9e1
--- /dev/null
+++ b/audio/stymulator/Makefile
@@ -0,0 +1,28 @@
+# New ports collection makefile for: stymulator
+# Date created: 27 Mar 2010
+# Whom: Emanuel Haupt <ehaupt@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= stymulator
+DISTVERSION= 0.21a
+CATEGORIES= audio
+MASTER_SITES= http://atariarea.krap.pl/stymulator/files/ \
+ CRITICAL
+DISTNAME= STYMulator-${DISTVERSION}
+
+MAINTAINER= ehaupt@FreeBSD.org
+COMMENT= Command-line Yamaha YM2149 (.ym) chiptune player
+
+USE_DOS2UNIX= yes
+
+WRKSRC= ${WRKDIR}/${DISTNAME}/src
+
+PLIST_FILES= bin/ym2wav bin/ymplayer
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/ym2wav ${PREFIX}/bin
+ ${INSTALL_PROGRAM} ${WRKSRC}/ymplayer ${PREFIX}/bin
+
+.include <bsd.port.mk>
diff --git a/audio/stymulator/distinfo b/audio/stymulator/distinfo
new file mode 100644
index 000000000000..f89add377d68
--- /dev/null
+++ b/audio/stymulator/distinfo
@@ -0,0 +1,3 @@
+MD5 (STYMulator-0.21a.tar.gz) = e6ab8164dfac0300bb91a82f6e704841
+SHA256 (STYMulator-0.21a.tar.gz) = df0ea39339620682e76e0d8b6b128d69ccaa82687556aa207c1f6d6826206365
+SIZE (STYMulator-0.21a.tar.gz) = 113278
diff --git a/audio/stymulator/files/patch-Makefile b/audio/stymulator/files/patch-Makefile
new file mode 100644
index 000000000000..a2c1407d1c54
--- /dev/null
+++ b/audio/stymulator/files/patch-Makefile
@@ -0,0 +1,39 @@
+--- ./Makefile.orig 2010-03-27 00:43:54.000000000 +0100
++++ ./Makefile 2010-03-27 00:43:54.000000000 +0100
+@@ -1,6 +1,5 @@
+ RM = rm -f
+-CC = g++
+-CFLAGS = -Wall
++CXX ?= $(CXX)
+
+ LZH = stsoundlib/lzh
+ STLIB = stsoundlib
+@@ -17,22 +16,22 @@
+ done
+
+ ymplayer: ymplayer.o sound.o ui.o
+- $(CC) -o ymplayer $(INCLUDE) ymplayer.o sound.o ui.o -lasound -lym -llzh -lncurses
++ $(CXX) $(CXXFLAGS) -o ymplayer $(INCLUDE) ymplayer.o sound.o ui.o -lym -llzh -lncurses
+
+ ym2wav: ym2wav.o
+- $(CC) -o ym2wav $(INCLUDE) ym2wav.o -lym -llzh
++ $(CXX) $(CXXFLAGS) -o ym2wav $(INCLUDE) ym2wav.o -lym -llzh
+
+ ymplayer.o: ymplayer.cpp $(STLIB)/StSoundLibrary.h ui.h sound.h
+- $(CC) $(INLCUDE) -c ymplayer.cpp
++ $(CXX) $(CXXFLAGS) $(INLCUDE) -c ymplayer.cpp
+
+ ym2wav.o: ym2wav.cpp $(STLIB)/StSoundLibrary.h
+- $(CC) $(INCLUDE) -c ym2wav.cpp
++ $(CXX) $(CXXFLAGS) $(INCLUDE) -c ym2wav.cpp
+
+ sound.o: sound.cpp sound.h
+- $(CC) -c sound.cpp
++ $(CXX) $(CXXFLAGS) -c sound.cpp
+
+ ui.o: ui.c ui.h $(STLIB)/StSoundLibrary.h
+- $(CC) -c ui.c
++ $(CXX) $(CXXFLAGS) -c ui.c
+
+ install: all
+ $(INSTALL) ymplayer /usr/bin
diff --git a/audio/stymulator/files/patch-sound.cpp b/audio/stymulator/files/patch-sound.cpp
new file mode 100644
index 000000000000..0836ced5e7f8
--- /dev/null
+++ b/audio/stymulator/files/patch-sound.cpp
@@ -0,0 +1,109 @@
+--- ./sound.cpp.orig 2010-03-27 16:08:54.000000000 +0100
++++ ./sound.cpp 2010-03-27 16:10:00.000000000 +0100
+@@ -6,7 +6,6 @@
+ Project Page: http://atariarea.krap.pl/stymulator
+
+ Original ST-Sound GPL library by Arnaud Carre (http://leonard.oxg.free.fr)
+- ALSA (Advanced Linux Sound Architecture) library (http://www.alsa-project.org/)
+
+ -----------------------------------------------------------------------------
+ * STYMulator is free software; you can redistribute it and/or modify *
+@@ -25,73 +24,39 @@
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ---------------------------------------------------------------------------*/
+
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <fcntl.h>
+ #include "sound.h"
+
+-snd_pcm_format_t format = SND_PCM_FORMAT_S16;
++int format = AFMT_S16_LE;
+
+ int err, dir;
+ int resample = 1;
+ unsigned int rate = 44100;
+ unsigned int channels = 1;
+-unsigned int buffer_time = 500000;
+ unsigned int period_time = 100000;
+
+-snd_pcm_uframes_t buffer_size; //22050
+-snd_pcm_uframes_t period_size; //4410
++int period_size; //4410
+
+-int alsa_init(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hwparams)
+-{
+- if ((err = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0) {
+- printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err));
+- return err;
+- }
+-/* removed snd_pcm_hw_params_set_rate_resample function that has been added to alsa-lib since 1.0.9rc2 (more portability)
+-
+- if ((err = snd_pcm_hw_params_set_rate_resample(pcm_handle, hwparams, resample)) < 0) {
+- printf("Resampling setup failed for playback: %s\n", snd_strerror(err));
+- return err;
+- }
+-*/
+- if ((err = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
+- printf("Access type not available for playback: %s\n", snd_strerror(err));
+- return err;
+- }
+- if ((err = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format)) < 0) {
+- printf("Sample format not available for playback: %s\n", snd_strerror(err));
+- return err;
+- }
+- if ((err = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, channels)) < 0) {
+- printf("Channels count (%i) not available for playbacks: %s\n", channels, snd_strerror(err));
+- return err;
+- }
+- unsigned int rrate = rate;
+- if ((err = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &rrate, 0)) < 0) {
+- printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
+- return err;
+- }
+- if (rrate != rate) {
+- printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err);
+- return -EINVAL;
+- }
+- if ((err = snd_pcm_hw_params_set_buffer_time_near(pcm_handle, hwparams, &buffer_time, &dir)) < 0) {
+- printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err));
+- return err;
+- }
+- if ((err = snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size)) < 0) {
+- printf("Unable to get buffer size for playback: %s\n", snd_strerror(err));
+- return err;
+- }
+- if ((err = snd_pcm_hw_params_set_period_time_near(pcm_handle, hwparams, &period_time, &dir)) < 0) {
+- printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err));
+- return err;
+- }
+- if ((err = snd_pcm_hw_params_get_period_size(hwparams, &period_size, &dir)) < 0) {
+- printf("Unable to get period size for playback: %s\n", snd_strerror(err));
+- return err;
+- }
+- if ((err = snd_pcm_hw_params(pcm_handle, hwparams)) < 0) {
+- printf("Unable to set hw params for playback: %s\n", snd_strerror(err));
+- return err;
+- }
+- return 0;
++int oss_init(int audio_fd) {
++ period_size = 4096;
++
++ if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format) < 0) {
++ printf("Cannot set sample format\n");
++ return EXIT_FAILURE;
++ }
++
++ if (ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels) < 0) {
++ printf("Cannot set audio channels\n");
++ return EXIT_FAILURE;
++ }
++
++ if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate) < 0) {
++ printf("Cannot set sample rate\n");
++ return EXIT_FAILURE;
++ }
++
++ return EXIT_SUCCESS;
+ }
diff --git a/audio/stymulator/files/patch-sound.h b/audio/stymulator/files/patch-sound.h
new file mode 100644
index 000000000000..91f426bb3919
--- /dev/null
+++ b/audio/stymulator/files/patch-sound.h
@@ -0,0 +1,21 @@
+--- ./sound.h.orig 2010-03-27 16:08:54.000000000 +0100
++++ ./sound.h 2010-03-27 16:10:00.000000000 +0100
+@@ -6,7 +6,6 @@
+ Project Page: http://atariarea.krap.pl/stymulator
+
+ Original ST-Sound GPL library by Arnaud Carre (http://leonard.oxg.free.fr)
+- ALSA (Advanced Linux Sound Architecture) library (http://www.alsa-project.org/)
+
+ -----------------------------------------------------------------------------
+ * STYMulator is free software; you can redistribute it and/or modify *
+@@ -28,8 +27,8 @@
+ #ifndef SOUND_H
+ #define SOUND_H
+
+-#include <alsa/asoundlib.h>
++#include <sys/soundcard.h>
+
+-int alsa_init(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hwparams);
++int oss_init(int);
+
+ #endif
diff --git a/audio/stymulator/files/patch-stsoundlib__Makefile b/audio/stymulator/files/patch-stsoundlib__Makefile
new file mode 100644
index 000000000000..b9fb9e68120b
--- /dev/null
+++ b/audio/stymulator/files/patch-stsoundlib__Makefile
@@ -0,0 +1,38 @@
+--- ./stsoundlib/Makefile.orig 2010-03-27 00:43:54.000000000 +0100
++++ ./stsoundlib/Makefile 2010-03-27 00:43:54.000000000 +0100
+@@ -1,28 +1,28 @@
+-CC = g++
++CXX ?= g++
+ AR = ar cr
+ RM = rm -f
+
+ LIB = digidrum.o Ymload.o Ym2149Ex.o YmMusic.o YmUserInterface.o
+
+-CFLAGS = -Wall
++CFLAGS ?= -Wall
+
+ libym.a: $(LIB)
+ $(AR) libym.a $(LIB)
+
+ digidrum.o: digidrum.cpp YmTypes.h
+- $(CC) -c digidrum.cpp
++ $(CXX) $(CXXFLAGS) -c digidrum.cpp
+
+ Ym2149Ex.o: Ym2149Ex.cpp Ym2149Ex.h YmTypes.h
+- $(CC) -c Ym2149Ex.cpp
++ $(CXX) $(CXXFLAGS) -c Ym2149Ex.cpp
+
+ Ymload.o: Ymload.cpp YmMusic.h lzh/lzh.h
+- $(CC) -c Ymload.cpp
++ $(CXX) $(CXXFLAGS) -c Ymload.cpp
+
+ YmMusic.o: YmMusic.cpp YmMusic.h
+- $(CC) -c YmMusic.cpp
++ $(CXX) $(CXXFLAGS) -c YmMusic.cpp
+
+ YmUserInterface.o: YmUserInterface.cpp StSoundLibrary.h YmMusic.h
+- $(CC) -c YmUserInterface.cpp
++ $(CXX) $(CXXFLAGS) -c YmUserInterface.cpp
+
+ clean:
+ $(RM) *~ *.o *.a
diff --git a/audio/stymulator/files/patch-stsoundlib__Ymload.cpp b/audio/stymulator/files/patch-stsoundlib__Ymload.cpp
new file mode 100644
index 000000000000..c724d024dcf1
--- /dev/null
+++ b/audio/stymulator/files/patch-stsoundlib__Ymload.cpp
@@ -0,0 +1,233 @@
+--- stsoundlib/Ymload.cpp.orig 2010-03-27 16:37:51.000000000 +0100
++++ stsoundlib/Ymload.cpp 2010-03-27 16:40:46.000000000 +0100
+@@ -129,7 +129,7 @@
+ { // Compression LH5, header !=0 : Error.
+ free(pBigMalloc);
+ pBigMalloc = NULL;
+- setLastError("LHARC Header must be 0 !");
++ setLastError(((char *)"LHARC Header must be 0 !"));
+ return NULL;
+ }
+
+@@ -137,7 +137,7 @@
+ pNew = (ymu8*)malloc(fileSize);
+ if (!pNew)
+ {
+- setLastError("MALLOC Failed !");
++ setLastError(((char *)"MALLOC Failed !"));
+ free(pBigMalloc);
+ pBigMalloc = NULL;
+ return NULL;
+@@ -159,7 +159,7 @@
+
+ if (!bRet)
+ { // depacking error
+- setLastError("LH5 Depacking Error !");
++ setLastError(((char *)"LH5 Depacking Error !"));
+ free(pNew);
+ pNew = NULL;
+ }
+@@ -197,7 +197,7 @@
+ tmpBuff = (ymu8*)malloc(nbFrame*streamInc);
+ if (!tmpBuff)
+ {
+- setLastError("Malloc error in deInterleave()\n");
++ setLastError(((char *)"Malloc error in deInterleave()\n"));
+ return YMFALSE;
+ }
+
+@@ -249,11 +249,11 @@
+ streamInc = 14;
+ nbDrum = 0;
+ setAttrib(A_STREAMINTERLEAVED|A_TIMECONTROL);
+- pSongName = mstrdup("Unknown");
+- pSongAuthor = mstrdup("Unknown");
+- pSongComment = mstrdup("Converted by Leonard.");
+- pSongType = mstrdup("YM 2");
+- pSongPlayer = mstrdup("YM-Chip driver.");
++ pSongName = mstrdup(((char *)"Unknown"));
++ pSongAuthor = mstrdup(((char *)"Unknown"));
++ pSongComment = mstrdup(((char *)"Converted by Leonard."));
++ pSongType = mstrdup(((char *)"YM 2"));
++ pSongPlayer = mstrdup(((char *)"YM-Chip driver."));
+ break;
+
+ case 'YM3!': // Standart YM-Atari format.
+@@ -266,11 +266,11 @@
+ streamInc = 14;
+ nbDrum = 0;
+ setAttrib(A_STREAMINTERLEAVED|A_TIMECONTROL);
+- pSongName = mstrdup("Unknown");
+- pSongAuthor = mstrdup("Unknown");
+- pSongComment = mstrdup("");
+- pSongType = mstrdup("YM 3");
+- pSongPlayer = mstrdup("YM-Chip driver.");
++ pSongName = mstrdup(((char *)"Unknown"));
++ pSongAuthor = mstrdup(((char *)"Unknown"));
++ pSongComment = mstrdup(((char *)""));
++ pSongType = mstrdup(((char *)"YM 3"));
++ pSongPlayer = mstrdup(((char *)"YM-Chip driver."));
+ break;
+
+ case 'YM3b': // Standart YM-Atari format + Loop info.
+@@ -284,15 +284,15 @@
+ streamInc = 14;
+ nbDrum = 0;
+ setAttrib(A_STREAMINTERLEAVED|A_TIMECONTROL);
+- pSongName = mstrdup("Unknown");
+- pSongAuthor = mstrdup("Unknown");
+- pSongComment = mstrdup("");
+- pSongType = mstrdup("YM 3b (loop)");
+- pSongPlayer = mstrdup("YM-Chip driver.");
++ pSongName = mstrdup(((char *)"Unknown"));
++ pSongAuthor = mstrdup(((char *)"Unknown"));
++ pSongComment = mstrdup(((char *)""));
++ pSongType = mstrdup(((char *)"YM 3b (loop)"));
++ pSongPlayer = mstrdup(((char *)"YM-Chip driver."));
+ break;
+
+ case 'YM4!': // Extended ATARI format.
+- setLastError("No more YM4! support. Use YM5! format.");
++ setLastError(((char *)"No more YM4! support. Use YM5! format."));
+ return YMFALSE;
+ break;
+
+@@ -300,7 +300,7 @@
+ case 'YM6!': // Extended YM2149 format, all machines.
+ if (strncmp((const char*)(pBigMalloc+4),"LeOnArD!",8))
+ {
+- setLastError("Not a valid YM format !");
++ setLastError(((char *)"Not a valid YM format !"));
+ return YMFALSE;
+ }
+ ptr = pBigMalloc+12;
+@@ -347,23 +347,23 @@
+ if (id=='YM6!')
+ {
+ songType = YM_V6;
+- pSongType = mstrdup("YM 6");
++ pSongType = mstrdup(((char *)"YM 6"));
+ }
+ else
+ {
+- pSongType = mstrdup("YM 5");
++ pSongType = mstrdup(((char *)"YM 5"));
+ }
+ pDataStream = ptr;
+ streamInc = 16;
+ setAttrib(A_STREAMINTERLEAVED|A_TIMECONTROL);
+- pSongPlayer = mstrdup("YM-Chip driver.");
++ pSongPlayer = mstrdup(((char *)"YM-Chip driver."));
+ break;
+
+ case 'MIX1': // ATARI Remix digit format.
+
+ if (strncmp((const char*)(pBigMalloc+4),"LeOnArD!",8))
+ {
+- setLastError("Not a valid YM format !");
++ setLastError(((char *)"Not a valid YM format !"));
+ return YMFALSE;
+ }
+ ptr = pBigMalloc+12;
+@@ -395,8 +395,8 @@
+ }
+
+ mixPos = -1; // numero du block info.
+- pSongType = mstrdup("MIX1");
+- pSongPlayer = mstrdup("Digi-Mix driver.");
++ pSongType = mstrdup(((char *)"MIX1"));
++ pSongPlayer = mstrdup(((char *)"Digi-Mix driver."));
+
+ break;
+
+@@ -420,7 +420,7 @@
+ */
+ if (strncmp((const char*)(pBigMalloc+4),"LeOnArD!",8))
+ {
+- setLastError("Not a valid YM format !");
++ setLastError(((char *)"Not a valid YM format !"));
+ return YMFALSE;
+ }
+ ptr = pBigMalloc+12;
+@@ -469,11 +469,11 @@
+ {
+ ymTrackerFreqShift = (attrib>>28)&15;
+ attrib &= 0x0fffffff;
+- pSongType = mstrdup("YM-T2");
++ pSongType = mstrdup(((char *)"YM-T2"));
+ }
+ else
+ {
+- pSongType = mstrdup("YM-T1");
++ pSongType = mstrdup(((char *)"YM-T1"));
+ }
+
+
+@@ -483,11 +483,11 @@
+ ymTrackerInit(100); // 80% de volume maxi.
+ streamInc = 16;
+ setTimeControl(YMTRUE);
+- pSongPlayer = mstrdup("Universal Tracker");
++ pSongPlayer = mstrdup(((char *)"Universal Tracker"));
+ break;
+
+ default:
+- setLastError("Unknow YM format !");
++ setLastError(((char *)"Unknow YM format !"));
+ return YMFALSE;
+ break;
+ }
+@@ -503,7 +503,7 @@
+
+ ymbool CYmMusic::checkCompilerTypes()
+ {
+- setLastError("Basic types size are not correct (check ymTypes.h)");
++ setLastError(((char *)"Basic types size are not correct (check ymTypes.h)"));
+
+ if (1 != sizeof(ymu8)) return YMFALSE;
+ if (1 != sizeof(yms8)) return YMFALSE;
+@@ -522,7 +522,7 @@
+
+ if (sizeof(ymint) < 4) return YMFALSE; // ymint should be at least 32bits
+
+- setLastError("");
++ setLastError(((char *)""));
+ return YMTRUE;
+ }
+
+@@ -541,7 +541,7 @@
+ in = fopen(fileName,"rb");
+ if (!in)
+ {
+- setLastError("File not Found");
++ setLastError(((char *)"File not Found"));
+ return YMFALSE;
+ }
+
+@@ -552,7 +552,7 @@
+ pBigMalloc = (unsigned char*)malloc(fileSize);
+ if (!pBigMalloc)
+ {
+- setLastError("MALLOC Error");
++ setLastError(((char *)"MALLOC Error"));
+ fclose(in);
+ return YMFALSE;
+ }
+@@ -563,7 +563,7 @@
+ if (fread(pBigMalloc,1,fileSize,in)!=(size_t)fileSize)
+ {
+ free(pBigMalloc);
+- setLastError("File is corrupted.");
++ setLastError(((char *)"File is corrupted."));
+ fclose(in);
+ return YMFALSE;
+ }
+@@ -611,7 +611,7 @@
+ pBigMalloc = (unsigned char*)malloc(fileSize);
+ if (!pBigMalloc)
+ {
+- setLastError("MALLOC Error");
++ setLastError(((char *)"MALLOC Error"));
+ return YMFALSE;
+ }
+
diff --git a/audio/stymulator/files/patch-stsoundlib__lzh__Makefile b/audio/stymulator/files/patch-stsoundlib__lzh__Makefile
new file mode 100644
index 000000000000..813228ef09ae
--- /dev/null
+++ b/audio/stymulator/files/patch-stsoundlib__lzh__Makefile
@@ -0,0 +1,20 @@
+--- ./stsoundlib/lzh/Makefile.orig 2010-03-27 00:44:06.000000000 +0100
++++ ./stsoundlib/lzh/Makefile 2010-03-27 00:44:25.000000000 +0100
+@@ -1,14 +1,14 @@
+-CC = gcc
++CC ?= gcc
+ AR = ar cr
+ RM = rm -f
+
+-CFLAGS = -Wall
++CFLAGS ?= -Wall
+
+ liblzh.a: lzhlib.o
+ $(AR) liblzh.a lzhlib.o
+
+ lzhlib.o: lzhlib.cpp lzh.h
+- $(CC) -c lzhlib.cpp
++ $(CC) $(CFLAGS) -c lzhlib.cpp
+
+ clean:
+ $(RM) *~ *.o *.a
diff --git a/audio/stymulator/files/patch-ui.c b/audio/stymulator/files/patch-ui.c
new file mode 100644
index 000000000000..2b9afb4fca8f
--- /dev/null
+++ b/audio/stymulator/files/patch-ui.c
@@ -0,0 +1,10 @@
+--- ./ui.c.orig 2010-03-27 16:08:54.000000000 +0100
++++ ./ui.c 2010-03-27 16:10:00.000000000 +0100
+@@ -6,7 +6,6 @@
+ Project Page: http://atariarea.krap.pl/stymulator
+
+ Original ST-Sound GPL library by Arnaud Carre (http://leonard.oxg.free.fr)
+- ALSA (Advanced Linux Sound Architecture) library (http://www.alsa-project.org/)
+
+ -----------------------------------------------------------------------------
+ * STYMulator is free software; you can redistribute it and/or modify *
diff --git a/audio/stymulator/files/patch-ui.h b/audio/stymulator/files/patch-ui.h
new file mode 100644
index 000000000000..34fe60c0dd73
--- /dev/null
+++ b/audio/stymulator/files/patch-ui.h
@@ -0,0 +1,10 @@
+--- ./ui.h.orig 2010-03-27 16:08:54.000000000 +0100
++++ ./ui.h 2010-03-27 16:10:00.000000000 +0100
+@@ -6,7 +6,6 @@
+ Project Page: http://atariarea.krap.pl/stymulator
+
+ Original ST-Sound GPL library by Arnaud Carre (http://leonard.oxg.free.fr)
+- ALSA (Advanced Linux Sound Architecture) library (http://www.alsa-project.org/)
+
+ -----------------------------------------------------------------------------
+ * STYMulator is free software; you can redistribute it and/or modify *
diff --git a/audio/stymulator/files/patch-ym2wav.cpp b/audio/stymulator/files/patch-ym2wav.cpp
new file mode 100644
index 000000000000..251978999a41
--- /dev/null
+++ b/audio/stymulator/files/patch-ym2wav.cpp
@@ -0,0 +1,14 @@
+--- ym2wav.cpp.orig 2010-03-27 16:25:32.000000000 +0100
++++ ym2wav.cpp 2010-03-27 16:26:14.000000000 +0100
+@@ -74,9 +74,9 @@
+ char *platform;
+
+ if (PLATFORM)
+- platform = "64bit";
++ platform = ((char *)"64bit");
+ else
+- platform = "32bit";
++ platform = ((char *)"32bit");
+
+ //--------------------------------------------------------------------------
+ // Checks args.
diff --git a/audio/stymulator/files/patch-ymplayer.cpp b/audio/stymulator/files/patch-ymplayer.cpp
new file mode 100644
index 000000000000..eb5ab58372aa
--- /dev/null
+++ b/audio/stymulator/files/patch-ymplayer.cpp
@@ -0,0 +1,104 @@
+--- ./ymplayer.cpp.orig 2010-03-27 16:08:54.000000000 +0100
++++ ./ymplayer.cpp 2010-03-27 16:10:00.000000000 +0100
+@@ -6,7 +6,6 @@
+ Project Page: http://atariarea.krap.pl/stymulator
+
+ Original ST-Sound GPL library by Arnaud Carre (http://leonard.oxg.free.fr)
+- ALSA (Advanced Linux Sound Architecture) library (http://www.alsa-project.org/)
+
+ -----------------------------------------------------------------------------
+ * STYMulator is free software; you can redistribute it and/or modify *
+@@ -35,12 +34,16 @@
+ #include "stsoundlib/StSoundLibrary.h"
+ #include "ui.h"
+ #include "sound.h"
+-#include <alsa/asoundlib.h>
++#include <sys/soundcard.h>
++#include <sys/ioctl.h>
++#include <unistd.h>
++#include <fcntl.h>
++#include <errno.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+
+-extern snd_pcm_uframes_t period_size;
++extern int period_size;
+ bool digi;
+
+ int main(int argc, char **argv)
+@@ -55,7 +58,7 @@
+ bool ff = false;
+ bool rew = false;
+
+-char *platform;
++const char *platform;
+
+ if (PLATFORM)
+ platform = "64bit";
+@@ -69,30 +72,22 @@
+ return -1;
+ }
+
+- snd_pcm_t *pcm_handle;
+- snd_pcm_hw_params_t *hwparams;
+- snd_pcm_hw_params_alloca(&hwparams);
++ int audio_fd;
+
+ int err;
+ unsigned int buf;
+
+- snd_output_t *output = NULL;
+- char pcm_name[] = "default";
++ char pcm_name[] = "/dev/dsp";
+
+ YMMUSIC *pMusic = ymMusicCreate();
+
+ if (ymMusicLoad(pMusic,argv[1])) {
+-
+- if ((err = snd_output_stdio_attach(&output, stdout, 0)) < 0) {
+- printf("Output failed: %s\n", snd_strerror(err));
+- return 0;
+- }
+- if ((err = snd_pcm_open(&pcm_handle, pcm_name, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
+- printf("Playback open error: %s\n", snd_strerror(err));
++ if ((audio_fd = open(pcm_name, O_WRONLY)) < 0) {
++ printf("device open error: %s\n", strerror(errno));
+ return 0;
+ }
+- if ((err = alsa_init(pcm_handle, hwparams)) < 0) {
+- printf("Setting of hwparams failed: %s\n", snd_strerror(err));
++ if (oss_init(audio_fd) < 0) {
++ printf("Setting of hwparams failed: %s\n", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+@@ -113,15 +108,10 @@
+ if (digi)
+ draw_time(ymMusicGetPos(pMusic) / 1000);
+
+- if ((err = snd_pcm_writei(pcm_handle, convertBuffer, buf)) == -EPIPE) {
+- err = snd_pcm_prepare(pcm_handle);
+- } else if (err == -ESTRPIPE) {
+- while ((err = snd_pcm_resume(pcm_handle)) == -EAGAIN)
+- sleep(1);
+- if (err < 0) {
+- err = snd_pcm_prepare(pcm_handle);
+- }
+- }
++ if (write(audio_fd, convertBuffer, buf*2) < 0) {
++ perror("audio device not ready for data");
++ }
++
+ switch(getch()) {
+ case 27: case 'q': quit = true; break;
+ case 'z': pmode = true; break; //play
+@@ -179,7 +169,7 @@
+ }
+
+ ymMusicStop(pMusic);
+- snd_pcm_close(pcm_handle);
++ close(audio_fd);
+ delete convertBuffer;
+ ui_end();
+
diff --git a/audio/stymulator/pkg-descr b/audio/stymulator/pkg-descr
new file mode 100644
index 000000000000..65a3b89caf61
--- /dev/null
+++ b/audio/stymulator/pkg-descr
@@ -0,0 +1,5 @@
+STYMulator is an Open Source player which plays music files in the YM chiptune
+format. In particular the YM files are Yamaha YM2149 soundchip music data
+registers dumped from the ATARI 16-bit computers.
+
+WWW: http://atariarea.krap.pl/stymulator/