summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Jamfile8
-rw-r--r--codec.h2
-rw-r--r--csid.cpp95
-rw-r--r--csid.h8
-rw-r--r--cvorbis.c3
-rw-r--r--playlist.c3
-rw-r--r--sidplay-libs-2.1.0/Jamfile18
7 files changed, 130 insertions, 7 deletions
diff --git a/Jamfile b/Jamfile
index 12d0c5f2..5eb3bbff 100644
--- a/Jamfile
+++ b/Jamfile
@@ -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++ ;
diff --git a/codec.h b/codec.h
index 9554f0a2..ffb4e8f5 100644
--- a/codec.h
+++ b/codec.h
@@ -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
+};
+
diff --git a/csid.h b/csid.h
new file mode 100644
index 00000000..bbc0597d
--- /dev/null
+++ b/csid.h
@@ -0,0 +1,8 @@
+#ifndef __CSID_H
+#define __CSID_H
+
+extern codec_t csid;
+
+#endif // __CSID_H
+
+
diff --git a/cvorbis.c b/cvorbis.c
index f24074ca..f45194f7 100644
--- a/cvorbis.c
+++ b/cvorbis.c
@@ -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;
diff --git a/playlist.c b/playlist.c
index ea2d3ec7..83583f5d 100644
--- a/playlist.c
+++ b/playlist.c
@@ -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
;