diff options
Diffstat (limited to 'plugins/ao')
-rw-r--r-- | plugins/ao/Makefile | 32 | ||||
-rw-r--r-- | plugins/ao/Makefile.am | 27 | ||||
-rw-r--r-- | plugins/ao/eng_ssf/m68kcpu.c | 2 | ||||
-rw-r--r-- | plugins/ao/plugin.c | 97 |
4 files changed, 95 insertions, 63 deletions
diff --git a/plugins/ao/Makefile b/plugins/ao/Makefile new file mode 100644 index 00000000..5e0b3f3f --- /dev/null +++ b/plugins/ao/Makefile @@ -0,0 +1,32 @@ +OUT=ao.so + +CC=gcc + +ZLIB_LIBS=-lz + +CFLAGS?=-O2 -fomit-frame-pointer +CFLAGS+=-Wall -fPIC -DPATH_MAX=1024 -DHAS_PSXCPU=1 -I../.. -I./ -Ieng_ssf -Ieng_qsf -Ieng_dsf + +LDFLAGS+=-module -shared $(ZLIB_LIBS) -lm + +SOURCES=plugin.c main.c corlett.c\ +eng_dsf/eng_dsf.c eng_dsf/dc_hw.c eng_dsf/aica.c eng_dsf/aicadsp.c eng_dsf/arm7.c eng_dsf/arm7i.c\ +eng_ssf/m68kcpu.c eng_ssf/m68kopac.c eng_ssf/m68kopdm.c eng_ssf/m68kopnz.c eng_ssf/m68kops.c \ +eng_ssf/scsp.c eng_ssf/scspdsp.c eng_ssf/sat_hw.c eng_ssf/eng_ssf.c\ +eng_qsf/eng_qsf.c eng_qsf/kabuki.c eng_qsf/qsound.c eng_qsf/z80.c eng_qsf/z80dasm.c\ +eng_psf/eng_psf.c eng_psf/psx.c eng_psf/psx_hw.c eng_psf/peops/spu.c \ +eng_psf/eng_psf2.c eng_psf/peops2/spu2.c eng_psf/peops2/dma2.c eng_psf/peops2/registers2.c\ +eng_psf/eng_spu.c + +OBJECTS=$(SOURCES:.c=.o) + +all: $(SOURCES) $(OUT) + +$(OUT): $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $@ + +.c.o: + $(CC) $(CFLAGS) $< -c -o $@ + +clean: + rm $(OBJECTS) $(OUT) diff --git a/plugins/ao/Makefile.am b/plugins/ao/Makefile.am deleted file mode 100644 index 39ccd749..00000000 --- a/plugins/ao/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -if HAVE_AO -aodir = $(libdir)/$(PACKAGE) -pkglib_LTLIBRARIES = ao.la -ao_la_SOURCES = plugin.c main.c corlett.c\ -eng_dsf/eng_dsf.c eng_dsf/dc_hw.c eng_dsf/aica.c eng_dsf/aicadsp.c eng_dsf/arm7.c eng_dsf/arm7i.c\ -eng_ssf/m68kcpu.c eng_ssf/m68kopac.c eng_ssf/m68kopdm.c eng_ssf/m68kopnz.c eng_ssf/m68kops.c \ -eng_ssf/scsp.c eng_ssf/scspdsp.c eng_ssf/sat_hw.c eng_ssf/eng_ssf.c\ -eng_qsf/eng_qsf.c eng_qsf/kabuki.c eng_qsf/qsound.c eng_qsf/z80.c eng_qsf/z80dasm.c\ -eng_psf/eng_psf.c eng_psf/psx.c eng_psf/psx_hw.c eng_psf/peops/spu.c \ -eng_psf/eng_psf2.c eng_psf/peops2/spu2.c eng_psf/peops2/dma2.c eng_psf/peops2/registers2.c\ -eng_psf/eng_spu.c\ -ao.h corlett.h cpuintrf.h eng_protos.h mem.h osd_cpu.h\ -eng_dsf/aicadsp.h eng_dsf/aica.h eng_dsf/arm7.h eng_dsf/arm7i.h eng_dsf/arm7thumb.h eng_dsf/dc_hw.h\ -eng_ssf/m68kconf.h eng_ssf/m68kcpu.h eng_ssf/m68k.h eng_ssf/m68kmame.h eng_ssf/m68kops.h eng_ssf/sat_hw.h eng_ssf/scspdsp.h eng_ssf/scsp.h \ -eng_qsf/qsound.h eng_qsf/z80dasm.h eng_qsf/z80.h\ -eng_psf/cpuintrf.h eng_psf/mamemem.h eng_psf/psx.h\ -eng_psf/peops/adsr.h eng_psf/peops/dma.h eng_psf/peops/externals.h eng_psf/peops/gauss_i.h eng_psf/peops/registers.h eng_psf/peops/regs.h eng_psf/peops/spu.h eng_psf/peops/stdafx.h\ -eng_psf/peops2/adsr.h eng_psf/peops2/dma.h eng_psf/peops2/externals.h eng_psf/peops2/gauss_i.h eng_psf/peops2/psemuxa.h eng_psf/peops2/registers.h eng_psf/peops2/regs.h eng_psf/peops2/reverb.h eng_psf/peops2/spu.h eng_psf/peops2/stdafx.h - -ao_la_LDFLAGS = -module -fPIC - -EXTRA_DIST=eng_psf/peops/reverb.c eng_psf/peops/adsr.c eng_psf/peops/registers.c eng_psf/peops/dma.c eng_psf/peops2/spu2.c eng_psf/peops2/reverb2.c eng_psf/peops2/adsr2.c eng_dsf/arm7memil.c eng_dsf/aicalfo.c eng_ssf/scsplfo.c - -ao_la_LIBADD = $(LDADD) -AM_CFLAGS = $(CFLAGS) -Wall -DPATH_MAX=1024 -DHAS_PSXCPU=1 -I.. -Ieng_ssf -Ieng_qsf -Ieng_dsf -lm $(ZLIB_LIBS) -endif - diff --git a/plugins/ao/eng_ssf/m68kcpu.c b/plugins/ao/eng_ssf/m68kcpu.c index 9624ea5c..f9b442bc 100644 --- a/plugins/ao/eng_ssf/m68kcpu.c +++ b/plugins/ao/eng_ssf/m68kcpu.c @@ -37,8 +37,6 @@ static const char* copyright_notice = #include "m68kops.h" #include "m68kcpu.h" -#pragma GCC optimize("O0") - /* ======================================================================== */ /* ================================= DATA ================================= */ /* ======================================================================== */ diff --git a/plugins/ao/plugin.c b/plugins/ao/plugin.c index 2e29c4e0..02f70ef2 100644 --- a/plugins/ao/plugin.c +++ b/plugins/ao/plugin.c @@ -1,6 +1,6 @@ /* DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net> + Copyright (C) 2009-2011 Alexey Yakovenko <waker@users.sourceforge.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -48,7 +48,7 @@ typedef struct { } aoplug_info_t; static DB_fileinfo_t * -aoplug_open (void) { +aoplug_open (uint32_t hints) { DB_fileinfo_t *_info = malloc (sizeof (aoplug_info_t)); aoplug_info_t *info = (aoplug_info_t *)_info; memset (info, 0, sizeof (aoplug_info_t)); @@ -59,16 +59,17 @@ static int aoplug_init (DB_fileinfo_t *_info, DB_playItem_t *it) { aoplug_info_t *info = (aoplug_info_t *)_info; - _info->bps = 16; - _info->channels = 2; - _info->samplerate = 44100; + _info->fmt.bps = 16; + _info->fmt.channels = 2; + _info->fmt.samplerate = deadbeef->conf_get_int ("synth.samplerate", 44100); + _info->fmt.channelmask = _info->fmt.channels == 1 ? DDB_SPEAKER_FRONT_LEFT : (DDB_SPEAKER_FRONT_LEFT | DDB_SPEAKER_FRONT_RIGHT); _info->readpos = 0; _info->plugin = &plugin; info->duration = deadbeef->pl_get_item_duration (it); - DB_FILE *file = deadbeef->fopen (it->fname); + DB_FILE *file = deadbeef->fopen (deadbeef->pl_find_meta (it, ":URI")); if (!file) { - trace ("psf: failed to fopen %s\n", it->fname); + trace ("psf: failed to fopen %s\n", deadbeef->pl_find_meta (it, ":URI")); return -1; } @@ -81,7 +82,7 @@ aoplug_init (DB_fileinfo_t *_info, DB_playItem_t *it) { } if (deadbeef->fread(info->filebuffer, 1, info->filesize, file) != info->filesize) { - fprintf(stderr, "psf: file read error: %s\n", it->fname); + fprintf(stderr, "psf: file read error: %s\n", deadbeef->pl_find_meta (it, ":URI")); deadbeef->fclose (file); return -1; } @@ -93,7 +94,7 @@ aoplug_init (DB_fileinfo_t *_info, DB_playItem_t *it) { return -1; } - info->decoder = ao_start (info->type, it->fname, (uint8 *)info->filebuffer, info->filesize); + info->decoder = ao_start (info->type, deadbeef->pl_find_meta (it, ":URI"), (uint8 *)info->filebuffer, info->filesize); if (!info->decoder) { fprintf (stderr, "psf: ao_start failed\n"); return -1; @@ -116,11 +117,11 @@ aoplug_free (DB_fileinfo_t *_info) { } static int -aoplug_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) { +aoplug_read (DB_fileinfo_t *_info, char *bytes, int size) { aoplug_info_t *info = (aoplug_info_t *)_info; // printf ("aoplug_read_int16 %d samples, curr %d, end %d\n", size/4, info->currentsample, (int)(info->duration * _info->samplerate)); - if (info->currentsample >= info->duration * _info->samplerate) { + if (info->currentsample >= info->duration * _info->fmt.samplerate) { return 0; } @@ -152,7 +153,8 @@ aoplug_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) { info->remaining = 735; } } - info->currentsample += (initsize-size) / (_info->channels * _info->bps/8); + info->currentsample += (initsize-size) / (_info->fmt.channels * _info->fmt.bps/8); + _info->readpos = (float)info->currentsample / _info->fmt.samplerate; return initsize-size; } @@ -168,13 +170,13 @@ aoplug_seek_sample (DB_fileinfo_t *_info, int sample) { info->skipsamples = sample; } info->currentsample = sample; - _info->readpos = (float)sample / _info->samplerate; + _info->readpos = (float)sample / _info->fmt.samplerate; return 0; } static int aoplug_seek (DB_fileinfo_t *_info, float time) { - return aoplug_seek_sample (_info, time * _info->samplerate); + return aoplug_seek_sample (_info, time * _info->fmt.samplerate); } static void @@ -250,9 +252,7 @@ aoplug_insert (DB_playItem_t *after, const char *fname) { free (buffer); - DB_playItem_t *it = deadbeef->pl_item_alloc (); - it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id); - it->fname = strdup (fname); + DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id); const char *ext = fname + strlen (fname); while (*ext != '.' && ext > fname) { ext--; @@ -260,38 +260,44 @@ aoplug_insert (DB_playItem_t *after, const char *fname) { if (*ext == '.') { ext++; if (!strcasecmp (ext, "psf") || !strcasecmp (ext, "minipsf")) { - it->filetype = filetypes[0]; + deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[0]); } else if (!strcasecmp (ext, "psf2") || !strcasecmp (ext, "minipsf2")) { - it->filetype = filetypes[1]; + deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[1]); } else if (!strcasecmp (ext, "spu")) { - it->filetype = filetypes[2]; + deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[2]); } else if (!strcasecmp (ext, "ssf") || !strcasecmp (ext, "minissf")) { - it->filetype = filetypes[3]; - } - else if (!strcasecmp (ext, "dsf") || !strcasecmp (ext, "minidsf")) { - it->filetype = filetypes[5]; + deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[3]); } else if (!strcasecmp (ext, "qsf") || !strcasecmp (ext, "miniqsf")) { - it->filetype = filetypes[4]; + deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[4]); + } + else if (!strcasecmp (ext, "dsf") || !strcasecmp (ext, "minidsf")) { + deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[5]); } } else { - it->filetype = filetypes[0]; + deadbeef->pl_add_meta (it, ":FILETYPE", filetypes[0]); } float duration = 120; + float fade = 0; if (have_info) { int i; for (i = 1; i < 9; i++) { if (!strncasecmp (info.title[i], "Length: ", 8)) { - int min, sec; - if (sscanf (info.info[i], "%d:%d", &min, &sec) == 2) { + printf ("len: %s\n", info.info[i]); + int min; + float sec; + if (sscanf (info.info[i], "%d:%f", &min, &sec) == 2) { duration = min * 60 + sec; } + else if (sscanf (info.info[i], "%f", &sec) == 1) { + duration = sec; + } aoplug_add_meta (it, NULL, info.info[i], info.title[i]); } else if (!strncasecmp (info.title[i], "Name: ", 6) || !strncasecmp (info.title[i], "Song: ", 6)) { @@ -312,12 +318,16 @@ aoplug_insert (DB_playItem_t *after, const char *fname) { else if (!strncasecmp (info.title[i], "Ripper: ", 8)) { aoplug_add_meta (it, "vendor", info.info[i], info.title[i]); } + else if (!strncasecmp (info.title[i], "Fade: ", 6)) { + fade = atof (info.info[i]); + aoplug_add_meta (it, NULL, info.info[i], info.title[i]); + } else { aoplug_add_meta (it, NULL, info.info[i], info.title[i]); } } } - deadbeef->pl_set_item_duration (it, duration); + deadbeef->pl_set_item_duration (it, duration+fade); deadbeef->pl_add_meta (it, "title", NULL); after = deadbeef->pl_insert_item (after, it); deadbeef->pl_item_unref (it); @@ -336,21 +346,40 @@ aoplug_stop (void) { static DB_decoder_t plugin = { DB_PLUGIN_SET_API_VERSION - .plugin.version_major = 0, - .plugin.version_minor = 1, + .plugin.version_major = 1, + .plugin.version_minor = 0, .plugin.type = DB_PLUGIN_DECODER, .plugin.id = "psf", .plugin.name = "Audio Overload plugin", .plugin.descr = "psf, psf2, spu, ssf, minidsf player based on Audio Overload library", - .plugin.author = "Alexey Yakovenko", - .plugin.email = "waker@users.sourceforge.net", + .plugin.copyright = + "Copyright (C) 2009-2011 Alexey Yakovenko <waker@users.sourceforge.net>\n" + "\n" + "Uses modified aosdk-1.4.8 - library for playing .PSF (Sony PlayStation), .SPU (Sony PlayStation), .PSF2 (Sony PlayStation 2), .SSF (Sega Saturn), .DSF (Sega Dreamcast), and .QSF (Capcom QSound) audio file formats,\n" + "http://rbelmont.mameworld.info/?page_id=221\n" + "Copyright © 2007-2009 R. Belmont and Richard Bannister.\n" + "\n" + "This program is free software; you can redistribute it and/or\n" + "modify it under the terms of the GNU General Public License\n" + "as published by the Free Software Foundation; either version 2\n" + "of the License, or (at your option) any later version.\n" + "\n" + "This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with this program; if not, write to the Free Software\n" + "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n" + , .plugin.website = "http://deadbeef.sf.net", .plugin.start = aoplug_start, .plugin.stop = aoplug_stop, .open = aoplug_open, .init = aoplug_init, .free = aoplug_free, - .read_int16 = aoplug_read_int16, + .read = aoplug_read, .seek = aoplug_seek, .seek_sample = aoplug_seek_sample, .insert = aoplug_insert, |