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-vol.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-06-17
|
3KB
|
87 lines
/* med-vol.c: volume handling routines, by Teijo Kinnunen, 1990 */
#include "med.h"
#include "medproto.h"
extern char volstr[],mvolstr[];
extern WORD mousex,mousey;
extern UWORD nykyinenosio;
extern struct Window *window;
static UBYTE seltrkvol = 0;
extern struct RastPort *wrp;
extern struct Gadget far gadget8[];
extern struct StringInfo strinfo[];
extern struct Kappale far song;
static void SelectTrackVol(void);
static void SelectTrackVol()
{
register UBYTE row = (mousey - 26) / 10,col = (mousex - 6) / 28;
if((seltrkvol = 8 * row + col) > 15) seltrkvol = 15; /* foolproof */
}
void ShowVols()
{
UWORD pos1,pos2;
UBYTE tcnt;
if(nykyinenosio == 8) {
pos1 = RemoveGadget(window,&gadget8[2]);
pos2 = RemoveGadget(window,&gadget8[7]);
}
strinfo[6].BufferPos = strinfo[7].BufferPos = 0;
strinfo[6].DispPos = strinfo[7].DispPos = 0;
strinfo[6].LongInt = (LONG)(song.trkvol[seltrkvol]);
strinfo[7].LongInt = (LONG)(song.mastervol);
stcu_d(volstr,song.trkvol[seltrkvol]);
stcu_d(mvolstr,song.mastervol);
if(nykyinenosio == 8) {
AddGadget(window,&gadget8[2],pos1);
AddGadget(window,&gadget8[7],pos2);
RefreshGList(&gadget8[2],window,NULL,1);
RefreshGList(&gadget8[7],window,NULL,1);
}
for(tcnt = 0; tcnt < 16; tcnt++) {
if(tcnt == seltrkvol) SetAPen(wrp,5); else SetAPen(wrp,1);
if(tcnt < 8) prtnum((UWORD)(song.trkvol[tcnt]),(UWORD)(7 + 28 * tcnt),33,3);
else prtnum((UWORD)(song.trkvol[tcnt]),(UWORD)(7 + 28 * (tcnt - 8)),45,3);
}
SetAPen(wrp,0);
prtnum((UWORD)seltrkvol,15,58,2);
}
void Handle8(UWORD gid)
{
switch(gid) {
case 0x806: if(song.mastervol > 1) song.mastervol--;
break;
case 0x805: if(song.mastervol > 11) song.mastervol -= 10;
else song.mastervol = 1;
break;
case 0x808: if(song.mastervol < 100) song.mastervol++;
break;
case 0x809: if(song.mastervol < 90) song.mastervol += 10;
else song.mastervol = 100;
break;
case 0x801: if(song.trkvol[seltrkvol] > 1) song.trkvol[seltrkvol]--;
break;
case 0x800: if(song.trkvol[seltrkvol] > 11) song.trkvol[seltrkvol] -= 10;
else song.trkvol[seltrkvol] = 1;
break;
case 0x803: if(song.trkvol[seltrkvol] < 100) song.trkvol[seltrkvol]++;
break;
case 0x804: if(song.trkvol[seltrkvol] < 90) song.trkvol[seltrkvol] += 10;
else song.trkvol[seltrkvol] = 100;
break;
case 0x802: if(strinfo[6].LongInt >= 100) song.trkvol[seltrkvol] = 100;
else if(strinfo[6].LongInt < 1) song.trkvol[seltrkvol] = 1;
else song.trkvol[seltrkvol] = (UBYTE)(strinfo[6].LongInt);
break;
case 0x807: if(strinfo[7].LongInt >= 100) song.mastervol = 100;
else if(strinfo[7].LongInt < 1) song.mastervol = 1;
else song.mastervol = (UBYTE)(strinfo[7].LongInt);
break;
case 0x810: SelectTrackVol();
break;
}
ShowVols();
}