home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix Heaven Sunny 2
/
APPARE2.BIN
/
oh_towns
/
taropyon
/
he386
/
ccisrc
/
tg300me.c
< prev
next >
Wrap
Text File
|
1995-06-20
|
16KB
|
645 lines
/*************************************************************************
* TG300 MULTI EFFECT
*************************************************************************/
/*************************************************************************
* CHORUS TYPE
*-------------------------------------------------------------------------
* exTG300_chorusType(type)
* type … 0~7
*************************************************************************/
int exTG300_chorusType( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
int v;
if ( argc != 1 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"CHORUS TYPE\" error!");
return(ERR);
}
v = atoi(argv[0]);
if ( v < 0 || v > 7 )
goto _ERR;
dat[0] = v;
return tg300_genMML( sqr, bufSiz, buf, 0x010000, 1, dat );
}
/*************************************************************************
* VARIATION TYPE
*-------------------------------------------------------------------------
* exTG300_variationType(type)
* type … 0~25
*************************************************************************/
int exTG300_variationType( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
int v;
if ( argc != 1 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"VARIATION TYPE\" error!");
return(ERR);
}
v = atoi(argv[0]);
if ( v < 0 || v > 0x19 )
goto _ERR;
dat[0] = v;
return tg300_genMML( sqr, bufSiz, buf, 0x010001, 1, dat );
}
/*************************************************************************
* Pre-VARIATION TYPE
*-------------------------------------------------------------------------
* exTG300_preVariationType(type)
* type … 0~4
*************************************************************************/
int exTG300_preVariationType( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
int v;
if ( argc != 1 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"Pre-VARIATION TYPE\" error!");
return(ERR);
}
v = atoi(argv[0]);
if ( v < 0 || v > 4 )
goto _ERR;
dat[0] = v;
return tg300_genMML( sqr, bufSiz, buf, 0x010002, 1, dat );
}
/*************************************************************************
* Pre-REVERB TYPE
*-------------------------------------------------------------------------
* exTG300_preReverbType(type)
* type … 0~5
*************************************************************************/
int exTG300_preReverbType( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
int v;
if ( argc != 1 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"Pre-REVERB TYPE\" error!");
return(ERR);
}
v = atoi(argv[0]);
if ( v < 0 || v > 5 )
goto _ERR;
dat[0] = v;
return tg300_genMML( sqr, bufSiz, buf, 0x010003, 1, dat );
}
/*************************************************************************
* REVERB TYPE
*-------------------------------------------------------------------------
* exTG300_reverbType(type)
* type … 0~11
*************************************************************************/
int exTG300_reverbType( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
int v;
if ( argc != 1 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"REVERB TYPE\" error!");
return(ERR);
}
v = atoi(argv[0]);
if ( v < 0 || v > 0x0B )
goto _ERR;
dat[0] = v;
return tg300_genMML( sqr, bufSiz, buf, 0x010004, 1, dat );
}
/*************************************************************************
* EFFECT INPUT
*-------------------------------------------------------------------------
* exTG300_effectInput(0,rev,cho,var)
*-------------------------------------------------------------------------
* exTG300_effectInput(type,input)
* type … 1:Reverb
* 2:Chorus
* 3:Variation
* input … 0 ~127
*************************************************************************/
int exTG300_effectInput( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
size_t adr, siz;
int rev, cho, var;
if ( argc < 2 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"Effect Input\" error!");
return(ERR);
}
switch ( atoi(argv[0]) )
{
case 0:
if ( argc != 4 )
goto _ERR;
rev = atoi(argv[1]); if ( rev < 0 || rev > 127 ) goto _ERR;
cho = atoi(argv[2]); if ( cho < 0 || cho > 127 ) goto _ERR;
var = atoi(argv[3]); if ( var < 0 || var > 127 ) goto _ERR;
dat[0] = rev;
dat[1] = cho;
dat[2] = var;
adr = 0x010005;
siz = 3;
break;
case 1:
rev = atoi(argv[1]);
if ( rev < 0 || rev > 127 )
goto _ERR;
dat[0] = rev;
adr = 0x010005;
siz = 1;
break;
case 2:
cho = atoi(argv[1]);
if ( cho < 0 || cho > 127 )
goto _ERR;
dat[0] = cho;
adr = 0x010006;
siz = 1;
break;
case 3:
var = atoi(argv[1]);
if ( var < 0 || var > 127 )
goto _ERR;
dat[0] = var;
adr = 0x010007;
siz = 1;
break;
default:
goto _ERR;
}
return tg300_genMML( sqr, bufSiz, buf, adr, siz, dat );
}
/*************************************************************************
* DRY Level
*-------------------------------------------------------------------------
* exTG300_dryLevel(level)
* level … 0~127
*************************************************************************/
int exTG300_dryLevel( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
int v;
if ( argc != 1 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"DRY level\" error!");
return(ERR);
}
v = atoi(argv[0]);
if ( v < 0 || v > 127 )
goto _ERR;
dat[0] = v;
return tg300_genMML( sqr, bufSiz, buf, 0x010008, 1, dat );
}
/*************************************************************************
* EFFECT RETURN
*-------------------------------------------------------------------------
* exTG300_effectReturn(0,rev,cho,var)
*-------------------------------------------------------------------------
* exTG300_effectReturn(type,input)
* type … 1:Reverb
* 2:Chorus
* 3:Variation
* input … 0 ~127
*************************************************************************/
int exTG300_effectReturn( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
size_t adr, siz;
int rev, cho, var;
if ( argc < 2 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"Effect Return\" error!");
return(ERR);
}
switch ( atoi(argv[0]) )
{
case 0:
if ( argc != 4 )
goto _ERR;
rev = atoi(argv[1]); if ( rev < 0 || rev > 127 ) goto _ERR;
cho = atoi(argv[2]); if ( cho < 0 || cho > 127 ) goto _ERR;
var = atoi(argv[3]); if ( var < 0 || var > 127 ) goto _ERR;
dat[0] = rev;
dat[1] = cho;
dat[2] = var;
adr = 0x010009;
siz = 3;
break;
case 1:
rev = atoi(argv[1]);
if ( rev < 0 || rev > 127 )
goto _ERR;
dat[0] = rev;
adr = 0x010009;
siz = 1;
break;
case 2:
cho = atoi(argv[1]);
if ( cho < 0 || cho > 127 )
goto _ERR;
dat[0] = cho;
adr = 0x01000A;
siz = 1;
break;
case 3:
var = atoi(argv[1]);
if ( var < 0 || var > 127 )
goto _ERR;
dat[0] = var;
adr = 0x01000B;
siz =1;
break;
default:
goto _ERR;
}
return tg300_genMML( sqr, bufSiz, buf, adr, siz, dat );
}
/*************************************************************************
* EFFECT SEND
*-------------------------------------------------------------------------
* exTG300_effectSend(0,var2cho,var2rev,cho2rev)
*-------------------------------------------------------------------------
* exTG300_effectReturn(type,send)
* type … 1:var2cho
* 2:var2rev
* 3:cho2rev
* send … 0 ~127
*************************************************************************/
int exTG300_effectSend( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
size_t adr, siz;
int var2cho, var2rev, cho2rev;
if ( argc < 2 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"Effect Send\" error!");
return(ERR);
}
switch ( atoi(argv[0]) )
{
case 0:
if ( argc != 4 )
goto _ERR;
var2cho = atoi(argv[1]); if ( var2cho < 0 || var2cho > 127 ) goto _ERR;
var2rev = atoi(argv[2]); if ( var2rev < 0 || var2rev > 127 ) goto _ERR;
cho2rev = atoi(argv[3]); if ( cho2rev < 0 || cho2rev > 127 ) goto _ERR;
dat[0] = var2cho;
dat[1] = var2rev;
dat[2] = cho2rev;
adr = 0x01000C;
siz = 3;
break;
case 1:
var2cho = atoi(argv[1]);
if ( var2cho < 0 || var2cho > 127 )
goto _ERR;
dat[0] = var2cho;
adr = 0x01000C;
siz = 1;
break;
case 2:
var2rev = atoi(argv[1]);
if ( var2rev < 0 || var2rev > 127 )
goto _ERR;
dat[0] = var2rev;
adr = 0x01000D;
siz = 1;
break;
case 3:
cho2rev = atoi(argv[1]);
if ( cho2rev < 0 || cho2rev > 127 )
goto _ERR;
dat[0] = cho2rev;
adr = 0x01000E;
siz = 1;
break;
default:
goto _ERR;
}
return tg300_genMML( sqr, bufSiz, buf, adr, siz, dat );
}
/*************************************************************************
* CHORUS Parameter
*-------------------------------------------------------------------------
* exTG300_choParam(0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10)
*-------------------------------------------------------------------------
* exTG300_choParam(typ,p)
* typ … 1~10
* p … 0~127
*************************************************************************/
int exTG300_choParam( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[16];
size_t adr, siz;
int typ, v, i;
if ( argc < 2 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"CHORUS Parameter\" error!");
return(ERR);
}
typ = atoi(argv[0]);
if ( typ < 0 || typ > 10 )
goto _ERR;
if ( typ == 0 )
{ /* ALL PARAMETER */
if ( argc != 11 )
goto _ERR;
for ( i = 0; i < 10; ++i )
{
v = atoi(argv[i+1]);
if ( v < 0 || v > 0x7F )
goto _ERR;
dat[i] = v;
}
adr = 0x01000F;
siz = 10;
} else
{
if ( argc != 2 )
goto _ERR;
v = atoi(argv[i+1]);
if ( v < 0 || v > 0x7F )
goto _ERR;
dat[0] = v;
adr = 0x01000F + typ - 1;
siz = 1;
}
return tg300_genMML( sqr, bufSiz, buf, adr, siz, dat );
}
/*************************************************************************
* VARIATION Parameter
*-------------------------------------------------------------------------
* exTG300_varParam(0,p1msb,p2lsb ...p5msb,65lsb, p6…p10)
*-------------------------------------------------------------------------
* exTG300_varParam(typ,msb,lsb)
* typ … 1~5
* msb … 0~127
* lsb … 0~127
*-------------------------------------------------------------------------
* exTG300_varParam(typ,p)
* typ … 6~10
* p … 0~127
*************************************************************************/
int exTG300_varParam( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[32];
size_t adr, siz;
int typ, v, i;
if ( argc < 3 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"VARIATION Parameter\" error!");
return(ERR);
}
typ = atoi(argv[0]);
if ( typ < 0 || typ > 10 )
goto _ERR;
if ( typ == 0 )
{ /* ALL PARAMETER */
if ( argc != 21 )
goto _ERR;
for ( i = 0; i < 5; ++i )
{
v = atoi(argv[i*2+1]); if ( v < 0 || v > 0x7F ) goto _ERR;
dat[i*2 ] = v;
v = atoi(argv[i*2+2]); if ( v < 0 || v > 0x7F ) goto _ERR;
dat[i*2+1] = v;
}
for ( i = 0; i < 5; ++i )
{
v = atoi(argv[11+i]); if ( v < 0 || v > 0x7F ) goto _ERR;
dat[10+i] = v;
}
adr = 0x010019;
siz = 15;
} else
{
if ( typ <= 5 )
{ /* LSB & MSB */
if ( argc != 3 )
goto _ERR;
v = atoi(argv[1]); if ( v < 0 || v > 0x7F ) goto _ERR;
dat[0] = v;
v = atoi(argv[2]); if ( v < 0 || v > 0x7F ) goto _ERR;
dat[1] = v;
adr = 0x010019 + (typ - 1)*2;
siz = 2;
} else
{ /* typ 6~10 */
if ( argc != 2 )
goto _ERR;
v = atoi(argv[1]); if ( v < 0 || v > 0x7F ) goto _ERR;
dat[0] = v;
adr = 0x010023 + typ - 6;
siz = 1;
}
}
return tg300_genMML( sqr, bufSiz, buf, adr, siz, dat );
}
/*************************************************************************
* Pre-VARIATION Parameter
*-------------------------------------------------------------------------
* exTG300_preVarParam(0,p1,p2,p3,p4,p5,p6,p7,p8)
*-------------------------------------------------------------------------
* exTG300_preVarParam(typ,p)
* typ … 1~10
* p … 0~127
*************************************************************************/
int exTG300_preVarParam( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[16];
size_t adr, siz;
int typ, v, i;
if ( argc < 2 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"Pre-VARIATION Parameter\" error!");
return(ERR);
}
typ = atoi(argv[0]);
if ( typ < 0 || typ > 8 )
goto _ERR;
if ( typ == 0 )
{ /* ALL PARAMETER */
if ( argc != 9 )
goto _ERR;
for ( i = 0; i < 8; ++i )
{
v = atoi(argv[i+1]);
if ( v < 0 || v > 0x7F )
goto _ERR;
dat[i] = v;
}
adr = 0x010028;
siz = 8;
} else
{
if ( argc != 2 )
goto _ERR;
v = atoi(argv[1]);
if ( v < 0 || v > 0x7F )
goto _ERR;
dat[0] = v;
adr = 0x010028 + typ - 1;
siz = 1;
}
return tg300_genMML( sqr, bufSiz, buf, adr, siz, dat );
}
/*************************************************************************
* Pre-REVERB Parameter
*-------------------------------------------------------------------------
* exTG300_preRevParam(0,p1,p2,p3,p4,p5,p6,p7,p8)
*-------------------------------------------------------------------------
* exTG300_preRevParam(typ,p)
* typ … 1~10
* p … 0~127
*************************************************************************/
int exTG300_preRevParam( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[16];
size_t adr, siz;
int typ, v, i;
if ( argc < 2 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"Pre-REVERB Parameter\" error!");
return(ERR);
}
typ = atoi(argv[0]);
if ( typ < 0 || typ > 9 )
goto _ERR;
if ( typ == 0 )
{ /* ALL PARAMETER */
if ( argc != 10 )
goto _ERR;
for ( i = 0; i < 9; ++i )
{
v = atoi(argv[i+1]);
if ( v < 0 || v > 0x7F )
goto _ERR;
dat[i] = v;
}
adr = 0x010032;
siz = 8;
} else
{
if ( argc != 2 )
goto _ERR;
v = atoi(argv[i+1]);
if ( v < 0 || v > 0x7F )
goto _ERR;
dat[0] = v;
adr = 0x010032 + typ - 1;
siz = 1;
}
return tg300_genMML( sqr, bufSiz, buf, adr, siz, dat );
}
/*************************************************************************
* REVERB Parameter
*-------------------------------------------------------------------------
* exTG300_revParam(0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10)
*-------------------------------------------------------------------------
* exTG300_revParam(typ,p)
* typ … 1~10
* p … 0~127
*************************************************************************/
int exTG300_revParam( char *sqr, size_t bufSiz, char *buf, int argc, char **argv )
{
char dat[16];
size_t adr, siz;
int typ, v, i;
if ( argc < 2 )
{
_ERR: MM_setErrMsg(sqr,"TG300 \"REVERB Parameter\" error!");
return(ERR);
}
typ = atoi(argv[0]);
if ( typ < 0 || typ > 10 )
goto _ERR;
if ( typ == 0 )
{ /* ALL PARAMETER */
if ( argc != 11 )
goto _ERR;
for ( i = 0; i < 10; ++i )
{
v = atoi(argv[i+1]);
if ( v < 0 || v > 0x7F )
goto _ERR;
dat[i] = v;
}
adr = 0x01003C;
siz = 10;
} else
{
if ( argc != 2 )
goto _ERR;
v = atoi(argv[i+1]);
if ( v < 0 || v > 0x7F )
goto _ERR;
dat[0] = v;
adr = 0x01003C + typ - 1;
siz = 1;
}
return tg300_genMML( sqr, bufSiz, buf, adr, siz, dat );
}