First commit 09/04/1995
This commit is contained in:
328
CD_SND/CD_SND.CPP
Normal file
328
CD_SND/CD_SND.CPP
Normal file
@ -0,0 +1,328 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CD_SND
|
||||
//
|
||||
// Utilidad para CD_Out
|
||||
//
|
||||
// Se encarga de reunir todos los Waves en un solo archivo para que
|
||||
// CD_Out pueda utilizarlos.
|
||||
//
|
||||
// Parametros de entrada:
|
||||
//
|
||||
// CD_SND [Command] [Output File] [ ID_Code ]
|
||||
//
|
||||
// -u:NAME.EXT Uncompress Wave with name: NAME.EXT
|
||||
// -ua Uncompress ALL WAVES
|
||||
//
|
||||
// -c:NAME.EXT Compress Wave with name: NAME.EXT ( Name will be a name valid
|
||||
// for CD_Out:
|
||||
// CD_OUTXX.WAV )
|
||||
// -ca Compress ALL WAVES
|
||||
// -e:NAME.EXT Extract Wave File with NAME.EXT
|
||||
//
|
||||
// Si el fichero no es reconocido por CD_Out necesitara un ID_Code
|
||||
// distinto para su utilizaci<63>n ( en un futuro ), para futuras vesiones
|
||||
// de CD_Out
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include<io.h>
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
#include<conio.h>
|
||||
|
||||
#define Extraer_Uno 1
|
||||
#define Extraer_Todos 2
|
||||
#define Insertar_Uno 3
|
||||
#define Insertar_Todos 4
|
||||
#define Borra_Uno 5
|
||||
|
||||
long Longitud( const char *File );
|
||||
void Procesa( int Accion, const char *Fich_Origen, char *Fich_Destino );
|
||||
void Ayuda(void) ;
|
||||
void Indica_progreso(int RESET);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char Nombre_del_Programa[70];
|
||||
char Comentario_Inicial[70];
|
||||
|
||||
char VerHi, VerLow;
|
||||
char Register;
|
||||
|
||||
long Records;
|
||||
} CABECERA;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char Wave_Name[13]; // Nombre del Wave
|
||||
char ID_code; // Codigo ID_ del Wave
|
||||
unsigned long Pos; // Posici<63>n de comienzo dentro del archivo destino
|
||||
unsigned long Len; // Longitud
|
||||
} CD_SND;
|
||||
|
||||
|
||||
|
||||
long la;
|
||||
char *Fich_Origen;
|
||||
char *Fich_Destino;
|
||||
char Accion = 0;
|
||||
char ID_Code = -1;
|
||||
|
||||
const char File[][13] = {
|
||||
"CD_OUT00.WAV",
|
||||
"CD_OUT01.WAV",
|
||||
"CD_OUT02.WAV",
|
||||
"CD_OUT03.WAV",
|
||||
"CD_OUT04.WAV",
|
||||
"CD_OUT05.WAV",
|
||||
"CD_OUT06.WAV",
|
||||
"CD_OUT07.WAV",
|
||||
"CD_OUT08.WAV",
|
||||
"CD_OUT09.WAV",
|
||||
"CD_OUT0A.WAV",
|
||||
"CD_OUT0B.WAV",
|
||||
"CD_OUT0C.WAV",
|
||||
"CD_OUT0D.WAV",
|
||||
"CD_OUT0E.WAV",
|
||||
"CD_OUT0F.WAV",
|
||||
"CD_OUT10.WAV",
|
||||
"CD_OUT11.WAV",
|
||||
"CD_OUTFF.WAV"
|
||||
};
|
||||
|
||||
|
||||
void main( int argc, char *argv[] )
|
||||
{
|
||||
int i;
|
||||
clrscr();
|
||||
gotoxy(1,1); textcolor(WHITE); textbackground(BLUE);
|
||||
cprintf("Copyright (c) J.D. System 1995. Jos<6F> David Guill<6C>n Dominguez... CD_Snd v<>1.0");
|
||||
|
||||
// Analizamos parametros
|
||||
if ( argc != 3 )
|
||||
{
|
||||
textbackground(BLACK);
|
||||
gotoxy(1,3);
|
||||
cprintf("Sintaxis: CD_Snd [Comando] [Archivo_Destino] [ID_Code] ");
|
||||
Ayuda();
|
||||
return;
|
||||
} else {
|
||||
|
||||
gotoxy(1,2);
|
||||
cprintf(" Procesando Argumentos ");
|
||||
Indica_progreso(1);
|
||||
la = argc;
|
||||
|
||||
if ( !strncmpi(argv[1], "-U:", 3) )
|
||||
{
|
||||
Fich_Origen = argv[1];
|
||||
Fich_Origen += 3;
|
||||
Accion = Extraer_Uno;
|
||||
Indica_progreso(0);
|
||||
} else
|
||||
if ( !strcmpi(argv[1], "-UA") )
|
||||
{
|
||||
Accion = Extraer_Todos;
|
||||
Indica_progreso(0);
|
||||
} else
|
||||
if ( !strncmpi(argv[1], "-C:", 3) )
|
||||
{
|
||||
Fich_Origen = argv[1];
|
||||
Fich_Origen += 3;
|
||||
Accion = Insertar_Uno;
|
||||
Indica_progreso(0);
|
||||
} else
|
||||
if ( !strcmpi(argv[1], "-CA") )
|
||||
{
|
||||
Accion = Insertar_Todos;
|
||||
Indica_progreso(0);
|
||||
} else
|
||||
if ( !strncmpi(argv[1], "-E:", 3) )
|
||||
{
|
||||
Fich_Origen = argv[1];
|
||||
Fich_Origen += 3;
|
||||
Accion = Borra_Uno;
|
||||
Indica_progreso(0);
|
||||
} else Ayuda();
|
||||
|
||||
Fich_Destino = argv[2];
|
||||
Indica_progreso(0);
|
||||
|
||||
ID_Code = atoi( argv[3] );
|
||||
Indica_progreso(0);
|
||||
}
|
||||
|
||||
Procesa( Accion, File[i], Fich_Destino );
|
||||
/*
|
||||
swicth ( Accion )
|
||||
{
|
||||
case Insertar_Todos:
|
||||
case Extraer_Todos:
|
||||
for ( i=0; i< 19; i++ )
|
||||
{
|
||||
ID_Code = i;
|
||||
Procesa( Accion, &File[i], Fich_Destino );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Procesa( Accion, Fich_Origen, Fich_Destino );
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void Indica_progreso(int RESET){
|
||||
|
||||
static int posx=31; // Posici<63>n de giro //
|
||||
static int giro=0; // Carater para rotar //
|
||||
static long contador = 0;
|
||||
|
||||
if ( RESET ) { contador = 0; gotoxy(1,2); cprintf(" 0%"); return; }
|
||||
contador++;
|
||||
gotoxy(1,2); cprintf("%3d%%", ( (contador*100)/la ) );
|
||||
gotoxy(posx-1,2); posx++;
|
||||
switch(giro){
|
||||
case 0: cprintf(" /"); break;
|
||||
case 1: cprintf(" <20>"); break;
|
||||
case 2: cprintf(" \\"); break;
|
||||
case 3: cprintf(" <20>"); break;
|
||||
}
|
||||
if(posx==79) posx=30;
|
||||
giro++; if(giro==4) giro=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*CD_OUTxx . WAV
|
||||
|
||||
00 Inicio del Programa
|
||||
FF Fin del Programa
|
||||
01 Raton pulsado en algun sitio
|
||||
02 Tecla pulsada para nada
|
||||
03 Tick Generico
|
||||
04 Boton DOS
|
||||
05 Boton Windows
|
||||
06 Select Icono
|
||||
07 Instalar
|
||||
08 Configurar
|
||||
09 Ejecutar
|
||||
0A Ver Dibujo
|
||||
|
||||
0B Si
|
||||
0C No
|
||||
0D Imprimiendo
|
||||
0E Aceptar
|
||||
0F Cancelar
|
||||
10 Salvar al Salir
|
||||
|
||||
11 ERROR DESCONOCIDO
|
||||
|
||||
*/
|
||||
|
||||
void Ayuda(void)
|
||||
{
|
||||
gotoxy(1,5);
|
||||
cprintf("[Comando]\r\n");
|
||||
cprintf(" * -u: Nombre.EXT Saca una copia del fichero compactado\r\n");
|
||||
cprintf(" * -ua Saca una copia de todos los ficheros\r\n") ;
|
||||
cprintf(" * -c: Nombre.EXT Introduce el Archivo Nombre.Ext en Destino\r\n");
|
||||
cprintf(" -ca Introduce todos los Archivos en Destino\r\n") ;
|
||||
cprintf(" * -e: Nombre.EXT Borra el Archivo Nombre.Ext de Destino\r\n\r\n");
|
||||
cprintf(" * Comandos desctivados el la versi<73>n SHAREWARE\r\n\r\n") ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Procesa( int Accion, const char *Fich_Origen, char *Fich_Destino )
|
||||
{
|
||||
FILE *ORIGEN;
|
||||
FILE *DESTINO;
|
||||
CABECERA Cabecera;
|
||||
CD_SND CD_Snd[19];
|
||||
long Pos; int i;
|
||||
|
||||
/*
|
||||
if ( ( ORIGEN = fopen( Fich_Origen, "rb") ) == NULL )
|
||||
{
|
||||
cprintf("\r\nERROR ABRIENDO ORIGEN: %s\r\n", Fich_Origen);
|
||||
exit(1);
|
||||
}
|
||||
*/
|
||||
if ( ( DESTINO = fopen( Fich_Destino, "wb") ) == NULL )
|
||||
{
|
||||
cprintf("\r\nERROR ABRIENDO DESTINO: %s\r\n", Fich_Destino);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sprintf( Cabecera.Nombre_del_Programa, "CD_Snd\nCompactador de Ficheros para CD_Out\n" );
|
||||
sprintf( Cabecera.Comentario_Inicial, "\n\nCD_Out es un programa de Jos<6F> David\nCD_Snd idem%d%d", 7, 26);
|
||||
Cabecera.VerHi = 1;
|
||||
Cabecera.VerLow = 0;
|
||||
Cabecera.Register = 0;
|
||||
Cabecera.Records =19;
|
||||
|
||||
|
||||
fwrite( &Cabecera, sizeof( Cabecera ), 1, DESTINO );
|
||||
Pos = sizeof( Cabecera ) + sizeof( CD_SND) * 19;
|
||||
Indica_progreso(1); la = 19;
|
||||
|
||||
gotoxy(1,2);
|
||||
cprintf(" Creando Esturcturas ");
|
||||
|
||||
for ( i=0; i< 19; i++ )
|
||||
{
|
||||
strcpy(CD_Snd[i].Wave_Name, File[i]); // Nombre del Wave
|
||||
CD_Snd[i].ID_code = i; // Codigo ID_ del Wave
|
||||
CD_Snd[i].Len = Longitud(File[i]);
|
||||
CD_Snd[i].Pos = Pos;
|
||||
Pos += CD_Snd[i].Len;
|
||||
Indica_progreso(0);
|
||||
}
|
||||
|
||||
fwrite( CD_Snd, sizeof( CD_SND ), 19, DESTINO );
|
||||
|
||||
for ( i=0; i< 19; i++ )
|
||||
{
|
||||
// gotoxy(1,4);
|
||||
// cprintf(" Pulse una Tecla para siguiente Archivo -- Version SHAREWARE -- ");
|
||||
// getch();
|
||||
// gotoxy(1,4);
|
||||
// cprintf(" ");
|
||||
|
||||
gotoxy(1,2);
|
||||
cprintf(" Uniendo %13s ", File[i]);
|
||||
Indica_progreso(1); la = CD_Snd[i].Len;
|
||||
gotoxy(1,3);
|
||||
cprintf(" Longitud a procesar %ld ", CD_Snd[i].Len);
|
||||
|
||||
if ( ( ORIGEN = fopen( File[i], "rb") ) != NULL )
|
||||
{
|
||||
Pos = CD_Snd[i].Len;
|
||||
|
||||
while ( Pos > 0 ) { fputc(fgetc(ORIGEN), DESTINO); Indica_progreso(0); Pos--; }
|
||||
|
||||
fclose(ORIGEN);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(DESTINO);
|
||||
|
||||
}
|
||||
|
||||
long Longitud(const char *File )
|
||||
{
|
||||
FILE *file;
|
||||
long devolver;
|
||||
|
||||
if ( (file = fopen( File, "rb")) == NULL )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
devolver = filelength(fileno(file));
|
||||
fclose(file);
|
||||
return devolver;
|
||||
}
|
BIN
CD_SND/CD_SND.EXE
Normal file
BIN
CD_SND/CD_SND.EXE
Normal file
Binary file not shown.
82
CD_SND/CD_TEST.CPP
Normal file
82
CD_SND/CD_TEST.CPP
Normal file
@ -0,0 +1,82 @@
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include "..\CD_SND.H"
|
||||
#include "c:\things\borlandc\jd_lib\wav_lib\wavplay.h"
|
||||
|
||||
|
||||
int Load_Snd(void);
|
||||
void Sonido( char Sonido );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char Nombre_del_Programa[70];
|
||||
char Comentario_Inicial[70];
|
||||
|
||||
char VerHi, VerLow;
|
||||
char Register;
|
||||
|
||||
long Records;
|
||||
} CABECERA;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char Wave_Name[13]; // Nombre del Wave
|
||||
char ID_code; // Codigo ID_ del Wave
|
||||
unsigned long Pos; // Posici<63>n de comienzo dentro del archivo destino
|
||||
unsigned long Len; // Longitud
|
||||
} CD_SND;
|
||||
|
||||
CD_SND CD_Snd[19];
|
||||
|
||||
|
||||
|
||||
int Load_Snd(void)
|
||||
{
|
||||
CABECERA Cabecera;
|
||||
FILE *DESTINO;
|
||||
|
||||
if ( ( DESTINO = fopen( "CD_OUT.SND", "rb") ) == NULL )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
fread( &Cabecera, sizeof( Cabecera ), 1, DESTINO );
|
||||
|
||||
fread( CD_Snd, sizeof( CD_SND ), 19, DESTINO );
|
||||
|
||||
fclose(DESTINO);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
/*<2A>*/cprintf("Inicializando sonidos. "); /*<2A>*/
|
||||
/*<2A>*/ switch ( InitSB() ) { /*<2A>*/
|
||||
/*<2A>*/ case 0: /*<2A>*/
|
||||
/*<2A>*/ cprintf(" --> Speaker Ok!\n\r"); /*<2A>*/
|
||||
/*<2A>*/ break; /*<2A>*/
|
||||
/*<2A>*/ case 1: /*<2A>*/
|
||||
/*<2A>*/ cprintf(" --> Sound Blaster Ok!\n\r"); /*<2A>*/
|
||||
/*<2A>*/ break; /*<2A>*/
|
||||
/*<2A>*/ case 2: /*<2A>*/
|
||||
/*<2A>*/ cprintf(" --> Dac Casero Ok!\n\r"); /*<2A>*/
|
||||
/*<2A>*/ break; /*<2A>*/
|
||||
/*<2A>*/ } /*<2A>*/
|
||||
|
||||
Load_Snd();
|
||||
|
||||
cprintf("\n\rFichero Posici<63>n Longitud ID_Code\n\r");
|
||||
for( int Sonido=0; Sonido < 19; Sonido++ )
|
||||
{
|
||||
while( kbhit() ) getch();
|
||||
|
||||
cprintf("%s %8ld %8ld %d\n\r", CD_Snd[Sonido].Wave_Name, CD_Snd[Sonido].Pos,
|
||||
CD_Snd[Sonido].Len, (int)CD_Snd[Sonido].ID_code);
|
||||
|
||||
if ( PlayWav((char far *)"CD_OUT.SND", CD_Snd[Sonido].Pos, CD_Snd[Sonido].Len ) == -1 )
|
||||
PlayLongWav((char far *)"CD_OUT.SND", CD_Snd[Sonido].Pos, CD_Snd[Sonido].Len );
|
||||
|
||||
while( kbhit() ) getch();
|
||||
}
|
||||
}
|
||||
|
BIN
CD_SND/CD_TEST.EXE
Normal file
BIN
CD_SND/CD_TEST.EXE
Normal file
Binary file not shown.
BIN
CD_SND/CD_TEST.PRJ
Normal file
BIN
CD_SND/CD_TEST.PRJ
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT00.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT00.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT01.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT01.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT02.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT02.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT03.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT03.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT04.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT04.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT07.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT07.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT08.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT08.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT09.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT09.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT0A.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT0A.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT0B.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT0B.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT0C.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT0C.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT0D.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT0D.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT0E.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT0E.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT0F.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT0F.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT10.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT10.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUT11.WAV
Normal file
BIN
CD_SND/WAV/CD_OUT11.WAV
Normal file
Binary file not shown.
BIN
CD_SND/WAV/CD_OUTFF.WAV
Normal file
BIN
CD_SND/WAV/CD_OUTFF.WAV
Normal file
Binary file not shown.
Reference in New Issue
Block a user