diff options
-rw-r--r-- | Jamfile | 8 | ||||
-rw-r--r-- | codec.h | 2 | ||||
-rw-r--r-- | csid.cpp | 95 | ||||
-rw-r--r-- | csid.h | 8 | ||||
-rw-r--r-- | cvorbis.c | 3 | ||||
-rw-r--r-- | playlist.c | 3 | ||||
-rw-r--r-- | sidplay-libs-2.1.0/Jamfile | 18 |
7 files changed, 130 insertions, 7 deletions
@@ -6,8 +6,8 @@ SubDir ROOT ; CCFLAGS += -D_GNU_SOURCE ; CCFLAGS += -std=c99 ; # CCFLAGS += -D_REENTRANT ; -OPTIM += -O0 ; -OPTIM += -g ; +OPTIM += -O2 ; +#OPTIM += -g ; HDRS += /usr/include/gtk-2.0 ; HDRS += /usr/lib/gtk-2.0/include ; @@ -16,9 +16,11 @@ HDRS += /usr/lib/glib-2.0/include ; HDRS += /usr/include/atk-1.0 ; HDRS += /usr/include/pango-1.0 ; HDRS += /usr/include/cairo ; +HDRS += $(ROOT)/sidplay-libs-2.1.0/libsidplay/include ; +HDRS += $(ROOT)/sidplay-libs-2.1.0/builders/resid-builder/include ; Main deadbeef : - codec.c cvorbis.c cmp3.c cgme.c cdumb.c cwav.c cflac.c playlist.c psdl.c streamer.c main.c support.c interface.c callbacks.c threading.c messagepump.c gtkplaylist.c ; + codec.c cvorbis.c cmp3.c cgme.c cdumb.c cwav.c cflac.c csid.cpp playlist.c psdl.c streamer.c main.c support.c interface.c callbacks.c threading.c messagepump.c gtkplaylist.c ; LINKLIBS on deadbeef = -lm -lvorbis -logg -lvorbisfile -lmad -lFLAC -lSDL -lsamplerate -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lgthread-2.0 -lstdc++ ; @@ -12,7 +12,6 @@ typedef struct { } fileinfo_t; typedef struct codec_s { - fileinfo_t info; int (*init) (const char *fname, int track, float start, float end); void (*free) (void); // player is responsible for starting next song if -1 is returned @@ -20,6 +19,7 @@ typedef struct codec_s { int (*seek) (float time); int (*add) (const char *fname); const char ** (*getexts) (void); + fileinfo_t info; } codec_t; codec_t *get_codec_for_file (const char *fname); diff --git a/csid.cpp b/csid.cpp new file mode 100644 index 00000000..97bb9844 --- /dev/null +++ b/csid.cpp @@ -0,0 +1,95 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "sidplay/sidplay2.h" +#include "sidplay/builders/resid.h" +extern "C" { +#include "codec.h" +#include "playlist.h" +} +#include "csid.h" + +static sidplay2 *sidplay; +static ReSIDBuilder *resid; +static SidTune *tune; +extern int sdl_player_freq; // hack! + +extern "C" int +csid_init (const char *fname, int track, float start, float end) { + sidplay = new sidplay2; + resid = new ReSIDBuilder ("wtf"); + resid->create (sidplay->info ().maxsids); + resid->filter (true); + resid->sampling (sdl_player_freq); + tune = new SidTune (fname); + tune->selectSong (0); + csid.info.channels = tune->isStereo () ? 2 : 1; + sid2_config_t conf; + conf = sidplay->config (); + conf.frequency = sdl_player_freq; + conf.precision = 16; + conf.playback = csid.info.channels == 2 ? sid2_stereo : sid2_mono; + conf.sidEmulation = resid; + conf.optimisation = 0; + sidplay->config (conf); + sidplay->load (tune); + csid.info.bitsPerSample = 16; + csid.info.samplesPerSecond = sdl_player_freq; + csid.info.duration = 120; + csid.info.position = 0; + + return 0; +} + +extern "C" void +csid_free (void) { + delete sidplay; + sidplay = 0; + delete resid; + resid = 0; + delete tune; + tune = 0; +} + +extern "C" int +csid_read (char *bytes, int size) { + int rd = sidplay->play (bytes, size/csid.info.channels); + return rd * csid.info.channels; +} + +extern "C" int +csid_seek (float time) { + return 0; +} + +extern "C" int +csid_add (const char *fname) { + playItem_t *it = (playItem_t*)malloc (sizeof (playItem_t)); + memset (it, 0, sizeof (playItem_t)); + it->codec = &csid; + it->fname = strdup (fname); + it->tracknum = 0; + it->timestart = 0; + it->timeend = 0; + ps_append_item (it); + return 0; +} + +static const char * exts[]= +{ + "sid",NULL +}; + +extern "C" const char **csid_getexts (void) { + return exts; +} + +codec_t csid = { + csid_init, + csid_free, + csid_read, + csid_seek, + csid_add, + csid_getexts +}; + @@ -0,0 +1,8 @@ +#ifndef __CSID_H +#define __CSID_H + +extern codec_t csid; + +#endif // __CSID_H + + @@ -54,8 +54,7 @@ cvorbis_free (void) { } int -cvorbis_read (char *bytes, int size) -{ +cvorbis_read (char *bytes, int size) { if (!file) return 0; int initsize = size; @@ -12,6 +12,7 @@ #include "cmp3.h" #include "cgme.h" #include "cflac.h" +#include "csid.h" #include "streamer.h" #define SKIP_BLANK_CUE_TRACKS 1 @@ -234,7 +235,7 @@ ps_add_file (const char *fname) { // match by codec codec_t *codecs[] = { - &cdumb, &cvorbis, &cflac, &cgme, &cmp3, NULL + &cdumb, &cvorbis, &cflac, &cgme, &cmp3, &csid, NULL }; for (int i = 0; codecs[i]; i++) { if (codecs[i]->getexts && codecs[i]->add) { diff --git a/sidplay-libs-2.1.0/Jamfile b/sidplay-libs-2.1.0/Jamfile index 3fc8385a..5a5661bc 100644 --- a/sidplay-libs-2.1.0/Jamfile +++ b/sidplay-libs-2.1.0/Jamfile @@ -1,11 +1,13 @@ SubDir ROOT sidplay-libs-2.1.0 ; C++FLAGS += -DHAVE_UNIX ; +C++FLAGS += -DVERSION=\\\"2.1.0\\\" ; SubDirHdrs $(ROOT)/sidplay-libs-2.1.0 ; SubDirHdrs $(ROOT)/sidplay-libs-2.1.0/libsidplay ; SubDirHdrs $(ROOT)/sidplay-libs-2.1.0/libsidplay/include ; SubDirHdrs $(ROOT)/sidplay-libs-2.1.0/libsidplay/include/sidplay ; SubDirHdrs $(ROOT)/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils ; SubDirHdrs $(ROOT)/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders ; +SubDirHdrs $(ROOT)/sidplay-libs-2.1.0/builders/resid-builder/include/ ; Library libsidplay : libsidutils/src/SidDatabase.cpp @@ -34,6 +36,22 @@ libsidplay/src/xsid/xsid.cpp libsidplay/src/mos6526/mos6526.cpp builders/resid-builder/src/resid.cpp builders/resid-builder/src/resid-builder.cpp +resid/wave8580_PS_.cc +resid/filter.cc +resid/pot.cc +resid/wave.cc +resid/version.cc +resid/wave6581__ST.cc +resid/extfilt.cc +resid/wave8580_PST.cc +resid/wave6581_PST.cc +resid/wave6581_P_T.cc +resid/wave6581_PS_.cc +resid/envelope.cc +resid/voice.cc +resid/sid.cc +resid/wave8580__ST.cc +resid/wave8580_P_T.cc libsidplay/src/reloc65.c ; |