1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

- Fix build with gcc 4.x

- Added a patch to control window to display when an nsf song is played and
  change 'Fadeout' option to 'Silence Until Next Song' [1]
- Cleanup
- Bump PORTREVISION

Obtained from:	gentoo
This commit is contained in:
Emanuel Haupt 2007-01-11 14:25:53 +00:00
parent 903460fc41
commit 6de5b2ae5e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=182100
11 changed files with 195 additions and 7 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= xmms-nsf
PORTVERSION= 0.0.3
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= audio
MASTER_SITES= http://optronic.sourceforge.net/files/ \
http://critical.ch/distfiles/ \
@ -21,6 +21,7 @@ RUN_DEPENDS= xmms:${PORTSDIR}/multimedia/xmms
GNU_CONFIGURE= yes
USE_X_PREFIX= yes
USE_LDCONFIG= yes
ONLY_FOR_ARCHS= i386 amd64

View File

@ -0,0 +1,34 @@
--- ./src/nes/audiosys.c.orig Sun Jan 7 05:17:57 2001
+++ ./src/nes/audiosys.c Wed Jan 10 20:10:34 2007
@@ -8,8 +8,11 @@
static NES_AUDIO_HANDLER *nah = 0;
static NES_VOLUME_HANDLER *nvh = 0;
-void NESAudioRender(Int16 *bufp, Uint buflen)
+Uint32 NESAudioRender(Int16 *bufp, Uint buflen)
{
+ Int16 x;
+ Uint32 count = 0;
+
while (buflen--)
{
NES_AUDIO_HANDLER *ph;
@@ -31,9 +34,17 @@
else
output = accum;
output >>= 8;
- *bufp++ = ((Int32)output) - 0x8000;
+ x = ((Int32)output) - 0x8000;
+ if (abs(x) < 96)
+ count++;
+ else
+ count = 0;
+
+ *bufp++ = x;
}
}
+
+ return count;
}
void NESVolume(Uint volume)

View File

@ -0,0 +1,11 @@
--- ./src/nes/audiosys.h.orig Sun Jan 7 05:17:56 2001
+++ ./src/nes/audiosys.h Wed Jan 10 20:10:34 2007
@@ -21,7 +21,7 @@
} NES_VOLUME_HANDLER;
-void NESAudioRender(Int16 *bufp, Uint buflen);
+Uint32 NESAudioRender(Int16 *bufp, Uint buflen);
void NESAudioHandlerInstall(NES_AUDIO_HANDLER *ph);
void NESAudioFrequencySet(Uint freq);
Uint NESAudioFrequencyGet(void);

View File

@ -1,5 +1,5 @@
--- src/nes/handler.c.orig Sun Jan 7 05:17:57 2001
+++ src/nes/handler.c Thu Aug 18 16:47:01 2005
--- ./src/nes/handler.c.orig Sun Jan 7 05:17:57 2001
+++ ./src/nes/handler.c Wed Jan 10 20:10:34 2007
@@ -10,9 +10,9 @@
static NES_READ_HANDLER *(nprh[0x10]) = { 0, };
static NES_WRITE_HANDLER *(npwh[0x10]) = { 0, };

View File

@ -1,5 +1,5 @@
--- src/nes/km6502/km6502cd.h.orig Sun Jan 7 05:18:05 2001
+++ src/nes/km6502/km6502cd.h Thu Aug 18 16:47:34 2005
--- ./src/nes/km6502/km6502cd.h.orig Sun Jan 7 05:18:05 2001
+++ ./src/nes/km6502/km6502cd.h Wed Jan 10 20:10:34 2007
@@ -361,27 +361,27 @@
/* --- ADC --- */

View File

@ -1,5 +1,5 @@
--- src/nes/km6502/km6502ot.h.orig Sun Jan 7 05:18:05 2001
+++ src/nes/km6502/km6502ot.h Thu Aug 18 16:47:59 2005
--- ./src/nes/km6502/km6502ot.h.orig Sun Jan 7 05:18:05 2001
+++ ./src/nes/km6502/km6502ot.h Wed Jan 10 20:10:34 2007
@@ -1,35 +1,35 @@
#define OPxx(i)
#define OP__(i) \

View File

@ -0,0 +1,20 @@
--- ./src/xmms/callbacks.c.orig Sun Jul 23 12:06:43 2000
+++ ./src/xmms/callbacks.c Wed Jan 10 20:10:34 2007
@@ -219,7 +219,7 @@
widget = lookup_widget(GTK_WIDGET(button), "spinbutton1");
nsf_cfg.play_time = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
widget = lookup_widget(GTK_WIDGET(button), "spinbutton2");
- nsf_cfg.fadeout_time = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ nsf_cfg.silence_time = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL);
cfg = xmms_cfg_open_file(filename);
@@ -228,7 +228,7 @@
}
xmms_cfg_write_int(cfg, "NSF", "play_time",nsf_cfg.play_time);
- xmms_cfg_write_int(cfg, "NSF", "fadeout_time",nsf_cfg.fadeout_time);
+ xmms_cfg_write_int(cfg, "NSF", "silence_time",nsf_cfg.silence_time);
xmms_cfg_write_file(cfg, filename);
xmms_cfg_free(cfg);
g_free(filename);

View File

@ -0,0 +1,11 @@
--- ./src/xmms/interface.c.orig Sun Jul 23 11:41:14 2000
+++ ./src/xmms/interface.c Wed Jan 10 20:10:34 2007
@@ -106,7 +106,7 @@
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
- label3 = gtk_label_new ("Fadeout Time:");
+ label3 = gtk_label_new ("Silence Until Next Song:");
gtk_widget_ref (label3);
gtk_object_set_data_full (GTK_OBJECT (configure), "label3", label3,
(GtkDestroyNotify) gtk_widget_unref);

View File

@ -0,0 +1,85 @@
--- ./src/xmms/nsf.c.orig Sun Jan 7 06:15:12 2001
+++ ./src/xmms/nsf.c Wed Jan 10 20:13:26 2007
@@ -23,7 +23,8 @@
#define VERSION "0.0.3"
#define PLAYTIME 30
-#define FADEOUTTIME 5
+#define SILENCETIME 5
+#define FREQ 44100
#include "nsf.h"
@@ -328,7 +329,7 @@
widget = lookup_widget(nsf_configure_win, "spinbutton1");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), nsf_cfg.play_time);
widget = lookup_widget(nsf_configure_win, "spinbutton2");
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), nsf_cfg.fadeout_time);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), nsf_cfg.silence_time);
gtk_widget_show(nsf_configure_win);
}else{
@@ -357,7 +358,7 @@
nsf_win->dock_window_list = NULL;
nsf_cfg.play_time = PLAYTIME; /* second */
- nsf_cfg.fadeout_time = FADEOUTTIME; /* second */
+ nsf_cfg.silence_time = SILENCETIME; /* second */
nsf_cfg.player_shaded = FALSE;
nsf_cfg.easy_move = FALSE;
@@ -365,7 +366,7 @@
if ((cfg = xmms_cfg_open_file(filename)) != 0){
xmms_cfg_read_int(cfg, "NSF", "play_time", &nsf_cfg.play_time);
- xmms_cfg_read_int(cfg, "NSF", "fadeout_time", &nsf_cfg.fadeout_time);
+ xmms_cfg_read_int(cfg, "NSF", "silence_time", &nsf_cfg.silence_time);
xmms_cfg_free(cfg);
}
}
@@ -439,10 +440,11 @@
{
char data[2048 * 2];
int bytes, blk_size, rate;
+ Uint32 c = 0, count = 0;
//setting NSF
NSFSetSongNo(nsf_file->current_song);
- NESAudioFrequencySet(44100);
+ NESAudioFrequencySet(FREQ);
NESReset();
//16bit/8bit * 1channel * 512 sample = 1024byte
@@ -460,7 +462,15 @@
}
if (bytes > 0){
//read 1024byte = 512 sample * 2byte
- NESAudioRender(data, bytes/2);
+ c = NESAudioRender((Int16*)data, bytes/2);
+ if (c < 512)
+ count = 0;
+ else
+ count += c;
+ if (count > FREQ*nsf_cfg.silence_time) {
+ nsf_file->eos = 1;
+ count = 0;
+ }
nsf_ip.add_vis_pcm(nsf_ip.output->written_time(), (nsf_file->bits_per_sample == 16) ? FMT_S16_LE : FMT_U8,
nsf_file->channels, bytes, data);
@@ -512,11 +522,14 @@
if (!(nsf_file->file = fopen(filename, "rb"))){
return;
}
+
+ nsf_about();
+
fseek(nsf_file->file, 0, SEEK_END);
count = ftell(nsf_file->file);
fseek(nsf_file->file, 0, SEEK_SET);
- (void*)buffer = g_malloc0(count);
+ buffer = (void*)g_malloc0(count);
for(i=0;i<count;i++){
*(buffer+i) = fgetc(nsf_file->file);
}

View File

@ -0,0 +1,11 @@
--- ./src/xmms/nsf.h.orig Sun Jul 23 12:00:35 2000
+++ ./src/xmms/nsf.h Wed Jan 10 20:10:34 2007
@@ -58,7 +58,7 @@
typedef struct
{
gint play_time;
- gint fadeout_time;
+ gint silence_time;
// reserve
gint resolution;
gint channels;

View File

@ -0,0 +1,15 @@
--- ./src/xmms/nsflib.h.orig Sun Jul 23 12:05:21 2000
+++ ./src/xmms/nsflib.h Wed Jan 10 20:10:34 2007
@@ -1,10 +1,11 @@
typedef signed short Int16;
typedef unsigned int Uint;
+typedef unsigned int Uint32;
typedef unsigned char Uint8;
Uint NSFLoad(Uint8 *pData, Uint uSize);
void NSFSetSongNo(Uint uSongNo);
void NESAudioFrequencySet(Uint freq);
void NESReset(void);
-void NESAudioRender(Int16 *bufp, Uint buflen);
+Uint32 NESAudioRender(Int16 *bufp, Uint buflen);
void NESTerminate(void);