diff --git a/src/Makefile.am b/src/Makefile.am index 77f1f36..57254fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,7 @@ adplay_SOURCES = adplay.cc output.cc output.h players.h defines.h EXTRA_adplay_SOURCES = oss.cc oss.h null.h disk.cc disk.h esound.cc esound.h \ qsa.cc qsa.h sdl.cc sdl_driver.h alsa.cc alsa.h ao.cc ao.h getopt.c \ - getopt1.c getopt.h + getopt1.c getopt.h diskraw.h adplay_LDADD = $(drivers) $(adplug_LIBS) @ESD_LIBS@ @QSA_LIBS@ @SDL_LIBS@ \ @ALSA_LIBS@ @AO_LIBS@ $(GETOPT_SOURCES) diff --git a/src/adplay.cc b/src/adplay.cc index ddc23fe..3361529 100644 --- a/src/adplay.cc +++ b/src/adplay.cc @@ -26,6 +26,7 @@ #include #include #include +#include /* * Sun systems declare getopt in unistd.h, @@ -79,6 +80,7 @@ typedef enum { #ifdef HAVE_ADPLUG_NUKEDOPL Emu_Nuked, #endif + Emu_Rawout, } EmuType; /***** Global variables *****/ @@ -184,11 +186,11 @@ static void usage() program_name); // Print list of available output mechanisms - printf("Available emulators: satoh ken woody "); + printf("Available emulators: satoh ken woody"); #ifdef HAVE_ADPLUG_NUKEDOPL - printf("nuked"); + printf(" nuked"); #endif - printf("\n"); + printf(" rawout\n"); printf("Available output mechanisms: " #ifdef DRIVER_OSS "oss " @@ -320,6 +322,11 @@ static int decode_switches(int argc, char **argv) #ifdef HAVE_ADPLUG_NUKEDOPL else if(!strcmp(optarg, "nuked")) cfg.emutype = Emu_Nuked; #endif + else if(!strcmp(optarg, "rawout")) { + cfg.emutype = Emu_Rawout; + cfg.endless = false; // endless output is almost never desired here + } + else { message(MSG_ERROR, "unknown emulator -- %s", optarg); exit(EXIT_FAILURE); @@ -330,6 +337,10 @@ static int decode_switches(int argc, char **argv) } if (!cfg.loops) cfg.loops = 1; + if (cfg.emutype == Emu_Rawout) { + cfg.output = diskraw; // output must be diskraw when Emu_Rawout is selected + } + return optind; } @@ -426,6 +437,7 @@ int main(int argc, char **argv) int optind, i; const char *homedir; char *userdb = NULL; + CDiskopl *dopl = 0; // init program_name = argv[0]; @@ -540,6 +552,9 @@ int main(int argc, char **argv) } break; #endif + case Emu_Rawout: + dopl = new CDiskopl(cfg.device); + opl = dopl; } // init player @@ -590,6 +605,10 @@ int main(int argc, char **argv) cfg.buf_size); break; #endif + case diskraw: + player = new DiskRawWriter(dopl); + dopl = NULL; + break; default: message(MSG_ERROR, "output method not available"); exit(EXIT_FAILURE); diff --git a/src/diskraw.h b/src/diskraw.h new file mode 100644 index 0000000..fe68b86 --- /dev/null +++ b/src/diskraw.h @@ -0,0 +1,45 @@ +/* + * AdPlay/UNIX - OPL2 audio player + * Copyright (C) 2001, 2002 Simon Peter + * + * 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef H_DISKRAW +#define H_DISKRAW + +#include "output.h" + +/* pairs up to AdPlay CDiskopl */ +class DiskRawWriter: public Player +{ +public: + DiskRawWriter(CDiskopl *nopl) + :opl(nopl) + { } + + virtual void frame() { + playing = p->update(); + opl->update(p); + } + + virtual Copl *get_opl() + { return opl; } + +private: + CDiskopl *opl; +}; + +#endif diff --git a/src/players.h b/src/players.h index b94cdb9..29777ae 100644 --- a/src/players.h +++ b/src/players.h @@ -28,7 +28,7 @@ #include "config.h" // Enumerate ALL outputs (regardless of availability) -enum Outputs {none, null, ao, oss, disk, esound, qsa, sdl, alsa}; +enum Outputs {none, null, ao, oss, disk, esound, qsa, sdl, alsa, diskraw}; #define DEFAULT_DRIVER none @@ -88,4 +88,6 @@ enum Outputs {none, null, ao, oss, disk, esound, qsa, sdl, alsa}; #define DEFAULT_DRIVER qsa #endif +#include "diskraw.h" + #endif