LTCD_060719.ISO
This commit is contained in:
commit
f86e69648b
156 files changed
+49537
No files matched your search
@@ -0,0 +1,82 @@
|
||||
I1 *cur_song=NULL;
|
||||
TssStruct *cur_song_tss=NULL;
|
||||
U8 music_octive;
|
||||
double music_note_len;
|
||||
U1 music_note_map[7]={0,2,3,5,7,8,10};
|
||||
|
||||
public double music_tempo,music_stacatto_factor=1.0;
|
||||
|
||||
I1 *MusicSetOctive(I1 *st)
|
||||
{
|
||||
I1 ch=*st++;
|
||||
while (ch>='0' && ch<='9') {
|
||||
music_octive=ch-'0';
|
||||
ch=*st++;
|
||||
}
|
||||
return --st;
|
||||
}
|
||||
|
||||
I1 *MusicSetNoteLen(I1 *st)
|
||||
{
|
||||
BoolU4 cont=TRUE;
|
||||
do {
|
||||
switch (*st++) {
|
||||
case 'w': music_note_len=4.0; break;
|
||||
case 'h': music_note_len=2.0; break;
|
||||
case 'q': music_note_len=1.0; break;
|
||||
case 'e': music_note_len=0.5; break;
|
||||
case 's': music_note_len=0.25; break;
|
||||
case 't': music_note_len=2.0*music_note_len/3.0; break;
|
||||
case '.': music_note_len=1.5*music_note_len; break;
|
||||
default:
|
||||
st--;
|
||||
cont=FALSE;
|
||||
}
|
||||
} while (cont);
|
||||
return st;
|
||||
}
|
||||
|
||||
public void Play(I1 *st,I1 *words=NULL)
|
||||
{
|
||||
I1 *word;
|
||||
U8 note,i=0;
|
||||
double f;
|
||||
while (*st) {
|
||||
st=MusicSetOctive(st);
|
||||
st=MusicSetNoteLen(st);
|
||||
st=MusicSetOctive(st);
|
||||
if (!*st) break;
|
||||
note=*st++-'A';
|
||||
if (note<7) {
|
||||
note=music_note_map[note];
|
||||
if (*st=='b') {
|
||||
note--;
|
||||
st++;
|
||||
} else if (*st=='#') {
|
||||
note++;
|
||||
st++;
|
||||
}
|
||||
f=2.0`(6+music_octive+(note-3)/12.0);
|
||||
} else
|
||||
f=0;
|
||||
if (words) {
|
||||
if (word=PointAtListEntry(i++,words))
|
||||
if (StrCmp(word," "))
|
||||
PutS(word);
|
||||
}
|
||||
Sound(f);
|
||||
Sleep(1000*music_stacatto_factor*music_note_len/music_tempo);
|
||||
Sound(0);
|
||||
Sleep(1000*(1.0-music_stacatto_factor)*music_note_len/music_tempo);
|
||||
}
|
||||
}
|
||||
|
||||
void ResetMusicSettings()
|
||||
{
|
||||
music_stacatto_factor=1.0;
|
||||
music_tempo=2.5;
|
||||
music_octive=3;
|
||||
music_note_len=1.0;
|
||||
}
|
||||
|
||||
ResetMusicSettings;
|
||||
Reference in new issue
Block a user