changeset 4:6fe75337b896

Switched back to using the deprecated functions for now until I can patch in the code needed from the new analyzer plugin. Also work around a division by zero because of a size of 0x0 being passed in.
author Brian Smith <brian@dbsoft.org>
date Thu, 24 Nov 2011 04:28:49 -0600
parents 7635b6e8db00
children 79cf5b468a5b
files makefile nuclear.c
diffstat 2 files changed, 22 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/makefile	Thu Nov 24 04:01:21 2011 -0600
+++ b/makefile	Thu Nov 24 04:28:49 2011 -0600
@@ -3,10 +3,10 @@
 .SUFFIXES: \
 	.c .obj
 
-#CFLAGS = /Ti /DOS2 /DTCPV40HDRS /Sm /Ss /Q /Gm /Gt /Gd+ /C
-CFLAGS = /DOS2 /DTCPV40HDRS /Sm /Ss /Q /Gm /Gt /Gd- /Ge- /C
-#LDFLAGS = /DE /optfunc
-LDFLAGS = /optfunc
+CFLAGS = /Ti /DOS2 /DTCPV40HDRS /Sm /Ss /Q /Gm /Gt /Gd+ /C
+#CFLAGS = /DOS2 /DTCPV40HDRS /Sm /Ss /Q /Gm /Gt /Gd- /Ge- /C
+LDFLAGS = /DE /optfunc
+#LDFLAGS = /optfunc
 
 
 OBJECTS = nuclear.obj dw.obj
--- a/nuclear.c	Thu Nov 24 04:01:21 2011 -0600
+++ b/nuclear.c	Thu Nov 24 04:28:49 2011 -0600
@@ -29,8 +29,11 @@
 #define strcasecmp stricmp
 
 VISPLUGININIT plug;
-static  ULONG (DLLENTRYP decoderPlayingSamples)( FORMAT_INFO *info, char *buf, int len );
-static  BOOL  (DLLENTRYP decoderPlaying)( void );
+
+static ULONG (DLLENTRYP decoderPlayingSamples)( FORMAT_INFO *info, char *buf, int len );
+static BOOL  (DLLENTRYP decoderPlaying)( void );
+static int   (DLLENTRYP specana_init)(int setnumsamples);
+static int   (DLLENTRYP specana_dobands)(float bands[]);
 
 void DiveInit(void);
 void DiveShutdown(void);
@@ -73,17 +76,6 @@
 HDC hdcClient;
 HPS hpsDive;
 
-/* TODO: Fill these in... since they are no longer exported */
-int init_bands(int num)
-{
-    return num;
-}
-
-int do_bands(void)
-{
-    return 1;
-}
-
 void DLLENTRY plugin_query(PPLUGIN_QUERYPARAM param)
 {
 	param->type         = PLUGIN_VISUAL; /* Identify the plugin as visual */
@@ -333,7 +325,7 @@
 	/* Find the ideal number of bars (bands) for our analyzer */
 	while(bands < wantedsamples)
 	{
-		bands = init_bands(z);
+		bands = specana_init(z);
 		z++;
 		if(z < 1 || z > 4097)
 		{
@@ -751,7 +743,7 @@
 	float scale;
 	HPS hps = WinGetPS(hwnd);
 
-	max = do_bands();
+	max = specana_dobands(current);
 
 	if(boost)
 		scale = (float)max/(cy*boostval);
@@ -1006,7 +998,7 @@
 	int z, max;
 	float scale;
 
-	max = do_bands();
+	max = specana_dobands(current);
 
 	if(boost)
 		scale = (float)max/(cy*boostval);
@@ -1271,6 +1263,9 @@
 	memcpy(&plug, initdata, sizeof( VISPLUGININIT));
 	decoderPlayingSamples = initdata->procs->output_playing_samples;
 	decoderPlaying        = initdata->procs->decoder_playing;
+    /* These are supposedly deprecated but seem to still be exported */
+    specana_init          = initdata->procs->unused1;
+    specana_dobands       = initdata->procs->unused2;
 
 	cx = initdata->cx;
 	cy = initdata->cy;
@@ -1278,13 +1273,19 @@
 
 	loadconfig();
 
+    /* Can't initialize to 0! */
+	if(!cx)
+		cx = 1;
+	if(!cy)
+		cy = 1;
+
 	samples = (int)(cx / (blockwidth+spacing));
 	wantedsamples = (int)((cx / (blockwidth+spacing))*(100/percentage));
 
 	/* Find the ideal number of bars (bands) for our analyzer */
 	while(bands < wantedsamples)
 	{
-		bands = init_bands(z);
+		bands = specana_init(z);
 		z++;
 		if(z < 1 || z > 4097)
 		{