home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
MM1
/
SOUNDUTILS
/
tracker.4.6.lzh
/
TRACKER4.6
/
analyzer.c
next >
Wrap
C/C++ Source or Header
|
1994-11-24
|
3KB
|
154 lines
/* analyzer.c
vi:ts=3 sw=3:
*/
/* read module files and output statistics on them */
/* $Id: analyzer.c,v 4.4 1994/11/15 16:11:01 espie Exp espie $
* $Log: analyzer.c,v $
* Revision 4.4 1994/11/15 16:11:01 espie
* *** empty log message ***
*
*
* Revision 4.1 1994/01/12 16:10:20 espie
* Fixed up last minute problems.
* Lots of changes.
* removed create_note_tables(), run_in_fg().
* Use new pref scheme.
* New open_file semantics.
* Added speed check.
* Added patch for non termio.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "defs.h"
#include "extern.h"
#include "song.h"
#include "tags.h"
#include "prefs.h"
ID("$Id: analyzer.c,v 4.4 1994/11/15 16:11:01 espie Exp espie $")
int error;
struct song *do_read_song(name, type)
char *name;
int type;
{
struct song *song;
struct exfile *file;
file = open_file(name, "r", getenv("MODPATH"));
if (!file)
return NULL;
song = read_song(file, type);
close_file(file);
if (song)
puts(name);
return song;
}
int use_command[16];
int use_extended[16];
void analyze_block(b)
struct block *b;
{
int i, j;
struct event *e;
for (i = 0; i < BLOCK_LENGTH; i++)
{
int special;
special = 0;
for (j = 0; j < NUMBER_TRACKS; j++)
{
e = &b->e[j][i];
switch(e->effect)
{
#if 0
case 13: /* skip */
return;
case 11: /* fastskip */
return;
#endif
case 14:
use_extended[HI(e->parameters)] = TRUE;
break;
case 15:
if (special != 0 && e->parameters != special)
putchar('!');
else
special = e->parameters;
default:
use_command[e->effect] = TRUE;
}
}
}
}
void analyze_song(song)
struct song *song;
{
int i;
for (i = 0; i < NUMBER_SAMPLES; i++)
{
if (song->samples[i].start)
{
if (song->samples[i].finetune)
printf("Sample %d: finetune is %d\n",
i, song->samples[i].finetune);
}
}
for (i = 0; i < 16; i++)
{
use_command[i] = FALSE;
use_extended[i] = FALSE;
}
for (i = 0; i < song->info.maxpat; i++)
analyze_block(song->info.pblocks+i);
for (i = 0; i < 16; i++)
if (use_command[i])
printf("%3d", i);
for (i = 0; i < 16; i++)
if (use_extended[i])
printf("%3dE", i);
printf("\n");
}
int main(argc, argv)
int argc;
char **argv;
{
int i;
struct song *song;
int default_type;
default_type = BOTH;
set_pref_scalar(PREF_TOLERATE, 2);
for (i = 1; i < argc; i++)
{
song = do_read_song(argv[i], NEW);
if (!song && error != NEXT_SONG)
song = do_read_song(argv[i], OLD);
if (song)
{
analyze_song(song);
release_song(song);
}
}
}