Specifications

CONSTRUCTION
OUTPUT;dlen=NoSamples;
BOOL bits16=FALSE;
if(wave.fmt.FormatSpecific==BITS16) bits16=
TRUE;
if(bits16==FALSE)
while(dlen>0)
{
fread(array,1,nChannels,fsource);
switch(nChannels)
{
case 1: fputc((int)array[0],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
fputc((int)array[0],fdest);
break;
case 2: fputc((int)array[0],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
fputc((int)array[1],fdest);
break;
case 3: fputc((int)array[0],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
fputc((int)array[1],fdest);
break;
case 4: fputc((int)array[0],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
fputc((int)array[2],fdest);
break;
case 6: fputc((int)array[1],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
fputc((int)array[4],fdest);
break;
}
dlen—;
}
else
{
NoSamples/=2;
dlen=NoSamples;
while(dlen>0)
{
fread(arrayi,2,nChannels,fsource);
switch(nChannels)
{
case 1: array[0]=(char)((long)(arrayi[0]+
32768)*255/65535);
fputc((int)array[0],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
fputc((int)array[0],fdest);
break;
case 2: array[0]=(char)((long)(arrayi[0]+
32768)*255/65535);
fputc((int)array[0],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
{
array[1]=(char)((long)(arrayi[1]+32768)*255/
65535);
fputc((int)array[1],fdest);
}
break;
case 3: array[0]=(char)((long)(arrayi[0]+
32768)*255/65535);
fputc((int)array[0],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
{
array[1]=(char)((long)(arrayi[1]+32768)*255/
65535);
fputc((int)array[1],fdest);
}
break;
case 4: array[0]=(char)((long)(arrayi[0]+
32768)*255/65535);
fputc((int)array[0],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
{
array[2]=(char)((long)(arrayi[2]+32768)*255/
65535);
fputc((int)array[2],fdest);
}
break;
case 6: array[1]=(char)((long)(arrayi[1]+
32768)*255/65535);
fputc((int)array[1],fdest);
if(TYPE_OF_OUTPUT==STEREO_OUTPUT)
{
array[4]=(char)((long)(arrayi[4]+32768)*255/
65535);
fputc((int)array[4],fdest);
}
break;
}
dlen—;
}
}
fclose(fsource);
fclose(fdest);
return TRUE;
}
else
{
printf(“\a”);
DisplayTip(“The file is not available!”);
return FALSE;
}
}
GLOBALS.H
#include <stdio.h>
#include <dos.h>
#include <process.h>
#include <conio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define FALSE 0
#define TRUE 1
#define ENABLE_ACTIVE 1
#define ENABLE_NOTACTIVE 2
#define DISABLE 0
#define NONE -1
#define MNU_FILE 0
#define MNU_EFFECT 1
#define MNU_OPERATION 2
#define MNU_FADEIN 3
#define MNU_FADEOUT 4
#define FILE_OPEN 1
#define FILE_SAVE 2
#define FILE_EXIT 4
#define FADEIN_LINEAR 31
#define FADEIN_EXP 32
#define FADEOUT_LINEAR 41
#define FADEOUT_EXP 42
#define REVERSE 14
#define PLAYBACK_RATE 15
#define PLAY 21
#define RECORD 22
#define AltE 318
#define AltF 333
#define AltO 324
#define AltX 345
#define LEFT_ARROW 375
#define RIGHT_ARROW 377
#define UP_ARROW 372
#define DOWN_ARROW 380
#define ESCAPE 327
#define ENTER 313
#define SPACE 332
#define BACK_SPACE 308
#define TAB 309
#define PCM 1
#define IN 0
#define OUT 1
#define LINEAR 0
#define EXPONENTIAL 1
#define FADEIN 0
#define FADEOUT 1
#define DATA_OUT 0x378
#define BITS16 16
#define BITS8 8
#define STEREO_OUTPUT 2
#define MONO_OUTPUT 1
typedef char BOOL;
typedef struct{
char rID[4];
unsigned long rLen;
}RIFF;
typedef struct{
char fID[4];
unsigned long fLen;
unsigned int wFormatTag;
unsigned int nChannels;
unsigned long nSamplesPerSec;
unsigned long nAvgBytesPerSec;
unsigned int nBlockAlign;
unsigned int FormatSpecific;
}FORMATCHUNK;
typedef struct{
char wID[4];
FORMATCHUNK fmt;
}WAVE;
typedef struct{
char dID[4];
unsigned long dLen;
}DATA;
struct MENU
{ int subMenu[10];
char *Tip[10];
char *String[10];
int OptionID[10];
BOOL Enabled[10];
int num_items;
char Child;
int AtX,AtY;
int nextMenu;
int prevMenu;
} Menu[5];
long RateOfPlayBack=15000,PBR;
long double NoSamples=76455;
double SamplingFrequency=44000;
char sFileName[40];
char sPlayBackRate[6];
www.electronicsforu.com
a portal dedicated to electronics enthusiasts
81