home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Audio 4.94 - Over 11,000 Files
/
audio-11000.iso
/
amiga
/
midi
/
med210.lhw
/
in.adf
/
Source
/
med210src.lzh
/
med-newmsgh.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-07-14
|
24KB
|
795 lines
/* MED - musiikkieditori ⌐ 1989, 1990 by Teijo Kinnunen */
#include <hardware/custom.h>
#include "med.h"
#include "medproto.h"
#define SHIFT (IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT)
#define ALT (ALTLEFT|ALTRIGHT)
extern struct CIA far ciaa;
extern struct Custom far custom;
extern struct Image eq1image;
extern struct RastPort *wrp;
extern struct Kappale far song;
extern struct Window *window,*pw;
extern struct NewWindow far pnw;
extern struct Screen *screen;
extern struct StringInfo strinfo[];
extern struct PropInfo far propinfo[];
extern struct Image far kuviot,far loadgadgimg,far savegadgimg;
extern struct Gadget far gadget1[],far gadget2[],far gadget3[],far gadget4[];
extern struct Gadget far gadget5[],far gadget6[],far gadget9[],far *glists[];
extern struct Gadget far gadget7[],far gadgetA[];
extern UWORD *imgdataptr[],far nappokt,chip mouse0[],chip mouse1[],lastrep,lastreplen;
extern BOOL updscrflag,trackon[];
extern LONG eq1strt0;
extern char kappaleennimi[];
extern UBYTE firstdisptrk,thiscol,counter,lastmidic,lastmidip;
UWORD nykyinenosio;
UBYTE far midiactive = 0;
UBYTE blocks,samplenum = 0,cursorx = 4,currtrk = 0,currpos = 0;
BOOL ilmoitusnakyy = FALSE;
UWORD volatile tempo = 60,pblock,pseqnum,pstate,pline;
WORD volatile actplayline;
struct Lohko far *lohko[100];
static BOOL __regargs Handle7(UWORD);
static void __regargs Handle2(UWORD),Handle3(UWORD),Handle4(UWORD);
static void __regargs Handle5(UWORD),Handle6(UWORD),HandlePlainKey(UWORD,UWORD);
static void __regargs Handle9(UWORD),HandleA(UWORD);
static void __regargs KasitteleNappain(void);
static BOOL __regargs KasitteleGadget(void);
static UBYTE waitsomething;
static char *abouttxt[] = { "MED V2.10 ⌐1990 by Teijo Kinnunen",
"Address: Oksantie 19...","SF-86300 OULAINEN, FINLAND",
"IFF 8SVX loader by S. Hayes","Unauthorized copying of...",
"...MED V2.10 is absolutely...","...allowed (surprise!!)",
"---- Greetings: -----","Greetings to Erkki (again...)...",
"...and to everybody else." };
static UWORD pb2,pl2,psn2;
extern ULONG class;
extern UWORD code,qual;
extern WORD mousey;
extern APTR iaddr;
BOOL KasitteleViesti()
{
if(waitsomething) {
if(waitsomething == 1 && pw) {
if(class == MOUSEBUTTONS && code == SELECTUP) return(0);
eq1strt0 = 0L; CloseWindow(pw); pw = NULL;
Korosta(&gadget3[6],(BOOL)eq1strt0); }
waitsomething = 0;
}
if(ilmoitusnakyy && (!(class == MOUSEBUTTONS && code ==
SELECTUP) && (class != RAWKEY || (class == RAWKEY &&
!(code & 0x80))))) Ilmoita(NULL);
Disable();
pb2 = pblock; /* copy these variables here, so they won't */
pl2 = pline; /* change during handling */
psn2 = pseqnum;
Enable();
switch(class) {
case RAWKEY:
KasitteleNappain();
break;
case GADGETDOWN:
case GADGETUP:
return(KasitteleGadget());
case MOUSEBUTTONS:
if(!HandleMBs() && (code == MENUDOWN ||
(code == SELECTDOWN && mousey < 11))) {
ShowTitle(screen,updscrflag);
if(!(updscrflag = !updscrflag)) {
RemEqualizer();
RemCopperList();
if(screen->Height >= 256) eq1strt0 = 0L;
if(gadget3[22].GadgetID & 0x1000) InitDisp();
} else {
if(gadget3[21].GadgetID & 0x1000)
InitEqualizer();
if(gadget3[6].GadgetID & 0x1000 &&
screen->Height >= 256)
eq1strt0 = (LONG)(screen
->BitMap.Planes[0]+8484);
if(gadget3[22].GadgetID & 0x1000) InitDisp();
}
}
}
return(0); /* ei lopu */
}
static BOOL __regargs KasitteleGadget()
{
UWORD gid = (((struct Gadget *)iaddr)->GadgetID) & 0xfff;
switch(gid & 0xf00) {
case 0x100: OsionValinta((struct Gadget *)iaddr); break;
case 0x200: Handle2(gid); break;
case 0x300: Handle3(gid); break;
case 0x400: Handle4(gid); break;
case 0x500: Handle5(gid); break;
case 0x600: Handle6(gid); break;
case 0x700: return(Handle7(gid)); break;
case 0x800: Handle8(gid); break;
case 0x900: Handle9(gid); break;
case 0xA00: HandleA(gid); break;
case 0xB00: HandleB(gid); break;
case 0xF00:
if(gid == 0xF00) Handle6(0x600);
else if(gid == 0xF01) Handle6(0x601);
else if(gid == 0xF02) {
if(nappokt < 3) Handle6((UWORD)(nappokt + 0x613));
else Handle6(0x612);
}
}
return(0);
}
static void __regargs KasitteleNappain()
{
UBYTE ntrks;
if(qual & IEQUALIFIER_CONTROL) {
switch(code) {
case 0x05: case 0x06:
if(qual & SHIFT) EditHandler((UWORD)(code+0x100));
else Handle3((UWORD)(0x302 + code));
break;
case CURSORLEFT:
if(firstdisptrk > 4) firstdisptrk -= 4;
else if(firstdisptrk) firstdisptrk = 0;
else firstdisptrk = lohko[pb2]->numtracks - 4;
currtrk = firstdisptrk + currpos;
PaivitaNaytto(TRUE); DispInfoGadgets();
break;
case CURSORRIGHT:
ntrks = lohko[pb2]->numtracks;
if(firstdisptrk == ntrks - 4)
firstdisptrk = 0;
else if(firstdisptrk + 4 > ntrks - 4)
firstdisptrk = ntrks - 4;
else firstdisptrk += 4;
currtrk = firstdisptrk + currpos;
PaivitaNaytto(TRUE); DispInfoGadgets();
break;
case 0x3E: Handle3(0x30C); break;
case 0x1E: Handle3(0x30D); break;
case 0x3D: Handle3(0x30E); break;
case 0x1D: Handle3(0x30F); break;
case 0x2D: Handle3(0x311); break;
case 0x2F: Handle3(0x310); break;
case 0x0F: Handle3(0x312); break;
case 0x3C: Handle3(0x313); break;
case 0x2E: Handle3(0x314); break;
case 0x20: Handle6(0x619); break;
case 0x23: DspFreeMem(); break;
case 0x40: ResetMIDI(); break;
case 0x13: RetFileName(); break;
case 0x37: SetMark(); break;
case 0x32: case 0x33: case 0x34:
HandleMark((UBYTE)code); break;
default: if((qual & SHIFT) && code >= 0x01 &&
code <= 0x0A) EditHandler((UWORD)(code+0x100));
else if(code >= 0x50 && code <= 0x59)
OsionValinta(&gadget1[code - 0x50]);
else HandlePlainKey(code,qual);
}
}
else if(qual & AMIGAKEYS) {
if(code == 0x28) Handle2(0x214);
else if(code == 0x17) {
OsionValinta(&gadget1[2]);
if(qual & SHIFT) {
UWORD pos = RemoveGadget(window,&gadget4[7]);
song.sample[samplenum].sname[0] = 0;
AddGadget(window,&gadget4[7],pos);
RefreshGList(&gadget4[7],window,NULL,1);
}
ActivateGadget(&gadget4[7],window,NULL);
}
else if(code == 0x23) Handle3(0x305);
else if(code == 0x26) Handle4(0x406);
else if(code == 0x33) Handle5((UWORD)(qual&SHIFT?0x504:0x500));
else if(code == 0x32) Handle5((UWORD)(qual&SHIFT?0x505:0x501));
else if(code == 0x34) Handle5((UWORD)(qual&SHIFT?0x506:0x502));
else if(code == 0x14) DoSlide((UBYTE)(qual & SHIFT ? 1:0));
else if(code == 0x19) Handle3(0x300);
else if(code == 0x13 && nykyinenosio == 4)
ActivateGadget(&gadget4[8],window,NULL);
else HandlePlainKey(code,qual);
}
else if((qual & SHIFT) && (qual & ALT)) {
if(code >= 0x50 && code <= 0x59) Ilmoita(abouttxt[code-0x50]);
else if(code == 0x40) Handle3(0x300);
else HandlePlainKey(code,qual);
}
else if(qual & SHIFT) {
switch(code) {
case 0x40: Handle3(0x303); break;
case 0x1D: case 0x1E: case 0x1F:
Handle6((UWORD)(0x5ED+code)); break;
case 0x2D: case 0x2E: case 0x2F:
Handle6((UWORD)(0x5E0+code)); break;
case 0x3D: case 0x3E: case 0x3F:
Handle6((UWORD)(0x5D3+code)); break;
default:
if((code >= 0x01 && code <= 0x0A) ||
code == 0x46)
EditHandler(code);
else HandlePlainKey(code,qual);
}
}
else if(qual & ALT) {
BYTE slsteps[] = { -1,1,5 };
switch(code) {
case 0x40: Handle3(0x304); break;
case 0x1D: case 0x1E: case 0x1F:
ScrollSLDown(slsteps[code - 0x1D]); break;
case 0x3D: case 0x3E: case 0x3F:
ScrollSLUp(slsteps[code - 0x3D]); break;
case 0x2D: HandleB(0xB03); break;
case 0x2E: LoadSelectedSample(); break;
case 0x2F: HandleB(0xB04); break;
default: HandlePlainKey(code,qual);
}
}
else if(code == 0x40) Handle3(0x302); /* Stop playing */
else HandlePlainKey(code,qual);
}
static void __regargs HandlePlainKey(UWORD code,UWORD qual)
{
switch(code) {
case CURSORUP:
if(qual & SHIFT) { if(pb2) pblock = pb2 - 1; }
else if(qual & ALT) pblock = 0;
else {
Disable(); /* bulletproof (or is it??) */
if((gadget6[1].GadgetID & 0x1000) &&
!(pline & 0x01) && pline-- <= 0)
pline = lohko[pblock]->lines;
if(pline-- <= 0) pline = lohko[pblock]->lines;
actplayline = pline - 1;
Enable();
}
if(qual & (SHIFT|ALT)) {
pline = 0;
actplayline = -1;
}
PaivitaNaytto(FALSE);
break;
case CURSORDOWN:
if(qual & SHIFT) { if(pb2 < blocks - 1) pblock = pb2 + 1; }
else if(qual & ALT) pblock = blocks - 1;
else {
Disable();
if((gadget6[1].GadgetID & 0x1000) &&
!(pline & 0x01)) pline++;
if(++pline > lohko[pblock]->lines)
pline -= lohko[pblock]->lines + 1;
actplayline = pline - 1;
Enable();
}
if(qual & (SHIFT|ALT)) {
pline = 0;
actplayline = -1;
}
PaivitaNaytto(FALSE);
break;
case CURSORLEFT:
if(qual & SHIFT) {
if(qual & ALT) {
if(samplenum >= 16) samplenum -= 16;
else samplenum = 0;
PaivitaSoittimennimi();
} else EdSoitin();
} else MoveCursor((BYTE)-1,qual);
break;
case CURSORRIGHT:
if(qual & SHIFT) {
if(qual & ALT) {
if(samplenum <= 46) samplenum += 16;
else samplenum = 62;
PaivitaSoittimennimi();
} else SeurSoitin();
} else MoveCursor(1,qual);
break;
case 0x50: case 0x51: case 0x52: case 0x53:
Handle6((UWORD)(0x5C2+code)); break;
case 0x55: case 0x56: case 0x57: case 0x58: case 0x59:
F6_10(code,pb2); break;
case 0x45: /* Esc */ Handle6(0x600); break;
case 0x1D: case 0x1E: case 0x1F:
Handle6((UWORD)(0x5E5+code)); break;
case 0x2D: case 0x2E: case 0x2F:
Handle6((UWORD)(0x5D8+code)); break;
case 0x3D: case 0x3E: case 0x3F:
Handle6((UWORD)(0x5CB+code)); break;
case 0x5F: Ilmoita("Try Shift+Alt+F1-10!!!"); break;
case 0: Handle6(0x601); break; /* 2╫space */
case 0x42: HLLine(pb2,(UBYTE)pl2); PaivitaNaytto(TRUE); break;
default:
SoitaNappain(code,TRUE,qual);
}
}
void OsionValinta(struct Gadget *gd)
{
UWORD edno = nykyinenosio;
struct Gadget *scangptr;
if((gd->GadgetID & 0xff) == nykyinenosio) return; /* ei nykyistΣ */
Forbid(); /* this may be not necessary, but for to be sure... */
if(gadget1[12].NextGadget) RemoveGList(window,gadget1[12].NextGadget,-1);
nykyinenosio = 1; /* Korosta() tarkistaa nykyisen osion */
if(edno) Korosta(&gadget1[edno - 2],FALSE);
edno = gd->GadgetID & 0xff;
Korosta(&gadget1[edno-2],TRUE);
nykyinenosio = edno;
kuviot.ImageData = imgdataptr[nykyinenosio];
DrawImage(&(screen->RastPort),&kuviot,5,18);
if(nykyinenosio == 2) {
if(gadget2[10].GadgetID & 0x1000)
DrawImage(&(screen->RastPort),&loadgadgimg,162,19);
else DrawImage(&(screen->RastPort),&savegadgimg,162,19);
}
for(scangptr = glists[nykyinenosio];scangptr;scangptr = scangptr->NextGadget)
if(scangptr->GadgetID & 0x1000) { /* on korostettu */
scangptr->GadgetID &= ~0x1000; /* korostus pois */
Korosta(scangptr,TRUE); /* ja korostetaan taas */
}
AddGList(window,glists[nykyinenosio],-1,-1,NULL);
RefreshGList(glists[nykyinenosio],window,NULL,-1);
Permit();
switch(nykyinenosio) { /* osiokohtainen nΣyt÷npΣivitys */
case 0x2:
UpdateFReqDsp(); break;
case 0x5: ShowLineNum();
case 0x4: case 0x9: /* soitin, lohko, midi */
PaivitaSoittimennimi(); break;
case 0x3: /* soitto */
TulostaSoittoLohkot(); ShowTempo(); break;
case 0x6: DispPrgData(); break;
case 0x7: /* muut - lootien vΣrit kohdalleen */
SetAPen(wrp,4); RectFill(wrp,55,52,62,59);
SetAPen(wrp,5); RectFill(wrp,65,52,72,59);
SetAPen(wrp,6); RectFill(wrp,75,52,82,59);
SetAPen(wrp,7); RectFill(wrp,85,52,92,59);
SetAPen(wrp,0); DrawColorGadgets((BYTE)-1);
GetUndoColors(); break;
case 0x8: ShowVols(); break;
case 0xA: PlayTransp(song.playtransp); break;
case 0xB: DisplayPathList(); DisplayDirName();
}
}
static void __regargs Handle2(UWORD gid) /* tiedostot */
{
char *fres;
switch(gid) {
case 0x20A:
Korosta(&gadget2[10],TRUE);
Korosta(&gadget2[11],FALSE);
DrawImage(&(screen->RastPort),&loadgadgimg,162,19);
RemoveGList(window,gadget2[16].NextGadget,-1);
AddGList(window,&gadget2[17],-1,-1,NULL);
break;
case 0x20B:
Korosta(&gadget2[10],FALSE);
Korosta(&gadget2[11],TRUE);
DrawImage(&(screen->RastPort),&savegadgimg,162,19);
RemoveGList(window,gadget2[16].NextGadget,-1);
AddGList(window,&gadget2[20],-1,-1,NULL);
break;
case 0x214: case 0x215: case 0x216: case 0x217: case 0x218:
Handle3(0x302); /* Stop playing!!! */
StartLoad();
switch(gid) {
case 0x214: fres = LoadSong(kappaleennimi);
break;
case 0x215: strcpy(song.sample[samplenum].sname,kappaleennimi);
lastrep = lastreplen = 0;
lastmidic = lastmidip = 0;
fres = LoadInstrument(kappaleennimi,FALSE);
if(fres == NOERR) SampleLoaded();
break;
case 0x216: fres = STModLoader(kappaleennimi);
break;
case 0x217: fres = DoSave(); break;
case 0x218: fres = SaveRawSample(kappaleennimi);
break;
}
ClrFileName();
StopLoad();
diskerr(fres);
break;
case 0x219: fres = DelFile();
diskerr(fres);
case 0x209: break;
default:
FReqHandler(gid);
}
}
static void __regargs Handle3(UWORD gid) /* soitto */
{
UWORD edpstate = pstate;
switch(gid) {
case 0x300: /* Soita kappale */
pline = psn2 = pseqnum = 0;
actplayline = -1;
case 0x303: /* Jatka kappaletta */
pstate = SOITAKAPPALE;
pblock = song.playseq[psn2];
Korosta(&gadget3[0],TRUE);
Korosta(&gadget3[1],FALSE);
if(edpstate == ALASOITA) {
actplayline = pline - 1;
ciaa.ciacra |= CIACRAF_START;
}
break;
case 0x301: /* Soita lohkoa */
pline = 0;
actplayline = -1;
case 0x304: /* Jatka lohkoa */
pstate = SOITALOHKO;
Korosta(&gadget3[0],FALSE);
Korosta(&gadget3[1],TRUE);
if(edpstate == ALASOITA) {
actplayline = pline - 1;
ciaa.ciacra |= CIACRAF_START;
}
break;
case 0x302: /* Soitto seis!! */
pstate = ALASOITA;
Korosta(&gadget3[0],FALSE);
Korosta(&gadget3[1],FALSE);
SammutaAanet(999);
SetPointer(window,&mouse1[0],23,16,-1,0);
if(qual & SHIFT) {
SetCmd(pb2,pl2,currtrk,0xFFE);
PaivitaNaytto(TRUE);
}
break;
case 0x305: /* Suodatin */
if(qual & SHIFT) {
SetCmd(pb2,pl2,currtrk,(UWORD)(song.flags
& FLAG_FILTERON ? 0xFF9 : 0xFF8));
PaivitaNaytto(TRUE);
} else {
song.flags ^= FLAG_FILTERON;
AsetaSuodatin();
}
break;
case 0x306:
Toggle(&gadget3[6]);
if(updscrflag) {
if(gadget3[6].GadgetID & 0x1000) {
if(screen->Height >= 256) eq1strt0 =
(LONG)(screen->BitMap.Planes[0]+8484);
else if(pw = OpenWindow(&pnw)) {
DrawImage(pw->RPort,&eq1image,0,0);
eq1strt0=(LONG)(screen->BitMap.Planes[0]+1124);
waitsomething = 1; }
} else if(screen->Height >= 256) eq1strt0 = 0L;
}
break;
case 0x307:
song.flags |= FLAG_STSLIDE;
DispVolAndSldType();
break;
case 0x308:
song.flags &= ~FLAG_STSLIDE;
DispVolAndSldType();
break;
case 0x309: ChgTempo((UWORD)((propinfo[1].HorizPot + 137) /
274 + 1)); break;
case 0x30A: if(tempo > 1) ChgTempo((UWORD)(tempo - 1)); break;
case 0x30B: if(tempo < 240) ChgTempo((UWORD)(tempo + 1)); break;
case 0x30C: if(psn2) pseqnum = psn2 - 1; break;
case 0x30D: if(psn2 < song.songlen) pseqnum = psn2 + 1; break;
case 0x30E: pseqnum = 0; break;
case 0x30F: pseqnum = song.songlen - 1; break;
case 0x310: if(psn2 == song.songlen) { /* + */
if(song.songlen < 100)
song.playseq[(++song.songlen) - 1] = 0;
else DisplayBeep(screen);
}
else if(song.playseq[psn2] < blocks - 1)
song.playseq[psn2]++;
break;
case 0x311: if(psn2 == song.songlen) { /* - */
if(song.songlen > 1) {
song.songlen--;
pseqnum = psn2 - 1;
}
}
else if(song.playseq[psn2] > 0)
song.playseq[psn2]--;
break;
case 0x312: InsertSeq(0); break;
case 0x313: DelSeq(); break;
case 0x314: InsertSeq((UBYTE)pb2); break;
case 0x315: Toggle(&gadget3[21]);
if(updscrflag) {
if(gadget3[21].GadgetID & 0x1000)
InitEqualizer();
else { RemEqualizer(); RemCopperList(); }
}
break;
case 0x316: Toggle(&gadget3[22]);
if(updscrflag) InitDisp();
break;
case 0x317: song.flags |= FLAG_VOLHEX;
DispVolAndSldType();
break;
case 0x318: song.flags &= ~FLAG_VOLHEX;
DispVolAndSldType();
break;
}
if(gid >= 0x30C && gid <= 0x311) {
TulostaLohkoJaSoitin();
TulostaSoittoLohkot();
}
}
static void __regargs Handle5(UWORD gid) /* lohko 1 */
{
BOOL doit = 0;
switch(gid) {
case 0x50F:
SetMark();
break;
case 0x510: case 0x511: case 0x512:
HandleMark((UBYTE)(gid - 0x510 + 0x32));
break;
case 0x508: /* Uusi */
if(blocks < 100 && !AllocBlock((UWORD)blocks,4,64)) blocks++;
TulostaLohkoJaSoitin();
break;
case 0x50A: /* Tuhoa viim. */
if(blocks > 1) {
Disable();
if(pblock < blocks - 1) { blocks--; doit = 1; }
Enable();
if(doit) FreeBlock((UWORD)blocks);
}
TulostaLohkoJaSoitin();
break;
case 0x509: /* Uusi tΣhΣn */
NewBlockHere(pb2,4,64);
break;
case 0x50B: /* Tuhoa tΣmΣ */
DelBlockHere(pb2);
break;
case 0x500: case 0x501: case 0x502: case 0x503:
CutCopyPaste((UBYTE)pb2,0,(UWORD)((UWORD)(lohko[pb2]->lines) + 1),
(UBYTE)currtrk,1,(UBYTE)(gid-0x500));
PaivitaNaytto(TRUE); break;
case 0x504: case 0x505: case 0x506: case 0x507:
CutCopyPaste((UBYTE)pb2,0,(UWORD)((UWORD)(lohko[pb2]->lines) + 1),
0,lohko[pb2]->numtracks,(UBYTE)(gid-0x504));
PaivitaNaytto(TRUE); break;
case 0x513: case 0x514: case 0x515: case 0x516:
if(ChangeBlockSize(pb2,(UWORD)(gid - 0x512),
(UWORD)((UWORD)(lohko[pb2]->lines) + 1)))
Ilmoita(nomem);
TulostaLohkoJaSoitin();
break;
case 0x50C: FreeBuffer(); break;
case 0x50D: SplitBlock(pb2,pl2); break;
case 0x50E: JoinBlocks(pb2); break;
}
if(gid >= 0x517 && gid <= 0x51D) HighLightLines(pb2,(UWORD)(gid - 0x517));
else if(gid >= 0x51E && gid <= 0x522) HandleLines(pb2,gid);
}
static void __regargs Handle4(UWORD gid) /* soitin */
{
char *lres;
switch(gid) {
case 0x401:
samplenum = 0;
PaivitaSoittimennimi();
break;
case 0x402:
samplenum = 62;
PaivitaSoittimennimi();
break;
case 0x403:
EdSoitin();
break;
case 0x404:
SeurSoitin();
break;
case 0x405: case 0x400:
StartLoad();
lastrep = lastreplen = 0;
lastmidic = lastmidip = 0;
lres = LoadInstrument(song.sample[samplenum].sname,
TRUE);
PaivitaSoittimennimi();
StopLoad();
if(lres == NOERR) SampleLoaded();
diskerr(lres);
break;
case 0x406: /* hyppΣΣk÷ ukko?????????? */
if(samplenum < 32) {
song.jumpmask ^= 1 << samplenum;
if(song.jumpmask & (1 << samplenum))
Korosta(&gadget4[6],TRUE);
else Korosta(&gadget4[6],FALSE);
}
break;
case 0x407: RemoveInstrument(); break;
case 0x408: GetRepeat(); break;
case 0x409: GetRepLen(); break;
case 0x40A:
if(song.sample[samplenum].svol)
song.sample[samplenum].svol--;
DispVolGadget();
break;
case 0x40C:
if(song.sample[samplenum].svol < 64)
song.sample[samplenum].svol++;
DispVolGadget();
break;
case 0x40B:
song.sample[samplenum].svol =
(propinfo[2].HorizPot + 512) / 1024;
DispVolGadget();
break;
case 0x40D:
if(song.sample[samplenum].strans > -24)
song.sample[samplenum].strans--;
PaivitaSoittimennimi(); break;
case 0x40E:
if(strinfo[8].LongInt >= -24 && strinfo[8].LongInt <= 24)
song.sample[samplenum].strans = (BYTE)(strinfo[8].LongInt);
PaivitaSoittimennimi(); break;
case 0x40F:
if(song.sample[samplenum].strans < 24)
song.sample[samplenum].strans++;
PaivitaSoittimennimi();
}
}
static void __regargs Handle6(UWORD gid) /* eli editointi */
{
if(gid >= 0x612 && gid <= 0x615) {
Korosta(&gadget6[nappokt + 18],FALSE);
nappokt = gid - 0x612;
Korosta(&gadget6[nappokt + 18],TRUE);
} else if(gid >= 0x602 && gid <= 0x611) {
Korosta(&gadget6[gid - 0x600],(BOOL)(trackon[gid -
0x602] = !trackon[gid - 0x602]));
if(!trackon[gid - 0x602]) SammutaAanet((UWORD)(gid - 0x602));
} else if(gid == 0x600) Toggle(&gadget6[0]);
else if(gid == 0x601) Toggle(&gadget6[1]);
else if(gid == 0x619) Toggle(&gadget6[25]);
else if(gid == 0x616) DoSlide(0);
else if(gid == 0x61E) DoSlide(1);
else EditHandler(gid); /* jump to local handler routine */
DispInfoGadgets();
}
static void __regargs Handle9(UWORD gid)
{
switch(gid) {
case 0x900: /* activate/deactivate MIDI */
if(gadget9[0].GadgetID & 0x1000) {
Korosta(&gadget9[0],FALSE);
Korosta(&gadget9[22],FALSE);
FreeSerial();
midiactive = 0;
} else if(!GetSerial()) {
Korosta(&gadget9[0],TRUE);
midiactive = 1;
} else Ilmoita("Can't allocate serial port.");
break;
case 0x913:
if(song.sample[samplenum].midipreset)
song.sample[samplenum].midipreset--;
DispPresetGadget();
break;
case 0x914:
song.sample[samplenum].midipreset =
(propinfo[3].HorizPot + 254) / 510;
DispPresetGadget();
break;
case 0x915:
if(song.sample[samplenum].midipreset < 128)
song.sample[samplenum].midipreset++;
DispPresetGadget();
break;
case 0x912:
if(strinfo[5].LongInt < 0 || strinfo[5].LongInt
> 128) {
DisplayBeep(screen);
} else song.sample[samplenum].midipreset =
(UBYTE)(strinfo[5].LongInt);
DispPresetGadget();
break;
case 0x916:
if(midiactive) {
Toggle(&gadget9[22]);
if(gadget9[22].GadgetID & 0x1000)
custom.intena = 0x8800; /*RBF on*/
else custom.intena = 0x0800; /*RBF off*/
}
break;
case 0x917:
Toggle(&gadget9[23]);
break;
default:
if(gid >= 0x901 && gid <= 0x911) {
song.sample[samplenum].midich = gid-0x901;
PaivitaSoittimennimi();
}
}
}
static BOOL __regargs Handle7(UWORD gid)
{
switch(gid) {
case 0x70D: case 0x70E: case 0x70F:
if(gid == 0x70D) song.flags &= ~FLAG_JUMPINGON;
else if(gid == 0x70E) song.flags |=
(FLAG_JUMPINGON|FLAG_JUMP8TH);
else { song.flags |= FLAG_JUMPINGON;
song.flags &= ~FLAG_JUMP8TH;
}
UpdateJumpGadgets();
break;
case 0x711: case 0x712: case 0x713:
if(gadget7[gid - 0x701].GadgetID & 0x1000)
Korosta(&gadget7[gid - 0x701],FALSE);
else {
Korosta(&gadget7[16],(BOOL)(gid == 0x711));
Korosta(&gadget7[17],(BOOL)(gid == 0x712));
Korosta(&gadget7[18],(BOOL)(gid == 0x713));
}
break;
case 0x714:
Handle3(0x302);
if(gadget7[16].GadgetID & 0x1000) {
Korosta(&gadget7[16],FALSE);
AlustaKappale(TRUE); PaivitaNaytto(TRUE);
} else if(gadget7[17].GadgetID & 0x1000) {
Korosta(&gadget7[17],FALSE);
AlustaKappale(FALSE); PaivitaNaytto(FALSE);
} else if(gadget7[18].GadgetID & 0x1000) {
Korosta(&gadget7[18],FALSE);
return(1); /* QUIT !!!!!! */
}
break;
case 0x715: case 0x716:
Toggle(&gadget7[gid - 0x715 + 20]);
break;
default:
if(gid >= 0x700 && gid <=0x70C) ColorHandler(gid);
}
return(0);
}
static void __regargs HandleA(UWORD gid)
{
static BYTE trtb[4] = { 12,1,-1,-12 };
switch(gid) {
case 0xA0C: PlayTransp((BYTE)(song.playtransp - 1)); break;
case 0xA0D: PlayTransp((BYTE)((propinfo[4].HorizPot + 1311) / 2622 - 13)); break;
case 0xA0E: PlayTransp((BYTE)(song.playtransp + 1)); break;
case 0xA11: case 0xA12:
Korosta(&gadgetA[17],(BOOL)(gid == 0xA11));
Korosta(&gadgetA[18],(BOOL)(gid == 0xA12));
break;
case 0xA0F: ExpandBlock(pb2); break;
case 0xA10: ShrinkBlock(pb2); break;
default:
if(gid >= 0xA00 && gid <= 0xA0B)
Transpose(trtb[gid & 0x0003],(UBYTE)((gid -
0xA00) / 4));
break;
}
}
void MIDIon() /* called by Load200Song if there are any MIDI instruments */
{
if(!midiactive) Handle9(0x900);
}