home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD2.mdf
/
c
/
library
/
mslang
/
cp1
/
mod1-3.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-10
|
3KB
|
102 lines
===========================================================================
BBS: The Abacus * HST/DS * Potterville, MI
Date: 06-06-93 (11:27) Number: 219
From: DANIEL LYNES Refer#: NONE
To: MATTHEW O'CONNOR Recvd: NO
Subj: Mod File Routines 3/4 Conf: (36) C Language
---------------------------------------------------------------------------
/*** Get Fine Tune Setting ***/
i = *cptr & 15; /* 00001111 make 4bit int */
if ((i&8) == 8) /* 00001000 check sign bit */
i = i - 16; /* Seems to convert right ? */
inst->F_Tune = i; /* Store Fine tune value */
cptr += 1;
/*** Get Instrament Volume ***/
inst->Vol = *cptr; /* Store volume */
cptr += 1;
/*** Get Repeat values ***/
inst->R_Start = Con_Word(cptr); /* correct repeat start word */
cptr +=2;
inst->R_Len = Con_Word(cptr); /* correct repeat lenght word */
cptr +=2;
};
/*********
*********/
void Read_Track(struct S_Track *track, int handle)
/* This function reads ONE track and stores it into structure
pointed to by track. */
{
int count, /* counting variable */
i; /* Temporary integer */
for (count = 0 ; count < MAXNOTES ; count++)
{
for ( i = 0 ; i < MAXCHAN ; i++)
{
Read_Note(&track->Note[count].Chan[i] ,handle);
/* due to current limits, channel is 0 only, should be i */
};
};
};
/*********
*********/
char *Read_Samp(struct S_Inst *inst, char *m_ptr)
/* This function finds the sample and sets the instrament pointer to it. It retu
rns a pointer to the next sample. */
{
char *ptr;
inst->Samp = m_ptr;
ptr = m_ptr + inst->Len;
return(ptr);
};
/*********
*********/
int Load_Song(char *name, struct S_Mod *mod2)
/* This function loads a file indicated by name, into the mod
structure. */
{
int handle; /* file handle number */
long int file_size; /* file size */
char *fptr; /* file buffer pointer */
char *ptr; /* temporary pointer */
char *t, *t2;
char test[2];
byte ta[134];
int c; /* temporary counter */
handle = _open(name,O_RDONLY|O_BINARY);/* Open Mod file
read only as binary */
if (handle == -1)
{
printf(" Error opening %s!\n",name);
exit(1);
};
/* File opened ok. Get info and alloc buffer memory */
file_size = filelength(handle);
if (file_size == -1)
{
printf("Error finding %s's filelength.\n",name);
exit(1);
};
/* Read file into buffer */
* SLMR 2.1a * Beware of the opinion of someone without any facts.
--- SLMAIL v3.0 (#0272)
* Origin: Thunder Bay, Ontario, Canada (1:229/516)
SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20