TempleOSCDV5.00.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:48:09 +02:00
1 parent 122df6338e
commit f6eacf7744
374 files changed
+11078 -11204

No files matched your search

+5 -5
View File
@@ -7,18 +7,18 @@ U0 Song()
music.stacatto_factor= 0.902;
try {
while (!ScanKey) {
Play("3qEsCDCDqCDeEGsEBEBeCBsDADA",
Play("5qEsCDCDqCDeEGsE4B5E4B5eC4B5sD4A5D4A",
"Be \0like \0 \0a \0 \0child \0 \0 \0 \0"
"some \0 \0re\0 \0spect.\n\0 \0 \0 \0 \0 \0");
Play("qEsCDCDqCDeEGsEBEBeCBsDADA",
Play("5qEsCDCDqCDeEGsE4B5E4B5eC4B5sD4A5D4A",
"Ma\0tur\0 \0i\0 \0ty \0 \0 \0 \0don't \0 \0"
"ne\0 \0glect.\n\0 \0 \0 \0 \0 \0");
Play("eBDqF2sG3A2G3AqAAAetDAAsDBDB");
Play("eBDqF2sG3A2G3AqAAAetDAAsDBDB");
Play("4eB5DqF4sGAGAqAAA5etD4AA5sD4B5D4B");
Play("4eB5DqF4sGAGAqAAA5etD4AA5sD4B5D4B");
}
} catch
PutExcept;
Snd(0);
Snd;
}
Song;
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
$WW,1$$FG,5$$TX+CX,"Psalmody Help"$$FG$
* The keyboard can be used as an organ by typing letter keys or clicking the mouse on the keyboard diagram$FG$. You can "record" notes by pressing the red button and typing letters. They will appear on the musical staff. You can edit and save them.
* The keyboard can be used as an organ by typing letter keys or clicking the mouse on the keyboard diagram$FG$. You can "record" notes by pressing the red bttn and typing letters. They will appear on the musical staff. You can edit and save them.
* The clipboard can be used to cut and paste.
@@ -8,7 +8,7 @@ $WW,1$$FG,5$$TX+CX,"Psalmody Help"$$FG$
* The first line of the $LK,"HolyC",A="FI:::/Doc/HolyC.DD"$ song files is a comment with a category recognized by $LK,"JukeBox",A="FF:::/Apps/Psalmody/JukeBox.HC,JukeBox"$(). The categories are $FG,2$"no nothing"$FG$, $FG,2$"has words"$FG$, $FG,2$"has graphics"$FG$, or $FG,2$"special"$FG$. The third character in the song comment is a digit rating number, shown in $LK,"JukeBox",A="FF:::/Apps/Psalmody/JukeBox.HC,JukeBox"$(). You can set the song rating in $LK,"JukeBox",A="FF:::/Apps/Psalmody/JukeBox.HC,JukeBox"$() by pressing $FG,2$0$FG$-$FG,2$9$FG$. You can press $FG,2$<DELETE>$FG$ to delete songs.
* You can take the $LK,"Play",A="MN:Play"$() stmts out of a song file and place them in your programs. You can also add a song to a document with $FG,2$<CTRL-l>$FG$, but you should do it after pressing $FG,2$<CTRL-t>$FG$ because the clipboard-insert in $FG,2$<CTRL-l>$FG$ is screwy. See this $SO,"<Song>",A="2qG3ECB2eGG3qCeFDsBGBG2qG3ECB2eGG3qCeFDsBGBGqEeEFqEB2eG3FetCAGqFCEeEFqEB2eG3FetCAGqFC"$ after pressing $FG,2$<CTRL-t>$FG$, now.
* You can take the $LK,"Play",A="MN:Play"$() stmts out of a song file and place them in your programs. You can also add a song to a document with $FG,2$<CTRL-l>$FG$, but you should do it after pressing $FG,2$<CTRL-t>$FG$ because the clipboard-insert in $FG,2$<CTRL-l>$FG$ is screwy. See this $SO,"<Song>",A="4qG5EC4BeGG5qCeFD4sB5G4B5G4qG5EC4BeGG5qCeFD4sB5G4B5GqEeEFqE4BeG5FetC4A5GqFCEeEFqE4BeG5FetC4A5GqFC"$ after pressing $FG,2$<CTRL-t>$FG$, now.
* You can call $LK,"JukeBox",A="FF:::/Apps/Psalmody/JukeBox.HC,JukeBox"$("~/Psalmody"); to play your songs.
+2 -2
View File
@@ -3,10 +3,10 @@ CTask *SingleSong(U8 *msg,U8 *name)
CTask *task=Spawn(&SrvCmdLine,NULL,name,,Fs);
StrCpy(task->task_title,name);
task->title_src=TTS_LOCKED_CONST;
TaskExe(task,Fs,";",1<<SVCf_WAKE_MASTER|1<<SVCf_FREE_ON_COMPLETE);
TaskExe(task,Fs,";",1<<JOBf_WAKE_MASTER|1<<JOBf_FREE_ON_COMPLETE);
WinHorz(task->win_left,task->win_left+50,task);
WinVert(2,2+8,task);
TaskExe(task,NULL,msg,1<<SVCf_EXIT_ON_COMPLETE|1<<SVCf_FREE_ON_COMPLETE);
TaskExe(task,NULL,msg,1<<JOBf_EXIT_ON_COMPLETE|1<<JOBf_FREE_ON_COMPLETE);
DocPut(task)->max_entries=100;
return task;
}
+4 -15
View File
@@ -5,13 +5,13 @@ This uses four types of ctrls
2) The $LK,"CCtrl",A="MN:CCtrl"$ type for the tempo/stacatto sliders.
3) The active $LK,"CDoc",A="MN:CDoc"$ sprite buttons with macros for left/record/play/right.
3) The active $LK,"CDoc",A="MN:CDoc"$ sprite bttns with macros for left/record/play/right.
4) Hand-made ctrls for the kbdgraphic, notes and staff.
This uses four types of output
1) The $LK,"CDoc",A="MN:CDoc"$ for the text and buttons and kbdgraphic.
1) The $LK,"CDoc",A="MN:CDoc"$ for the text and bttns and kbdgraphic.
2) The Fs->draw_it() for the staff region, drawn every refresh.
@@ -22,9 +22,6 @@ This uses four types of output
See $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$(), $LK,"GrUpdateTasks",A="MN:GrUpdateTasks"$() and $LK,"GrUpdateScrn",A="MN:GrUpdateScrn"$().
$WW,1$$WW,0$*/
#define NOTE_REST MIN_I64
#define OCTAVE_REST MIN_I64
#define PSMT_HEAD 0
#define PSMT_NOTE 1
#define PSMT_METER 2
@@ -41,14 +38,7 @@ class PsmNote
I64 x,y;
U8 *word;
I64 type,flags;
union {
I64 note;
I64 meter_top;
};
union {
I64 octave;
I64 meter_bottom;
}
I64 ona,meter_top,meter_bottom;
I64 duration,width;
U8 ascii[32];
};
@@ -62,8 +52,7 @@ class PsmCtrl
PsmNote head;
PsmNote clipboard;
CMenuEntry *incomplete_entry,*record_entry;
I64 scrn_x,
tool;
I64 scrn_x,tool;
PsmNote *cur_note;
CDC *dc2;
Bool playing;
+1 -1
View File
@@ -69,7 +69,7 @@ CCtrl *TempoNew()
{
CCtrl *c=CAlloc(sizeof(CCtrl));
c->win_task=Fs;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_IP;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
c->type=CTRLT_GENERIC;
c->state=&tempo_state;
c->draw_it=&DrawTempoCtrl;
+18 -27
View File
@@ -53,13 +53,10 @@ $ID,-8$
F64 psm_durations[PSM_NUM_DURATIONS+1]={
2*.25/3,.25,2*.5/3,.5,2.0/3.0,0.5*1.5,1.0,1.5,2.0,3.0,4.0,6.0,1000000.0};
U8 *psm_duration_lst="st\0s\0et\0e\0qt\0e.\0q\0q.\0h\0h.\0w\0w.\0";
U8 *psm_duration_imgs[PSM_NUM_DURATIONS]={$IB,"<1>",BI=1$,$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,
$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<3>",BI=3$,
$IB,"<4>",BI=4$,$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<5>",BI=5$};
U8 *psm_duration_imgs[PSM_NUM_DURATIONS]={
$IB,"<1>",BI=1$,$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<3>",BI=3$,$IB,"<4>",BI=4$,$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<5>",BI=5$};
Bool psm_triplet_durations[PSM_NUM_DURATIONS]={TRUE,FALSE,TRUE,
FALSE,TRUE,FALSE,FALSE,FALSE,
FALSE,FALSE,FALSE,FALSE};
FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE};
Bool PsmBlink()
{
@@ -117,7 +114,7 @@ U0 PsmSetOctave(I64 octave)
I64 i;
U8 buf[STR_LEN];
CMenuEntry *tmpse;
for (i=0;i<=6;i++) {
for (i=1;i<=7;i++) {
StrPrint(buf,"Snd/Octave%d",i);
if (tmpse=MenuEntryFind(Fs->cur_menu,buf)) {
if (i==octave)
@@ -149,7 +146,7 @@ U0 PsmRecalcNoteXY()
{
F64 measure_len=4,measure_left=measure_len;
PsmNote *tmpn=psm.head.next;
I64 x=8-psm.scrn_x,note,octave;
I64 x=8-psm.scrn_x,ona,note,octave;
while (TRUE) {
tmpn->x=x;
tmpn->y=50;
@@ -157,22 +154,18 @@ U0 PsmRecalcNoteXY()
break;
else {
if (tmpn->type!=PSMT_METER) {
octave=tmpn->octave;
if (octave!=OCTAVE_REST) {
note=tmpn->note;
if (tmpn->ona!=ONA_REST) {
ona=tmpn->ona;
if (Bt(&tmpn->flags,PSMf_SHARP))
note--;
ona--;
if (Bt(&tmpn->flags,PSMf_FLAT))
note++;
if (note<0) {
note=11;
octave--;
} else if (note>11) {
note=0;
octave++;
}
ona++;
octave=Ona2Octave(ona);
note =Ona2Note (ona);
note=music.note_map[*LstSub(note,psm_note_lst)-'A'];
tmpn->y=(15+(psm_note_map[note]-7*(octave-2)))*4;
if (note<3)
octave++;
tmpn->y=(15+(psm_note_map[note]-7*(octave-4)))*4;
}
}
x+=tmpn->width;
@@ -237,7 +230,7 @@ U0 DrawIt(CTask *task,CDC *dc)
} else if (tmpn->flags&PSMF_SEL)
dc->color=RED;
else {
if (tmpn->note!=NOTE_REST)
if (tmpn->ona!=ONA_REST)
dc->color=BLACK;
else
dc->color=LTGRAY;
@@ -314,21 +307,19 @@ U0 DrawPickTools()
psm.dc2->color=ROPF_DITHER+WHITE<<16+RED;
else
psm.dc2->color=ROPF_DITHER+WHITE<<16+BLACK;
GrBorder(psm.dc2,PSM_TOOLS_X,PSM_TOOLS_Y,
PSM_TOOLS_X+10,PSM_TOOLS_Y+10);
GrBorder(psm.dc2,PSM_TOOLS_X,PSM_TOOLS_Y,PSM_TOOLS_X+10,PSM_TOOLS_Y+10);
if (psm.tool==PSMTT_PTR_TOOL)
psm.dc2->color=RED;
else
psm.dc2->color=BLACK;
(*gr.fp_draw_input_ptr)(psm.dc2,PSM_TOOLS_X+15,PSM_TOOLS_Y);
(*gr.fp_draw_ms)(psm.dc2,PSM_TOOLS_X+15,PSM_TOOLS_Y);
psm.dc2->color=BLACK;
}
Bool PsmGetPickToolBox(I64 xx,I64 yy)
{
if (PSM_TOOLS_X<=xx<PSM_TOOLS_X+27 &&
PSM_TOOLS_Y<=yy<PSM_TOOLS_Y+15) {
if (PSM_TOOLS_X<=xx<PSM_TOOLS_X+27 && PSM_TOOLS_Y<=yy<PSM_TOOLS_Y+15) {
PsmMarkSel(0,0,FALSE);
if (xx<PSM_TOOLS_X+13)
psm.tool=PSMTT_BOX_TOOL;
+22 -30
View File
@@ -149,24 +149,22 @@ U0 PsmLoadSongStr(U8 *st,I64 *psm_octave,F64 *psm_duration)
Bts(&tmpn->flags,PSMf_FLAT);
note--;
st++;
if (note<0) //Ab
note=11;
else if (note==2) //Cb
*psm_octave-=1;
} else if (*st=='#') {
Bts(&tmpn->flags,PSMf_SHARP);
note++;
st++;
if (note>11) //G#
note=0;
else if (note==3) //B#
*psm_octave+=1;
}
if (note<0) {
note=11;
*psm_octave-=1;
} else if (note>11) {
note=0;
*psm_octave+=1;
}
tmpn->note=note;
tmpn->octave=*psm_octave;
} else {
tmpn->note=NOTE_REST;
tmpn->octave=OCTAVE_REST;
}
tmpn->ona=Note2Ona(note,*psm_octave);
} else
tmpn->ona=ONA_REST;
if (*psm_duration<=2*.25/3)
i=0;
else if (*psm_duration<=.25)
@@ -251,11 +249,11 @@ U8 *PsmCvtSong()
{
PsmNote *tmpn;
U8 *st,*src,*dst;
I64 i,note,octave,last_octave,last_duration;
I64 i,ona,note,octave,last_octave,last_duration;
i=0;
tmpn=psm.head.next;
last_octave=OCTAVE_REST;
last_octave=MIN_I64;
last_duration=-1;
while (tmpn!=&psm.head) {
dst=&tmpn->ascii;
@@ -265,25 +263,19 @@ U8 *PsmCvtSong()
*dst++='/';
*dst++=tmpn->meter_bottom+'0';
} else {
octave=tmpn->octave;
note=tmpn->note;
if (note!=NOTE_REST) {
if (tmpn->ona!=ONA_REST) {
ona=tmpn->ona;
if (Bt(&tmpn->flags,PSMf_SHARP))
note--;
ona--;
if (Bt(&tmpn->flags,PSMf_FLAT))
note++;
if (note<0) {
note=11;
octave--;
} else if (note>11) {
note=0;
octave++;
}
ona++;
octave=Ona2Octave(ona);
note =Ona2Note (ona);
note=music.note_map[*LstSub(note,psm_note_lst)-'A'];
}
if (Bt(&tmpn->flags,PSMf_TIE))
*dst++='(';
if (octave!=last_octave && note!=NOTE_REST) {
if (octave!=last_octave && tmpn->ona!=ONA_REST) {
*dst++=octave+'0';
last_octave=octave;
}
@@ -294,7 +286,7 @@ U8 *PsmCvtSong()
*dst++=src[1];
last_duration=tmpn->duration;
}
if (note!=NOTE_REST) {
if (tmpn->ona!=ONA_REST) {
src=LstSub(note,psm_note_lst);
*dst++=src[0];
if (src[1])
@@ -419,7 +411,7 @@ U8 *PsmSaveSong(U8 *dirname,U8 *full_filename)
" }\n"
" } catch\n"
" PutExcept;\n"
" Snd(0);\n"
" Snd;\n"
"}\n"
"\n"
"Song;\n");
+146 -181
View File
@@ -41,43 +41,27 @@ U0 PsmRightClick(I64 x,I64 y)
} else {
switch (i) {
case PSMR_REST:
if (tmpn->type==PSMT_NOTE) {
tmpn->octave=OCTAVE_REST;
tmpn->note=NOTE_REST;
}
if (tmpn->type==PSMT_NOTE)
tmpn->ona=ONA_REST;
break;
case PSMR_SHARP:
if (tmpn->type==PSMT_NOTE && tmpn->octave!=OCTAVE_REST) {
if (tmpn->type==PSMT_NOTE && tmpn->ona!=ONA_REST) {
if (Btr(&tmpn->flags,PSMf_FLAT))
tmpn->note++;
tmpn->ona++;
if (Btc(&tmpn->flags,PSMf_SHARP))
tmpn->note--;
tmpn->ona--;
else
tmpn->note++;
if (tmpn->note<0) {
tmpn->note=11;
tmpn->octave--;
} else if (tmpn->note>11) {
tmpn->note=0;
tmpn->octave++;
}
tmpn->ona++;
}
break;
case PSMR_FLAT:
if (tmpn->type==PSMT_NOTE && tmpn->octave!=OCTAVE_REST) {
if (tmpn->type==PSMT_NOTE && tmpn->ona!=ONA_REST) {
if (Btr(&tmpn->flags,PSMf_SHARP))
tmpn->note--;
tmpn->ona--;
if (Btc(&tmpn->flags,PSMf_FLAT))
tmpn->note++;
tmpn->ona++;
else
tmpn->note--;
if (tmpn->note<0) {
tmpn->note=11;
tmpn->octave--;
} else if (tmpn->note>11) {
tmpn->note=0;
tmpn->octave++;
}
tmpn->ona--;
}
break;
case PSMR_TIE:
@@ -123,35 +107,35 @@ U0 PsmRightClick(I64 x,I64 y)
U0 PsmLeftClickPickNoteBox(I64 duration)
{
I64 o,n,msg_code,a1,a2;
I64 o,n,msg_code,arg1,arg2;
PsmNote *tmpn,*tmpn1;
do {
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP|1<<MSG_IP_MOVE);
if (msg_code==MSG_IP_MOVE) {
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
if (msg_code==MSG_MS_MOVE) {
DrawDC2;
DrawNote(psm.dc2,a1,a2,duration);
DrawNote(psm.dc2,arg1,arg2,duration);
}
} while (msg_code!=MSG_IP_L_UP);
if (a2<13*FONT_HEIGHT) {
if (a1>psm.head.last->x)
} while (msg_code!=MSG_MS_L_UP);
if (arg2<13*FONT_HEIGHT) {
if (arg1>psm.head.last->x)
tmpn1=psm.head.last;
else if (a1<psm.head.next->x)
else if (arg1<psm.head.next->x)
tmpn1=&psm.head;
else
tmpn1=PsmFindNote(a1-PSM_NOTE_SPACING/2,a2);
tmpn1=PsmFindNote(arg1-PSM_NOTE_SPACING/2,arg2);
tmpn=CAlloc(sizeof(PsmNote));
tmpn->type=PSMT_NOTE;
a2=a2/4-15;
n=-a2%7;
o=2+a2/-7;
n=-n;
arg2=arg2/4-15;
n=arg2%7;
o=4+arg2/-7;
if (n<0) {
n+=7;
o++;
}
n=psm_note_inverse_map[n];
tmpn->note=n;
tmpn->octave=o;
if (n<3)
o--;
tmpn->ona=Note2Ona(n,o);
tmpn->duration=duration;
PsmSetWidth(tmpn);
QueIns(tmpn,tmpn1);
@@ -162,22 +146,22 @@ U0 PsmLeftClickPickNoteBox(I64 duration)
U0 PsmLeftClickPickMeterBox(I64 top,I64 bottom)
{
I64 msg_code,a1,a2;
I64 msg_code,arg1,arg2;
PsmNote *tmpn,*tmpn1;
do {
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP|1<<MSG_IP_MOVE);
if (msg_code==MSG_IP_MOVE) {
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
if (msg_code==MSG_MS_MOVE) {
DrawDC2;
DrawTimeSignature(psm.dc2,a1,a2,top,bottom);
DrawTimeSignature(psm.dc2,arg1,arg2,top,bottom);
}
} while (msg_code!=MSG_IP_L_UP);
if (a2<13*FONT_HEIGHT) {
if (a1>=psm.head.x)
} while (msg_code!=MSG_MS_L_UP);
if (arg2<13*FONT_HEIGHT) {
if (arg1>=psm.head.x)
tmpn1=psm.head.last;
else if (a1<psm.head.next->x)
else if (arg1<psm.head.next->x)
tmpn1=&psm.head;
else
tmpn1=PsmFindNote(a1-PSM_NOTE_SPACING/2,a2);
tmpn1=PsmFindNote(arg1-PSM_NOTE_SPACING/2,arg2);
tmpn=CAlloc(sizeof(PsmNote));
tmpn->type=PSMT_METER;
tmpn->meter_top=top;
@@ -192,40 +176,39 @@ U0 PsmLeftClickPickMeterBox(I64 top,I64 bottom)
U0 PsmLeftClickStaffPtr(I64 x,I64 y)
{
PsmNote *tmpn,*tmpn1;
I64 o,n,msg_code,a1,a2,n_original,o_original;
I64 o,n,msg_code,arg1,arg2,n_original,o_original;
psm.cur_note=tmpn=PsmFindNote(x,y);
if (tmpn!=&psm.head) {
if (tmpn->type==PSMT_NOTE) {
n_original=tmpn->note;
o_original=tmpn->octave;
o_original=Ona2Octave(tmpn->ona);
n_original=Ona2Note (tmpn->ona);
do {
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP|1<<MSG_IP_MOVE);
if (msg_code==MSG_IP_L_UP) {
tmpn1=PsmFindNote(a1,a2);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
if (msg_code==MSG_MS_L_UP) {
tmpn1=PsmFindNote(arg1,arg2);
if (tmpn1==&psm.head || tmpn1==tmpn)
goto move_note;
else {
Free(tmpn1->word);
tmpn1->word=tmpn->word;
tmpn->word=NULL;
tmpn->note=n_original;
tmpn->octave=o_original;
tmpn->ona=Note2Ona(n_original,o_original);
}
} else {
move_note:
a2=a2/4-15;
n=-a2%7;
o=2+a2/-7;
n=-n;
arg2=arg2/4-15;
n=arg2%7;
o=4+arg2/-7;
if (n<0) {
n+=7;
o++;
}
n=psm_note_inverse_map[n];
tmpn->note=n;
tmpn->octave=o;
if (n<3)
o--;
tmpn->ona=Note2Ona(n,o);
}
} while (msg_code!=MSG_IP_L_UP);
} while (msg_code!=MSG_MS_L_UP);
PsmSetWidth(tmpn);
}
}
@@ -233,17 +216,17 @@ move_note:
U0 PsmLeftClickStaffBox(I64 x,I64 y)
{
I64 msg_code,a1,a2;
I64 msg_code,arg1,arg2;
do {
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP|1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
DrawDC2;
psm.dc2->color=ROPF_DITHER+WHITE<<16+BLACK;
GrBorder(psm.dc2,x,y,a1,a2);
if (msg_code==MSG_IP_L_UP) {
if (x>a1) SwapI64(&x,&a1);
PsmMarkSel(x,a1,TRUE);
GrBorder(psm.dc2,x,y,arg1,arg2);
if (msg_code==MSG_MS_L_UP) {
if (x>arg1) SwapI64(&x,&arg1);
PsmMarkSel(x,arg1,TRUE);
}
} while (msg_code!=MSG_IP_L_UP);
} while (msg_code!=MSG_MS_L_UP);
DrawDC2;
}
@@ -366,14 +349,12 @@ U0 PsmPopMode()
U0 Psalmody(U8 *dirname="~/Psalmody")
{
Bool was_playing;
I64 a1,a2,msg_code=0,col,
note=NOTE_REST,octave=OCTAVE_REST,psm_octave=3,timeout_val,timeout_val2,
old_doc_flags;
Bool was_playing,is_null=TRUE,was_null=TRUE;
I64 arg1,arg2,msg_code=0,col,ona=ONA_REST,last_ona=ONA_REST,
psm_octave=4,timeout_val,timeout_val2,old_doc_flags;
U8 *filename=NULL,*st,*st2;
PsmNote *tmpn;
F64 f=0,last_f=0,psm_duration=1.0,
d,evt_time=tS,note_down_time=tS;
F64 psm_duration=1.0,d,evt_time=tS,note_down_time=tS;
CCtrl *c=TempoNew;
if (DocPut) old_doc_flags=DocPut->flags;
@@ -421,13 +402,13 @@ U0 Psalmody(U8 *dirname="~/Psalmody")
" MarkIncomplete(MSG_CMD,PSMF_INCOMPLETE);"
"}"
"Snd {"
" Octave0(,'0');"
" Octave1(,'1');"
" Octave2(,'2');"
" Octave3(,'3');"
" Octave4(,'4');"
" Octave5(,'5');"
" Octave6(,'6');"
" Octave7(,'7');"
"}"
"Help {"
" Help(,,SC_F1);"
@@ -449,23 +430,23 @@ U0 Psalmody(U8 *dirname="~/Psalmody")
while (TRUE) {
was_playing=FALSE;
mo_start:
if (ip.pos_text.y-Fs->win_top<18)
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|
1<<MSG_IP_MOVE|1<<MSG_CMD);
if (ms.pos_text.y-Fs->win_top<18)
msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_UP|
1<<MSG_MS_MOVE|1<<MSG_CMD);
else
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
1<<MSG_IP_MOVE|1<<MSG_CMD);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
1<<MSG_MS_MOVE|1<<MSG_CMD);
mo_got_msg:
if (msg_code==MSG_KEY_DOWN && a1==CH_SPACE && !a2) {
//The Window Mgr sets the Doc cur_entry to a button
//and generates a <SPACE> when the Doc Buttons are clicked.
if (msg_code==MSG_KEY_DOWN && arg1==CH_SPACE && !arg2) {
//The Window Mgr sets the Doc cur_entry to a bttn
//and generates a <SPACE> when the Doc Bttns are clicked.
//This is so that kbd and mouse are the same for Doc's.
//We must now pass the <SPACE> onto the Doc handler.
PutKey(a1,a2);
//We must now pass the <SPACE> onto the Doc hndlr.
PutKey(arg1,arg2);
goto mo_start;
}
if (msg_code!=MSG_IP_MOVE) {
if (msg_code!=MSG_MS_MOVE) {
DocBottom;
if (was_playing || DocPut->cur_entry->y>=Fs->win_height-2) {
PsmMenu(psm_octave);
@@ -473,11 +454,12 @@ mo_got_msg:
}
}
octave=psm_octave;
ona=Note2Ona(3,psm_octave+1); //C
is_null=TRUE;
switch (msg_code) {
case MSG_CMD:
PsmPopMode;
switch (a1) {
switch (arg1) {
case PSMF_CD:
st2=dirname;
if (dirname=PopUpPickDir) {
@@ -496,75 +478,71 @@ mo_got_msg:
break;
case MSG_KEY_DOWN:
evt_time=tS;
if ('0'<=a1<='9') {
psm_octave=a1-'0';
if ('0'<=arg1<='9') {
psm_octave=arg1-'0';
PsmMenu(psm_octave);
col=0;
} else {
switch (a1) {
switch (arg1) {
start:
case 'a': note=7; octave--; break;
case 's': note=8; octave--; break;
case 'e': note=9; octave--; break;
case 'd': note=10; octave--; break;
case 'r': note=11; octave--; break;
case 'f': note=0; break;
case 't': note=1; break;
case 'g': note=2; break;
case 'h': note=3; break;
case 'u': note=4; break;
case 'j': note=5; break;
case 'i': note=6; break;
case 'k': note=7; break;
case 'l': note=8; break;
case 'p': note=9; break;
case ';': note=10; break;
case '[': note=11; break;
case '\'': note=0; octave++; break;
case ']': note=1; octave++; break;
case 'a': ona-=8; break;
case 's': ona-=7; break;
case 'e': ona-=6; break;
case 'd': ona-=5; break;
case 'r': ona-=4; break;
case 'f': ona-=3; break;
case 't': ona-=2; break;
case 'g': ona--; break;
case 'h': break;
case 'u': ona++; break;
case 'j': ona+=2; break;
case 'i': ona+=3; break;
case 'k': ona+=4; break;
case 'l': ona+=5; break;
case 'p': ona+=6; break;
case ';': ona+=7; break;
case '[': ona+=8; break;
case '\'': ona+=9; break;
case ']': ona+=10; break;
case CH_SPACE: ona=ONA_REST; break;
end:
f=Note2Freq(note,octave);
break;
case CH_SPACE:
note=NOTE_REST;
octave=OCTAVE_REST;
f=-1; //rest
is_null=FALSE;
break;
case 0:
switch (a2.u8[0]) {
switch (arg2.u8[0]) {
case SC_CURSOR_LEFT:
if (a2&SCF_CTRL) {
if (arg2&SCF_CTRL) {
while (psm.cur_note->last!=&psm.head) {
psm.cur_note=psm.cur_note->last;
if (psm.cur_note!=&psm.head)
LBEqu(&psm.cur_note->flags,PSMf_SEL,a2&SCF_SHIFT);
LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
}
} else {
if (psm.cur_note->last!=&psm.head) {
psm.cur_note=psm.cur_note->last;
if (psm.cur_note!=&psm.head)
LBEqu(&psm.cur_note->flags,PSMf_SEL,a2&SCF_SHIFT);
LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
}
}
break;
case SC_CURSOR_RIGHT:
if (a2&SCF_CTRL) {
if (arg2&SCF_CTRL) {
while (psm.cur_note!=&psm.head) {
if (psm.cur_note!=&psm.head)
LBEqu(&psm.cur_note->flags,PSMf_SEL,a2&SCF_SHIFT);
LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
psm.cur_note=psm.cur_note->next;
}
} else {
if (psm.cur_note!=&psm.head) {
if (psm.cur_note!=&psm.head)
LBEqu(&psm.cur_note->flags,PSMf_SEL,a2&SCF_SHIFT);
LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
psm.cur_note=psm.cur_note->next;
}
}
break;
case SC_DELETE:
if (a2&SCF_SHIFT)
if (arg2&SCF_SHIFT)
PsmCutToClipboard;
else {
tmpn=psm.cur_note;
@@ -576,9 +554,9 @@ mo_got_msg:
}
break;
case SC_INS:
if (a2&SCF_SHIFT)
if (arg2&SCF_SHIFT)
PsmPasteClipboard;
else if (a2&SCF_CTRL)
else if (arg2&SCF_CTRL)
PsmCopyToClipboard;
break;
case SC_F1:
@@ -615,7 +593,7 @@ mo_got_msg:
if (filename) {
psm.scrn_x=0;
psm_duration=1.0;
psm_octave=3;
psm_octave=4;
PsmSongDel(&psm.head);
psm.cur_note=&psm.head;
PsmLoadSong(filename,&psm_octave,&psm_duration);
@@ -645,7 +623,7 @@ mo_got_msg:
Free(filename);
filename=NULL;
psm_duration=1.0;
psm_octave=3;
psm_octave=4;
PsmSongDel(&psm.head);
psm.cur_note=&psm.head;
psm.scrn_x=0;
@@ -664,19 +642,18 @@ mo_got_msg:
while (tmpn!=&psm.head) {
if (tmpn->type!=PSMT_METER) {
timeout_val=cnts.jiffies;
if (ip.pos_text.y-Fs->win_top<18)
msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN|
1<<MSG_IP_L_DOWN|1<<MSG_IP_R_UP|1<<MSG_CMD);
if (ms.pos_text.y-Fs->win_top<18)
msg_code=ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|
1<<MSG_MS_L_DOWN|1<<MSG_MS_R_UP|1<<MSG_CMD);
else
msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN|
1<<MSG_IP_L_DOWN|1<<MSG_CMD);
msg_code=ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|
1<<MSG_MS_L_DOWN|1<<MSG_CMD);
if (msg_code) {
f=0;
Snd(0);
Snd;
psm.playing=FALSE;
was_playing=TRUE;
if (ip.pos_text.y-Fs->win_top>=18 &&
msg_code==MSG_IP_L_DOWN)
if (ms.pos_text.y-Fs->win_top>=18 &&
msg_code==MSG_MS_L_DOWN)
goto mo_start;
else
goto mo_got_msg;
@@ -685,16 +662,7 @@ mo_got_msg:
psm.scrn_x+=tmpn->x-0.33*GR_WIDTH;
if (PsmHasWords(tmpn->word))
"%s",tmpn->word;
note=tmpn->note;
octave=tmpn->octave;
if (note!=NOTE_REST)
f=Note2Freq(note,octave);
else
f=-1; //rest
if (f>0)
Snd(f);
else
Snd(0);
Snd(tmpn->ona);
music.tempo=4.4*tempo_state.tempo/TEMPO_RANGE+0.5;
music.stacatto_factor=
@@ -709,7 +677,7 @@ mo_got_msg:
d*(1.0-music.stacatto_factor);
}
SleepUntil(timeout_val);
Snd(0);
Snd;
SleepUntil(timeout_val2);
}
tmpn=tmpn->next;
@@ -719,8 +687,7 @@ mo_got_msg:
psm.playing=FALSE;
PsmMenu(psm_octave);
col=0;
f=0;
Snd(0);
Snd;
break;
case CH_BACKSPACE:
tmpn=psm.cur_note->last;
@@ -739,7 +706,7 @@ mo_got_msg:
else {
psm.record_entry->checked=TRUE;
psm_duration=1.0;
psm_octave=3;
psm_octave=4;
psm.scrn_x=0;
}
PsmMenu(psm_octave);
@@ -756,57 +723,55 @@ mo_got_msg:
break;
case MSG_KEY_UP:
evt_time=tS;
f=0;
break;
case MSG_IP_MOVE:
if (a2>18*FONT_HEIGHT)
case MSG_MS_MOVE:
if (arg2>18*FONT_HEIGHT)
Fs->win_inhibit=WIG_USER_TASK_DFT;
else
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER
-WIF_FOCUS_TASK_MENU-WIF_SELF_CTRLS;
break;
case MSG_IP_L_DOWN:
PsmDownKey(a1,a2);
PsmLeftClick(a1,a2);
case MSG_MS_L_DOWN:
PsmDownKey(arg1,arg2);
PsmLeftClick(arg1,arg2);
break;
case MSG_IP_L_UP:
PsmUpKey(a1,a2);
case MSG_MS_L_UP:
PsmUpKey(arg1,arg2);
break;
default:
PsmRightClick(a1,a2);
PsmRightClick(arg1,arg2);
}
if (f!=last_f) {
if (f>0) {
st=LstSub(note,psm_note_lst);
Snd(f);
} else {
if (f<0)
st="R";
else
if (is_null)
ona=ONA_REST;
if (ona!=last_ona || is_null!=was_null) {
if (ona==ONA_REST) {
if (is_null)
st="";
Snd(0);
}
else
st="R";
} else
st=LstSub(Ona2Note(ona),psm_note_lst);
Snd(ona);
if (psm.record_entry->checked) {
if (last_f) {
if (!was_null) {
music.tempo=4.4*tempo_state.tempo/TEMPO_RANGE+0.5;
music.stacatto_factor=0.88*tempo_state.stacatto/TEMPO_RANGE+0.12;
tmpn->duration=PsmCvtDuration(
music.tempo*(evt_time-note_down_time));
PsmSetWidth(tmpn);
QueIns(tmpn,psm.cur_note->last);
}
if (f) {
if (!is_null) {
note_down_time=tS;
tmpn=CAlloc(sizeof(PsmNote));
tmpn->type=PSMT_NOTE;
tmpn->note=note;
tmpn->octave=octave;
tmpn->ona=ona;
if (st[1]=='#')
Bts(&tmpn->flags,PSMf_SHARP);
}
}
last_f=f;
last_ona=ona;
was_null=is_null;
"%s",st;
col+=StrLen(st);
if (col>=Fs->win_width-1) {