From ad7400c78c2e74d2bfc40d2b5f4e7bf79de40d5d Mon Sep 17 00:00:00 2001 From: B. Watson Date: Thu, 17 Aug 2023 16:43:36 -0400 Subject: audio/asap: Updated for version 5.3.0. Signed-off-by: B. Watson Signed-off-by: Willy Sudiarto Raharjo --- audio/asap/README | 2 +- audio/asap/asap.SlackBuild | 17 ++++- audio/asap/asap.info | 8 +-- audio/asap/man/asap-mplayer.1 | 4 +- audio/asap/man/asap-mplayer.rst | 3 +- audio/asap/man/asap-sdl.1 | 10 ++- audio/asap/man/asap-sdl.rst | 7 +- audio/asap/man/asapconv.1 | 6 +- audio/asap/man/asapconv.rst | 3 +- audio/asap/man/sap2ntsc.1 | 6 +- audio/asap/man/sap2ntsc.rst | 3 +- audio/asap/man/sap2txt.1 | 6 +- audio/asap/man/sap2txt.rst | 3 +- audio/asap/sap2ntsc.c | 153 ++++++++++++++++++++++++++++++++++++++++ 14 files changed, 190 insertions(+), 41 deletions(-) create mode 100644 audio/asap/sap2ntsc.c (limited to 'audio/asap') diff --git a/audio/asap/README b/audio/asap/README index 9a21fba9ab..d8312d9893 100644 --- a/audio/asap/README +++ b/audio/asap/README @@ -20,7 +20,7 @@ The package includes: - sap2ntsc, converts PAL SAP files to NTSC timing. - sap2txt, converts SAP file headers to/from a text dump format. - chksap.pl, shows info on and checks for errors in SAP files. -- Man pages for asapconv, asap-sdl, sap2ntsc, sap2txt, and chksap.pl. +- Man pages for all the commands listed above. *Not* included are the asapscan tool, nor the bindings for Java, C#, JavaScript, OpenCL, Python, or Swift. diff --git a/audio/asap/asap.SlackBuild b/audio/asap/asap.SlackBuild index d5726d14a8..c369e4b9f9 100644 --- a/audio/asap/asap.SlackBuild +++ b/audio/asap/asap.SlackBuild @@ -6,6 +6,16 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. +# 20230817 bkw: update for v5.3.0. +# - sap2ntsc.c got removed from upstream's archive. include it with +# this build, as I still have a use for it (and it still works). +# If you're wondering: I own half a dozen Atari 8-bit computers, +# but they're all NTSC (PAL ones are hard to come by in the US). If +# I want to listen to SAP music on the Atari, I have to convert it +# to NTSC, or else it plays too fast. +# - test against latest xmm2 and vlc in SBo repo. +# - minor update to man pages. + # Notes: # This SlackBuild turned out to be a lot more elaborate and in-depth @@ -24,13 +34,13 @@ # Any time vlc or xmms2 updates, this build has to be tested against # the new version. Currently it's known to work with: -# xmms2-20170827_dedc33d -# vlc-3.0.17.3 +# xmms2-0.9.3 +# vlc-3.0.18 cd $(dirname $0) ; CWD=$(pwd) PRGNAM=asap -VERSION=${VERSION:-5.2.0} +VERSION=${VERSION:-5.3.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -144,6 +154,7 @@ installbin asap-sdl $PKGBIN # This builds and seems useful, especially since most SAP files have # PAL timing and I live in an NTSC country: +cat $CWD/sap2ntsc.c > sap2ntsc.c gcc $SLKCFLAGS -o sap2ntsc sap2ntsc.c installbin sap2ntsc $PKGBIN diff --git a/audio/asap/asap.info b/audio/asap/asap.info index 3063154d4e..a942791681 100644 --- a/audio/asap/asap.info +++ b/audio/asap/asap.info @@ -1,10 +1,10 @@ PRGNAM="asap" -VERSION="5.2.0" +VERSION="5.3.0" HOMEPAGE="https://asap.sourceforge.net/" -DOWNLOAD="https://downloads.sourceforge.net/project/asap/asap/5.2.0/asap-5.2.0.tar.gz \ - http://asap.sourceforge.net/examples.zip \ +DOWNLOAD="https://downloads.sourceforge.net/project/asap/asap/5.3.0/asap-5.3.0.tar.gz \ + https://asap.sourceforge.net/examples.zip \ https://ftp.daper.net/pub/soft/moc/stable/moc-2.5.2.tar.bz2" -MD5SUM="cf6e638da630c63a76c02da1261c56b1 \ +MD5SUM="499dd506e4680652faf35c935d0a038e \ 765155ed26c45585391b3a48147c15a2 \ 48e5abcd5ffc76921d4feea8a1fc2dbb" DOWNLOAD_x86_64="" diff --git a/audio/asap/man/asap-mplayer.1 b/audio/asap/man/asap-mplayer.1 index ce15271963..b128471cd3 100644 --- a/audio/asap/man/asap-mplayer.1 +++ b/audio/asap/man/asap-mplayer.1 @@ -27,15 +27,13 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "ASAP-MPLAYER" 1 "2022-12-25" "5.2.0" "SlackBuilds.org" +.TH "ASAP-MPLAYER" 1 "2023-08-17" "5.3.0" "SlackBuilds.org" .SH NAME asap-mplayer \- command-line player for Atari chiptunes and mplayer .\" RST source for asap-mplayer(1) man page. Convert with: . .\" rst2man.py asap-mplayer.rst > asap-sdl.1 . -.\" rst2man.py comes from the SBo development/docutils package. -. .SH SYNOPSIS .sp \fBasap\-mplayer\fP [\fIasapconv\-options\fP] \fBinputfile\fP diff --git a/audio/asap/man/asap-mplayer.rst b/audio/asap/man/asap-mplayer.rst index 110a11510a..2477dce339 100644 --- a/audio/asap/man/asap-mplayer.rst +++ b/audio/asap/man/asap-mplayer.rst @@ -1,8 +1,7 @@ .. RST source for asap-mplayer(1) man page. Convert with: .. rst2man.py asap-mplayer.rst > asap-sdl.1 -.. rst2man.py comes from the SBo development/docutils package. -.. |version| replace:: 5.2.0 +.. |version| replace:: 5.3.0 .. |date| date:: ============ diff --git a/audio/asap/man/asap-sdl.1 b/audio/asap/man/asap-sdl.1 index d49fcffec8..54584e5025 100644 --- a/audio/asap/man/asap-sdl.1 +++ b/audio/asap/man/asap-sdl.1 @@ -27,15 +27,13 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "ASAP-SDL" 1 "2022-12-25" "5.2.0" "SlackBuilds.org" +.TH "ASAP-SDL" 1 "2023-08-17" "5.3.0" "SlackBuilds.org" .SH NAME asap-sdl \- simple command-line player for Atari chiptunes .\" RST source for asap-sdl(1) man page. Convert with: . .\" rst2man.py asap-sdl.rst > asap-sdl.1 . -.\" rst2man.py comes from the SBo development/docutils package. -. .SH SYNOPSIS .sp \fBasap\-sdl\fP [\fI\-s song\fP] \fBinputfile\fP @@ -48,8 +46,8 @@ The supported input formats are: SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2 or FC. .sp During playback, you can press Enter to exit. In fact, the player -doesn\(aqt exit at the end of the file (nor does it loop), so you \fIhave\fP -to press Enter after the song is over. +doesn\(aqt exit at the end of the file (nor does it loop, unless the song +does), so you \fIhave\fP to press Enter after the song is over. .sp There are no other controls during playback (no way to e.g. seek forwards or backwards). @@ -69,7 +67,7 @@ the only subsong in a file that contains only one song. Use .UNINDENT .SH COPYRIGHT .sp -See the file /usr/doc/asap\-5.2.0/COPYING for license information. +See the file /usr/doc/asap\-5.3.0/COPYING for license information. .SH AUTHORS .sp The ASAP suite was written by Piotr Fusik, with contributions from many diff --git a/audio/asap/man/asap-sdl.rst b/audio/asap/man/asap-sdl.rst index 3fab78d07b..5cbcf2e3aa 100644 --- a/audio/asap/man/asap-sdl.rst +++ b/audio/asap/man/asap-sdl.rst @@ -1,8 +1,7 @@ .. RST source for asap-sdl(1) man page. Convert with: .. rst2man.py asap-sdl.rst > asap-sdl.1 -.. rst2man.py comes from the SBo development/docutils package. -.. |version| replace:: 5.2.0 +.. |version| replace:: 5.3.0 .. |date| date:: ======== @@ -33,8 +32,8 @@ The supported input formats are: SAP, CMC, CM3, CMR, CMS, DMC, DLT, MPT, MPD, RMT, TMC, TM8, TM2 or FC. During playback, you can press Enter to exit. In fact, the player -doesn't exit at the end of the file (nor does it loop), so you *have* -to press Enter after the song is over. +doesn't exit at the end of the file (nor does it loop, unless the song +does), so you *have* to press Enter after the song is over. There are no other controls during playback (no way to e.g. seek forwards or backwards). diff --git a/audio/asap/man/asapconv.1 b/audio/asap/man/asapconv.1 index 13463e7d5e..34e5e92892 100644 --- a/audio/asap/man/asapconv.1 +++ b/audio/asap/man/asapconv.1 @@ -27,15 +27,13 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "ASAPCONV" 1 "2022-12-25" "5.2.0" "SlackBuilds.org" +.TH "ASAPCONV" 1 "2023-08-17" "5.3.0" "SlackBuilds.org" .SH NAME asapconv \- convert Atari 8-bit chiptunes to .wav or .xex files .\" RST source for asapconv(1) man page. Convert with: . .\" rst2man.py asapconv.rst > asapconv.1 . -.\" rst2man.py comes from the SBo development/docutils package. -. .SH SYNOPSIS .sp \fBasapconv\fP [\fI\-options\fP] \fBinputfile\fP [\fI\&...\fP] @@ -130,7 +128,7 @@ or to the same format as the input file. . .SH COPYRIGHT .sp -See the file /usr/doc/asap\-5.2.0/COPYING for license information. +See the file /usr/doc/asap\-5.3.0/COPYING for license information. .SH AUTHORS .sp The ASAP suite was written by Piotr Fusik, with contributions from many diff --git a/audio/asap/man/asapconv.rst b/audio/asap/man/asapconv.rst index d20f0fbd86..84057b24ac 100644 --- a/audio/asap/man/asapconv.rst +++ b/audio/asap/man/asapconv.rst @@ -1,8 +1,7 @@ .. RST source for asapconv(1) man page. Convert with: .. rst2man.py asapconv.rst > asapconv.1 -.. rst2man.py comes from the SBo development/docutils package. -.. |version| replace:: 5.2.0 +.. |version| replace:: 5.3.0 .. |date| date:: ======== diff --git a/audio/asap/man/sap2ntsc.1 b/audio/asap/man/sap2ntsc.1 index 62bd7e1704..e76e4b7fcf 100644 --- a/audio/asap/man/sap2ntsc.1 +++ b/audio/asap/man/sap2ntsc.1 @@ -27,15 +27,13 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SAP2NTSC" 1 "2022-12-25" "5.2.0" "SlackBuilds.org" +.TH "SAP2NTSC" 1 "2023-08-17" "5.3.0" "SlackBuilds.org" .SH NAME sap2ntsc \- convert SAP Atari 8-bit chiptune files to NTSC timing .\" RST source for sap2ntsc(1) man page. Convert with: . .\" rst2man.py sap2ntsc.rst > sap2ntsc.1 . -.\" rst2man.py comes from the SBo development/docutils package. -. .SH SYNOPSIS .sp \fBsap2ntsc\fP \fBinputfile\fP [\fI\&...\fP] @@ -62,7 +60,7 @@ Show version number. .UNINDENT .SH COPYRIGHT .sp -See the file /usr/doc/asap\-5.2.0/COPYING for license information. +See the file /usr/doc/asap\-5.3.0/COPYING for license information. .SH AUTHORS .sp The ASAP suite was written by Piotr Fusik, with contributions from many diff --git a/audio/asap/man/sap2ntsc.rst b/audio/asap/man/sap2ntsc.rst index 315b79ad8c..34cc4a10d4 100644 --- a/audio/asap/man/sap2ntsc.rst +++ b/audio/asap/man/sap2ntsc.rst @@ -1,8 +1,7 @@ .. RST source for sap2ntsc(1) man page. Convert with: .. rst2man.py sap2ntsc.rst > sap2ntsc.1 -.. rst2man.py comes from the SBo development/docutils package. -.. |version| replace:: 5.2.0 +.. |version| replace:: 5.3.0 .. |date| date:: ======== diff --git a/audio/asap/man/sap2txt.1 b/audio/asap/man/sap2txt.1 index 91bb907580..ca191ed2cb 100644 --- a/audio/asap/man/sap2txt.1 +++ b/audio/asap/man/sap2txt.1 @@ -27,15 +27,13 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SAP2TXT" 1 "2022-12-25" "5.2.0" "SlackBuilds.org" +.TH "SAP2TXT" 1 "2023-08-17" "5.3.0" "SlackBuilds.org" .SH NAME sap2txt \- dump or modify the header of a SAP Atari 8-bit chiptune file .\" RST source for sap2txt(1) man page. Convert with: . .\" rst2man.py sap2txt.rst > sap2txt.1 . -.\" rst2man.py comes from the SBo development/docutils package. -. .SH SYNOPSIS .sp \fBsap2txt\fP \fBSAP\-file\fP [ > \fBtext\-file\fP ] @@ -119,7 +117,7 @@ redistribute modified versions of SAP files without the original author\(aqs permission. .SH COPYRIGHT .sp -See the file /usr/doc/asap\-5.2.0/COPYING for license information. +See the file /usr/doc/asap\-5.3.0/COPYING for license information. .SH AUTHORS .sp The ASAP suite was written by Piotr Fusik, with contributions from many diff --git a/audio/asap/man/sap2txt.rst b/audio/asap/man/sap2txt.rst index 3b4679b52c..4b21a2723a 100644 --- a/audio/asap/man/sap2txt.rst +++ b/audio/asap/man/sap2txt.rst @@ -1,8 +1,7 @@ .. RST source for sap2txt(1) man page. Convert with: .. rst2man.py sap2txt.rst > sap2txt.1 -.. rst2man.py comes from the SBo development/docutils package. -.. |version| replace:: 5.2.0 +.. |version| replace:: 5.3.0 .. |date| date:: ======= diff --git a/audio/asap/sap2ntsc.c b/audio/asap/sap2ntsc.c new file mode 100644 index 0000000000..a1ca5340d7 --- /dev/null +++ b/audio/asap/sap2ntsc.c @@ -0,0 +1,153 @@ +/* + * sap2ntsc.c - convert PAL SAP files to NTSC + * + * Copyright (C) 2012-2019 Piotr Fusik + * + * This file is part of ASAP (Another Slight Atari Player), + * see http://asap.sourceforge.net + * + * ASAP 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. + * + * ASAP 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 ASAP; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include + +/* public API doesn't allow us to set NTSC or FASTPLAY */ +#include "asap.c" + +static void fatal_error(const char *format, ...) +{ + va_list args; + va_start(args, format); + fprintf(stderr, "sap2ntsc: "); + vfprintf(stderr, format, args); + fputc('\n', stderr); + va_end(args); + exit(1); +} + +static void process_file(const char *filename) +{ + /* check filename */ + const char *ext = strrchr(filename, '.'); + if (ext == NULL || strcasecmp(ext, ".sap") != 0) + fatal_error("%s: filename must be *.sap", filename); + + /* read file */ + FILE *fp = fopen(filename, "rb"); + if (fp == NULL) + fatal_error("cannot open %s", filename); + static unsigned char module[ASAPInfo_MAX_MODULE_LENGTH]; + int module_len = fread(module, 1, sizeof(module), fp); + fclose(fp); + + /* parse file */ + ASAPInfo *info = ASAPInfo_New(); + if (info == NULL) + fatal_error("out of memory"); + if (!ASAPInfo_Load(info, filename, module, module_len)) + fatal_error("%s: unsupported file", filename); + + /* check if conversion possible */ + if (ASAPInfo_IsNtsc(info)) + fatal_error("%s: is already NTSC", filename); + if (ASAPInfo_GetPlayerRateScanlines(info) != 312) + fatal_error("%s: uses FASTPLAY", filename); + + /* do the conversion */ + ASAPWriter *writer = ASAPWriter_New(); + if (writer == NULL) + fatal_error("out of memory"); + info->ntsc = true; + info->fastplay = 262; + for (int i = 0; i < ASAPInfo_GetSongs(info); i++) { + int duration = ASAPInfo_GetDuration(info, i); + if (duration > 0) + ASAPInfo_SetDuration(info, i, (int) (duration * (1773447 / 1789772.5 * 262 / 312))); + } + static unsigned char output[ASAPInfo_MAX_MODULE_LENGTH]; + ASAPWriter_SetOutput(writer, output, 0, sizeof(output)); + int output_len = ASAPWriter_Write(writer, filename, info, module, module_len, true); + ASAPWriter_Delete(writer); + if (output_len < 0) + fatal_error("%s: conversion error", filename); + + /* write file */ + fp = fopen(filename, "wb"); + if (fp == NULL) + fatal_error("cannot write %s", filename); + if (fwrite(output, output_len, 1, fp) != 1) { + fclose(fp); + remove(filename); /* "unlink" is less portable */ + fatal_error("%s: write error", filename); + } + fclose(fp); + + /* print summary */ + printf("%s: ", filename); + int warnings = 0; + + /* issue a warning for samples - they may break on NTSC */ + /* TYPE S has FASTPLAY!=312, so it has been rejected earlier */ + if (ASAPInfo_GetTypeLetter(info) == 'D') { + printf("WARNING: TYPE D"); + warnings++; + } + + /* issue a warning if the 6502 code possibly reads the PAL/NTSC flag of GTIA + (LDA/LDX/LDY $D014, e.g. Ghostbusters.sap). + This is just a guess - false positives are possible and other code may be used for NTSC detection. */ + for (int i = 0; i < module_len - 2; i++) { + if (module[i] >= 0xac && module[i] <= 0xae && module[i + 1] == 0x14 && module[i + 2] == 0xd0) { + if (warnings++ > 0) + printf(", "); + printf("WARNING: possible PAL/NTSC detection code"); + break; + } + } + + ASAPInfo_Delete(info); + if (warnings == 0) + printf("ok"); + printf("\n"); +} + +int main(int argc, char **argv) +{ + bool usage = true; + for (int i = 1; i < argc; i++) { + const char *arg = argv[i]; + if (strcmp(arg, "--help") == 0) { + usage = true; + break; + } + if (strcmp(arg, "--version") == 0) { + printf("sap2ntsc " ASAPInfo_VERSION "\n"); + return 0; + } + process_file(arg); + usage = false; + } + if (usage) { + printf( + "Usage: sap2ntsc FILE.sap...\n" + "Replaces FILE.sap with an NTSC version\n" + ); + } + return 0; +} -- cgit v1.2.3