home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/ports.h>
- #include "randcmd.h"
-
- struct MsgPort *CreatePort();
- struct MsgPort *cmdport,*replyport;
- struct MsgPort *FindPort();
- struct commandrequest cmdreq,*messback;
-
- struct SampleData *sam;
- struct Values *var;
- long no;
- char RandSamVers[50] = {"Randsam v1.1 , by Steven Lagerweij 030490"};
-
- VOID main(argc,argv)
- int argc;
- char *argv[];
- {
- printf("Cmd program for randsam by Steven Lagerweij\n");
-
- if(argc < 2)
- {
- printf("Usage : %s keyword\n",argv[0]);
- printf("Keywords : \n");
- printf(" quit\tQuit signal\n");
- printf(" play\tPlay all samples\n");
- printf(" conf\tDisplay the current config\n");
- exit(0);
- }
- if((replyport=CreatePort("replyport randsam",0))==NULL)
- { printf("Couldn't create port\n"); exit(0); };
-
- cmdreq.cmd_Msg.mn_Node.ln_Type = NT_MESSAGE;
- cmdreq.cmd_Msg.mn_ReplyPort = replyport;
- cmdreq.cmd_Msg.mn_Length = sizeof(struct commandrequest);
- if(stcpma("play",argv[1])) cmdreq.Command = COM_PLAY;
- else if(stcpma("conf",argv[1])) cmdreq.Command = COM_CONF;
- else cmdreq.Command = COM_QUIT;
- cmdport = FindPort(CMDPORTNAME);
- if(!cmdport)
- {
- printf("Couldn't contact program!\n");
- DeletePort(replyport);
- exit(0);
- }
-
- PutMsg(cmdport,&cmdreq);
- WaitPort(replyport);
- messback = (struct commandrequest *)GetMsg(replyport);
- DeletePort(replyport);
-
- if(cmdreq.Command == COM_CONF)
- {
- sam = (struct SampleData *)cmdreq.data1;
- var = (struct Values *)cmdreq.data2;
- no = var->vl_cur;
- printf("\fRandsam settings\n");
- printf( "----------------\n");
- printf("Next sound will be in +/- %ld seconds\n",var->vl_waittime);
- printf("Min delay %-4ld, Max delay %-4ld\n",var->vl_mindelay,var->vl_maxdelay);
- printf("Min cycles %-4ld, Max cycles %-4ld\n",var->vl_mincyc,var->vl_maxcyc);
- printf("Maximum diff %d\n",var->vl_maxdiff);
- printf("Number of samples available is %ld\n",var->vl_num);
- printf("Using random seed : %ld\n",var->vl_randseed);
- printf("Last played sample %ld\n",no);
- printf("Name : %s, period %d Cycles %d Volume %d\n",
- sam->Name,sam->Period,sam->Cycles,sam->Vol);
-
- }
-
- exit(0);
- }
-