shithub: pt2-clone

Download patch

ref: 8d7fffec39837b4221a9ed1cbbff032756f7f3a6
parent: bbb4d415885680a85ddef6dc66238af7a13639d6
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Aug 15 22:11:28 EDT 2023

port to Plan 9 using npe

--- /dev/null
+++ b/mkfile
@@ -1,0 +1,139 @@
+</$objtype/mkfile
+
+BIN=/$objtype/bin/audio
+TARG=pt2
+CFLAGS=$CFLAGS -p -D__plan9__ -I/sys/include/npe -I/sys/src/cmd/audio/libFLAC
+
+OFILES=\
+	src/pt2_askbox.$O\
+	src/pt2_audio.$O\
+	src/pt2_blep.$O\
+	src/pt2_bmp.$O\
+	src/pt2_chordmaker.$O\
+	src/pt2_config.$O\
+	src/pt2_diskop.$O\
+	src/pt2_downsample2x.$O\
+	src/pt2_edit.$O\
+	src/pt2_helpers.$O\
+	src/pt2_hpc.$O\
+	src/pt2_keyboard.$O\
+	src/pt2_main.$O\
+	src/pt2_math.$O\
+	src/pt2_mod2wav.$O\
+	src/pt2_module_loader.$O\
+	src/pt2_module_saver.$O\
+	src/pt2_mouse.$O\
+	src/pt2_palette.$O\
+	src/pt2_pat2smp.$O\
+	src/pt2_pattern_viewer.$O\
+	src/pt2_paula.$O\
+	src/pt2_posed.$O\
+	src/pt2_rcfilters.$O\
+	src/pt2_replayer.$O\
+	src/pt2_sample_loader.$O\
+	src/pt2_sample_saver.$O\
+	src/pt2_sampler.$O\
+	src/pt2_sampling.$O\
+	src/pt2_scopes.$O\
+	src/pt2_structs.$O\
+	src/pt2_tables.$O\
+	src/pt2_textedit.$O\
+	src/pt2_textout.$O\
+	src/pt2_unicode.$O\
+	src/pt2_visuals.$O\
+	src/pt2_visuals_sync.$O\
+	src/gfx/pt2_gfx_aboutscreen.$O\
+	src/gfx/pt2_gfx_diskop.$O\
+	src/gfx/pt2_gfx_editop.$O\
+	src/gfx/pt2_gfx_font.$O\
+	src/gfx/pt2_gfx_icon.$O\
+	src/gfx/pt2_gfx_loop_pins.$O\
+	src/gfx/pt2_gfx_mute_buttons.$O\
+	src/gfx/pt2_gfx_patcursor.$O\
+	src/gfx/pt2_gfx_pointer.$O\
+	src/gfx/pt2_gfx_posed.$O\
+	src/gfx/pt2_gfx_sampler.$O\
+	src/gfx/pt2_gfx_spectrum.$O\
+	src/gfx/pt2_gfx_tracker.$O\
+	src/gfx/pt2_gfx_vumeter.$O\
+	src/modloaders/pt2_load_mod15.$O\
+	src/modloaders/pt2_load_mod31.$O\
+	src/modloaders/pt2_pp_unpack.$O\
+	src/modloaders/pt2_xpk_unpack.$O\
+	src/smploaders/pt2_load_aiff.$O\
+	src/smploaders/pt2_load_flac.$O\
+	src/smploaders/pt2_load_iff.$O\
+	src/smploaders/pt2_load_raw.$O\
+	src/smploaders/pt2_load_wav.$O\
+
+HFILES=\
+	src/pt2_askbox.h\
+	src/pt2_audio.h\
+	src/pt2_blep.h\
+	src/pt2_bmp.h\
+	src/pt2_chordmaker.h\
+	src/pt2_config.h\
+	src/pt2_diskop.h\
+	src/pt2_downsample2x.h\
+	src/pt2_edit.h\
+	src/pt2_header.h\
+	src/pt2_helpers.h\
+	src/pt2_hpc.h\
+	src/pt2_keyboard.h\
+	src/pt2_math.h\
+	src/pt2_mod2wav.h\
+	src/pt2_module_loader.h\
+	src/pt2_module_saver.h\
+	src/pt2_mouse.h\
+	src/pt2_palette.h\
+	src/pt2_pat2smp.h\
+	src/pt2_pattern_viewer.h\
+	src/pt2_paula.h\
+	src/pt2_posed.h\
+	src/pt2_rcfilters.h\
+	src/pt2_replayer.h\
+	src/pt2_sample_loader.h\
+	src/pt2_sample_saver.h\
+	src/pt2_sampler.h\
+	src/pt2_sampling.h\
+	src/pt2_scopes.h\
+	src/pt2_structs.h\
+	src/pt2_tables.h\
+	src/pt2_textedit.h\
+	src/pt2_textout.h\
+	src/pt2_unicode.h\
+	src/pt2_visuals.h\
+	src/pt2_visuals_sync.h\
+	src/modloaders/pt2_load_mod15.h\
+	src/modloaders/pt2_load_mod31.h\
+	src/modloaders/pt2_pp_unpack.h\
+	src/modloaders/pt2_xpk_unpack.h\
+
+default:V: all
+
+/sys/include/npe/stdio.h:
+	hget https://git.sr.ht/~ft/npe/archive/master.tar.gz | tar xz &&
+	cd npe-master &&
+	mk install &&
+	rm -r npe-master
+
+(.*)\.$O:R: \1.c
+	$CC $CFLAGS -Isrc -o $target $stem1.c
+
+$TARG: $OFILES
+	$LD $LDFLAGS -o $target $prereq
+
+all:V: $TARG
+
+nuke:V: clean
+
+clean:V:
+	rm -f $TARG $OFILES
+
+%.clean:V:
+	rm -f $stem.[$OS] [$OS].$stem $stem
+
+install:V: all
+	cp $TARG $BIN/
+
+#LDFLAGS=-p
--- a/src/modloaders/pt2_pp_unpack.c
+++ b/src/modloaders/pt2_pp_unpack.c
@@ -149,4 +149,4 @@
 	*filesize = ppUnpackLen;
 
 	return outBuffer;
-}
\ No newline at end of file
+}
--- a/src/pt2_config.c
+++ b/src/pt2_config.c
@@ -45,7 +45,7 @@
 	config.pattDots = false;
 	config.waveformCenterLine = true;
 	config.amigaModel = MODEL_A1200;
-	config.soundFrequency = 48000;
+	config.soundFrequency = 44100;
 	config.rememberPlayMode = false;
 	config.stereoSeparation = 20;
 	config.autoFitVideoScale = true;
--- a/src/pt2_diskop.h
+++ b/src/pt2_diskop.h
@@ -32,4 +32,4 @@
 bool changePathToHome(void);
 #endif
 void renderDiskOpScreen(void);
-void updateDiskOp(void);
\ No newline at end of file
+void updateDiskOp(void);
--- a/src/pt2_sampler.c
+++ b/src/pt2_sampler.c
@@ -7,6 +7,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdbool.h>
+#include <math.h>
 #include "pt2_helpers.h"
 #include "pt2_textout.h"
 #include "pt2_audio.h"
--- a/src/smploaders/pt2_load_aiff.c
+++ b/src/smploaders/pt2_load_aiff.c
@@ -423,4 +423,4 @@
 	s->loopLength = 2;
 
 	return true;
-}
\ No newline at end of file
+}
--- a/src/smploaders/pt2_load_flac.c
+++ b/src/smploaders/pt2_load_flac.c
@@ -522,7 +522,7 @@
 
 #else
 
-bool loadFLACSample(FILE *f, int32_t filesize, moduleSample_t *s)
+bool loadFLACSample(FILE *f, uint32_t filesize, moduleSample_t *s)
 {
 	displayErrorMsg("NO FLAC SUPPORT !");
 	return false;
--- a/src/smploaders/pt2_load_iff.c
+++ b/src/smploaders/pt2_load_iff.c
@@ -259,4 +259,4 @@
 	}
 
 	return true;
-}
\ No newline at end of file
+}
--- a/src/smploaders/pt2_load_raw.c
+++ b/src/smploaders/pt2_load_raw.c
@@ -31,4 +31,4 @@
 	s->loopLength = 2;
 
 	return true;
-}
\ No newline at end of file
+}