Nightly update (ISO SHA-1 57e189b)

This commit is contained in:
minexew committed 2017-06-21 21:29:18 +02:00
1 parent b0570d4c3d
commit 5eb6057406
48 files changed
+2015 -3025

No files matched your search

Binary file not shown.
+1 -1
View File
@@ -15,7 +15,7 @@ U0 LoadDocDefines()
//$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.HC,DD_BOOT_HIGH_LOC_DVD"$
$TR,"LineRep"$
$ID,2$DefinePrint("DD_TEMPLEOS_LOC","80,800");
$ID,2$DefinePrint("DD_TEMPLEOS_LOC","80,845");
$ID,-2$
DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR);
DefinePrint("DD_MP_VECT_END","%08X",
@@ -4,8 +4,6 @@ which will regenerate processed dictionary
files from a raw Project Gutenberg
dictionary file.
$TX,"http://www.templeos.org/files/DICTIONARY.DD",HTML="http://www.templeos.org/files/DICTIONARY.DD"$
See $LK,"::/Doc/Credits.DD"$.
*/
+1 -1
View File
@@ -14,7 +14,7 @@ Cd(__DIR__);;
#include "GrBitMap"
#include "GrPrimatives"
#include "GrComposites"
#include "GrMV"
#include "ScrnCast"
#define SPE_ABORT (-1)
#define SPE_EXIT 0
@@ -1,4 +1,4 @@
#help_index "Graphics/Device Contexts;Graphics/GR Files"
#help_index "ScrnCast;Graphics/Device Contexts;Graphics/GR Files"
#define MV_FILE_MAX 0x007FF000
@@ -56,3 +56,41 @@ public I64 GR2MV(U8 *print_fmt="VID%03d.MV",
DCDel(dc_base);
return file_num;
}
#help_index "ScrnCast;Snd/AU Files"
public U0 SndShift(CSndData *head,F64 dt=0)
{//Shift CSndData in time.
CSndData *tmpsd,*tmpsd1;
if (dt) {
tmpsd=head->next;
while (tmpsd!=head) {
tmpsd1=tmpsd->next;
tmpsd->tS-=dt;
if (tmpsd->tS<tmpsd->last->tS) {
QueRem(tmpsd);
Free(tmpsd);
}
tmpsd=tmpsd1;
}
}
}
public I64 AUWrite(U8 *filename,CSndData *head,CDate *t0_now,F64 t0_tS)
{//Write AU file.
CSndData *tmpsd;
CAUData *base,*dst;
I64 size=(1+QueCnt(head))*sizeof(CAUData);
U8 *st=ExtDft(filename,"AU");
base=dst=MAlloc(size);
tmpsd=head;
do {
dst->cdt=t0_now(I64)+ToI64(CDATE_FREQ*(tmpsd->tS-t0_tS));
dst->ona=tmpsd->ona;
dst++;
tmpsd=tmpsd->next;
} while (tmpsd!=head);
FileWrite(st,base,dst(U8 *)-base(U8 *));
Free(base);
Free(st);
return size;
}
-386
View File
@@ -1,386 +0,0 @@
#help_index "Graphics/Windows BMP Files"
#define BMP_COLORS_NUM 16
class CFileBMP
{
U16 type;
U32 file_size;
U32 reserved;
U32 data_offset;
U32 header_size;
U32 width;
U32 height;
U16 planes;
U16 bit_cnt;
U32 compression;
U32 image_size;
U32 x_pixs_per_meter;
U32 y_pixs_per_meter;
U32 colors_used;
U32 important_colors;
U0 end;
CBGR24 palette[BMP_COLORS_NUM];
};
public CFileBMP *BMP4To(CDC *dc)
{//To Windows 4-bit BMP.
U8 *src,*ptr;
CBGR48 palette[COLORS_NUM];
I64 i,x,y,w=dc->width>>1,
size=sizeof(CFileBMP)+dc->width*dc->height>>1;
CFileBMP *bmp =CAlloc(size);
bmp->type ='BM';
bmp->planes =1;
bmp->file_size=size;
bmp->data_offset=sizeof(CFileBMP);
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
bmp->width =dc->width;
bmp->height =dc->height;
bmp->bit_cnt =4;
bmp->image_size=dc->width*dc->height>>1;
GrPaletteGet(palette);
#assert COLORS_NUM==BMP_COLORS_NUM
for (i=0;i<BMP_COLORS_NUM;i++) {
bmp->palette[i].b=palette[i].b>>8;
bmp->palette[i].g=palette[i].g>>8;
bmp->palette[i].r=palette[i].r>>8;
bmp->palette[i].pad=0;
}
ptr=bmp(U8 *)+bmp->data_offset;
for (y=dc->height-1;y>=0;y--) {
src=y*dc->width_internal+dc->body;
for (x=0;x<w;x++) {
*ptr|=(*src++&15)<<4;
*ptr|=*src++&15;
ptr++;
}
}
return bmp;
}
public CFileBMP *BMPRLE4To(CDC *dc)
{//To Windows RLE4 bit BMP.
U8 *src,*ptr,*start;
I64 i,x,y,w=dc->width,cnt,pattern;
CBGR48 palette[COLORS_NUM];
CFileBMP *bmp =CAlloc(sizeof(CFileBMP)+2*(dc->width+1)*dc->height);
bmp->type ='BM';
bmp->planes =1;
bmp->data_offset=sizeof(CFileBMP);
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
bmp->width =dc->width;
bmp->height =dc->height;
bmp->bit_cnt =4;
bmp->compression=2; //RLE4
GrPaletteGet(palette);
#assert COLORS_NUM==BMP_COLORS_NUM
for (i=0;i<BMP_COLORS_NUM;i++) {
bmp->palette[i].b=palette[i].b>>8;
bmp->palette[i].g=palette[i].g>>8;
bmp->palette[i].r=palette[i].r>>8;
bmp->palette[i].pad=0;
}
start=ptr=bmp(U8 *)+bmp->data_offset;
for (y=dc->height-1;y>=0;y--) {
src=y*dc->width_internal+dc->body;
x=0;
while (x<w) {
pattern=(src[0]&15)<<4+src[1]&15;
if (x+1<w && src[0]&15==src[1]&15) {
src+=2;
cnt=2;
x+=2;
while (x<w && cnt<U8_MAX) {
if (*src&15==pattern&15) {
src++;
cnt++;
x++;
} else
break;
}
} else {
src+=2;
if (x+1<w)
cnt=2;
else
cnt=1;
x+=2;
}
*ptr++=cnt;
*ptr++=pattern;
}
*ptr(U16 *)++=0;
}
bmp->image_size=ptr-start;
bmp->file_size=sizeof(CFileBMP)+bmp->image_size;
return bmp;
}
public CFileBMP *BMP24To(CDC *dc)
{//To Windows 24-bit BMP.
U8 *src;
I64 i,x,y,size=offset(CFileBMP.end)+dc->width*dc->height*sizeof(CBGR24);
CBGR24 *bgr;
CFileBMP *bmp =CAlloc(size);
bmp->type ='BM';
bmp->planes =1;
bmp->file_size=size;
bmp->data_offset=offset(CFileBMP.end);
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
bmp->width =dc->width;
bmp->height =dc->height;
bmp->bit_cnt =32;
bmp->image_size=dc->width*dc->height<<2;
bgr=bmp(U8 *)+bmp->data_offset;
for (y=dc->height-1;y>=0;y--) {
src=y*dc->width_internal+dc->body;
for (x=0;x<dc->width;x++) {
i=*src++;
if (i&BLUE) bgr->b=0x7F;
if (i&GREEN) bgr->g=0x7F;
if (i&RED) bgr->r=0x7F;
if (i&8) {
if (bgr->b) bgr->b=0xFF;
if (bgr->g) bgr->g=0xFF;
if (bgr->r) bgr->r=0xFF;
}
bgr(U8 *)+=4;
}
}
return bmp;
}
public I64 BMPWrite(U8 *filename,CDC *dc,I64 bits=4)
{//Window's BMP Files.
I64 size;
CFileBMP *bmp;
if (bits==4) {
if (IsDotZ(filename)) //.Z compression is better than RLE
bmp=BMP4To(dc);
else {
bmp=BMPRLE4To(dc);
if (bmp->file_size>sizeof(CFileBMP)+dc->width*dc->height>>1) {
Free(bmp);
bmp=BMP4To(dc);
}
}
} else if (bits==24)
bmp=BMP24To(dc);
else {
"Format Not Supported.\n";
return 0;
}
size=bmp->file_size;
FileWrite(filename,bmp,bmp->file_size);
Free(bmp);
return size;
}
U8 *BMPPaletteNew(CFileBMP *bmp)
{
I64 i,j,best,score,best_score;
CBGR48 palette[COLORS_NUM];
U8 *res=CAlloc(BMP_COLORS_NUM*sizeof(U8));
GrPaletteGet(palette);
#assert COLORS_NUM==BMP_COLORS_NUM
for (i=0;i<BMP_COLORS_NUM;i++) {
best=i;
best_score=I64_MAX;
for (j=0;j<BMP_COLORS_NUM;j++) {
score=SqrI64(bmp->palette[i].r-palette[j].r>>8)+
SqrI64(bmp->palette[i].g-palette[j].g>>8)+
SqrI64(bmp->palette[i].b-palette[j].b>>8);
if (score<best_score) {
best=j;
best_score=score;
}
}
res[i]=best;
}
return res;
}
U8 ms_paint_palette[BMP_COLORS_NUM]={0,4,2,6,1,5,3,8,7,12,10,14,9,13,11,15};
I64 BMP24Color(CBGR24 *ptr,Bool dither_probability)
{
I64 res,k;
if (dither_probability) {
k=RandU32;
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=3*SqrI64(k.u8[0]))
res=8;
else
res=0;
if (ptr->r>=k.u8[1]) res|=RED;
if (ptr->g>=k.u8[2]) res|=GREEN;
if (ptr->b>=k.u8[3]) res|=BLUE;
} else {
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=SqrI64(0x80)) {
res=8;
if (ptr->r>=0x80) res|=RED;
if (ptr->g>=0x80) res|=GREEN;
if (ptr->b>=0x80) res|=BLUE;
} else {
res=0;
if (ptr->r>=0x40) res|=RED;
if (ptr->g>=0x40) res|=GREEN;
if (ptr->b>=0x40) res|=BLUE;
}
}
return res;
}
public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
Bool use_ms_paint_palette=FALSE)
{//Window's BMP Files.
I64 i,j,cnt;
U8 *palette_map,*ptr;
Bool rle;
CFileBMP *bmp;
CDC *res=NULL;
if (ptr=FileRead(filename)) {
bmp=ptr;
if (0<bmp->width<I32_MAX && 0<bmp->height<I32_MAX) {
res=DCNew(bmp->width,bmp->height);
ptr+=bmp->data_offset;
if (bmp->compression==2)
rle=TRUE;
else
rle=FALSE;
if (use_ms_paint_palette)
palette_map=ms_paint_palette;
else
palette_map=BMPPaletteNew(bmp);
if (bmp->bit_cnt==4) {
for (i=bmp->height-1;i>=0;i--)
if (rle) {//We don't support full RLE4, just our own subset
j=0;
while (cnt=*ptr++) {
if (cnt==1) {
res->color=palette_map[*ptr++&15];
GrPlot(res,j++,i);
} else {
if (cnt==2 && *ptr>>4!=*ptr&15) {
res->color=palette_map[*ptr&15];
GrPlot(res,j+1,i);
res->color=palette_map[*ptr>>4];
GrPlot(res,j,i);
ptr++;
j+=2;
} else {
res->color=palette_map[*ptr++&15];
while (cnt--)
GrPlot(res,j++,i);
}
}
}
ptr++;
} else
for (j=0;j<(bmp->width+7)&~7;) {
res->color=palette_map[*ptr&15];
GrPlot(res,j+1,i);
res->color=palette_map[*ptr>>4];
GrPlot(res,j,i);
ptr++;
j+=2;
}
if (!use_ms_paint_palette)
Free(palette_map);
} else if (bmp->bit_cnt==24) {
for (i=bmp->height-1;i>=0;i--) {
for (j=0;j<bmp->width;j++,ptr+=3) {
res->color=BMP24Color(ptr,dither_probability);
GrPlot(res,j,i);
}
ptr+=bmp->width&3;
}
if (!use_ms_paint_palette)
Free(palette_map);
} else if (bmp->bit_cnt>=32) {
for (i=bmp->height-1;i>=0;i--)
for (j=0;j<bmp->width;j++,ptr+=4) {
res->color=BMP24Color(ptr,dither_probability);
GrPlot(res,j,i);
}
if (!use_ms_paint_palette)
Free(palette_map);
} else {
"Format Not Supported.\n";
DCDel(res);
res=NULL;
}
} else
"Invalid BMP File\n";
Free(bmp);
}
return res;
}
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;"\
"DolDoc/Output;StdOut/DolDoc"
public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,
Bool use_ms_paint_palette=FALSE)
{//Put a BMP file into a document as a sprite.
CDC *dc=BMPRead(filename,dither_probability,use_ms_paint_palette);
U8 *elems=DC2Sprite(dc);
DocSprite(doc,elems);
Free(elems);
DCDel(dc);
}
#help_index "Graphics/Windows BMP Files;Graphics/Scrn"
public I64 BMPScrnCapture(U8 *filename,I64 bits=4,Bool include_zoom=TRUE)
{//Capture scrn as BMP file.
CDC *dc=DCScrnCapture(include_zoom);
I64 size=BMPWrite(filename,dc,bits);
DCDel(dc);
return size;
}
public I64 GR2BMPLst(U8 *files_find_mask,U8 *fu_flags=NULL,
U8 *out_print_fmt="~:/Tmp/VID%05d.BMP.Z",F64 fps=30000.0/1001)
{/*Cvt movie from GR lst to BMP lst
"+d" will delete GRLst files.
*/
I64 res=0,fuf_flags=0;
CDirEntry *tmpde,*tmpde1;
CDC *dc,*base=DCNew(GR_WIDTH,GR_HEIGHT);
U8 *st,*last_st;
CDate cdt=I64_MIN;
Bool old_silent;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND);
last_st=MStrPrint(out_print_fmt,0);
progress1_max=LinkedLstCnt(tmpde);
while (tmpde) {
dc=GRRead(tmpde->full_name);
GrBlot(base,dc->x0,dc->y0,dc);
if (cdt==I64_MIN)
cdt=dc->cdt;
while (cdt<=dc->cdt) {
st=MStrPrint(out_print_fmt,res++);
BMPWrite(st,base);
Free(st);
cdt+=CDATE_FREQ/fps;
}
if (fuf_flags&FUF_DEL) {
old_silent=Silent;
Del(tmpde->full_name);
Silent(old_silent);
}
DCDel(dc);
progress1++;
tmpde=tmpde->next;
}
progress1=progress1_max=0;
DirTreeDel(tmpde1);
Free(last_st);
DCDel(base);
return res;
}
+2 -4
View File
@@ -136,10 +136,8 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
if (task==sys_winmgr_task) {
"gr.pen_brushes\t:%010X\n",PenBrushesSize;
"gr.scrn_zoom_tbles\t:%010X\n",ScrnZoomTablesSize;
"winmgr.scrn_cast_dc\t:%010X\n",
DCSize(winmgr.scrn_cast_dc);
"winmgr.dc2_alias\t:%010X\n",
DCSize(winmgr.dc2_alias);
"scrncast.dc\t:%010X\n",DCSize(scrncast.dc);
"scrncast.dc2_alias\t:%010X\n",DCSize(scrncast.dc2_alias);
} else if (task==adam_task) {
j=0;k=0;m=0;n=0;
for (i=0;i<mp_cnt;i++) {
+1 -1
View File
@@ -13,7 +13,7 @@ U0 TOSStaffIns()
"\nDownload TOS_Supplemental1.ISO.C\tfrom http://www.templeos.org\n";
if (PressAKey!=CH_SHIFT_ESC) {
if (HostChgDsk("/home/tad/TOS_Supplemental1.ISO.C"))
if (HostChgDsk("/home/tad/Downloads/TOS_Supplemental1.ISO.C"))
CopyTree("T:/","~/Sup1");
Once("TOSBootHDIns;");
-21
View File
@@ -1,21 +0,0 @@
Cd(__DIR__);;
#help_index "Snd"
class CSndWaveCtrl
{
I64 sample_rate,sample_bits,channels;
F64 freq_multiplier,amp_multiplier;
F64 phase,last_y,last_dydt,next_y;
};
public U0 SndTaskEndCB()
{//Will turn-off snd when a task gets killed.
Snd;
Exit;
}
#include "SndMath"
#include "SndMusic"
#include "SndEffects"
#include "SndFile"
Cd("..");;
-80
View File
@@ -1,80 +0,0 @@
#help_index "Snd"
#define SE_NOISE 0
#define SE_SWEEP 1
class CSoundEffectFrame
{
I32 type;
I8 ona1,ona2;
F64 duration;
};
U0 SoundEffectEndTaskCB()
{
Free(FramePtr("CSoundEffectFrame"));
music.mute--;
SndTaskEndCB;
}
U0 SoundEffectTask(CSoundEffectFrame *ns)
{
I64 i,ona;
F64 t0=tS,t,timeout=t0+ns->duration;
FramePtrAdd("CSoundEffectFrame",ns);
Fs->task_end_cb=&SoundEffectEndTaskCB;
switch (ns->type) {
case SE_NOISE:
i=MaxI64(ns->ona2-ns->ona1,1);
while (tS<timeout) {
ona=RandU16%i+ns->ona1;
Snd(ona);
t=Clamp(3000.0/Ona2Freq(ona),1.0,50.0);
if (t+tS>timeout)
t=timeout-tS;
Sleep(t);
}
break;
case SE_SWEEP:
while (tS<timeout) {
t=(tS-t0)/ns->duration;
ona=(1.0-t)*ns->ona1+t*ns->ona2;
Snd(ona);
t=Clamp(3000.0/Ona2Freq(ona),1.0,50.0);
if (t+tS>timeout)
t=timeout-tS;
Sleep(t);
}
break;
}
}
public CTask *Noise(I64 mS,F64 min_ona,F64 max_ona)
{//Make white noise for given number of mS.
CSoundEffectFrame *ns;
if (mS>0) {
ns=MAlloc(sizeof(CSoundEffectFrame));
ns->type=SE_NOISE;
ns->duration=mS/1000.0;
ns->ona1=min_ona;
ns->ona2=max_ona;
music.mute++;
return Spawn(&SoundEffectTask,ns,"Noise",,Fs);
} else
return NULL;
}
public CTask *Sweep(I64 mS,F64 ona1,F64 ona2)
{//Sweep through freq range in given number of mS.
CSoundEffectFrame *ns;
if (mS>0) {
ns=MAlloc(sizeof(CSoundEffectFrame));
ns->type=SE_SWEEP;
ns->duration=mS/1000.0;
ns->ona1=ona1;
ns->ona2=ona2;
music.mute++;
return Spawn(&SoundEffectTask,ns,"Noise",,Fs);
} else
return NULL;
}
-137
View File
@@ -1,137 +0,0 @@
#help_index "Snd/Snd Files"
#define SNDFILE_SAMPLE_RATE 8000
//Header for a ".SND" file
class CFileSND
{//big endian
U32 signature; //0x646e732e
U32 offset; //24
U32 data_size;
U32 coding; //3=16bit uncompressed
U32 sample_rate; //Hz
U32 channels; //1=mono
I16 body[1];
};
//Windows media constraint.
//#define SND_FILE_DATA_MAX 0x0007FF00
#define SND_FILE_DATA_MAX 0x7FFFFF00
public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,
F64 averaging=0.0,I64 waveform=WF_SQUARE,
F64 reverb_delay=0,F64 reverb_intensity=0,F64 time_shift=0)
{//Use "snd.record" flag to start or stop recording, then call this routine.
//Averaging should be a num from 0.0 to 0.999.
//Vol should be from 0.0 to 1.0.
//Set reverb_delay to like 0.3 sec and reverb_intensity to like 0.4.
I64 i,i1,k,cnt,cnt2,level,file_num;
F64 avg,dt;
CFileSND *s;
CSndWaveCtrl *swc=SndWaveCtrlNew(SNDFILE_SAMPLE_RATE,16,1);
CSndData *d,*d1;
U8 *name,*name2;
snd.record=FALSE;
dt=snd.record_head.last->time-snd.record_head.next->time;
if (!dt) return 0;
cnt=dt*SNDFILE_SAMPLE_RATE;
cnt++; //Terminator
name=StrNew(base_filename);
FileExtRem(name);
s=CAlloc(offset(CFileSND.body)+cnt*sizeof(I16));
s->signature=0x646e732e;
s->offset=EndianU32(offset(CFileSND.body));
s->coding=EndianU32(3);
s->sample_rate=EndianU32(SNDFILE_SAMPLE_RATE);
s->channels=EndianU32(1);
if (time_shift) {
d=snd.record_head.next;
d->time-=time_shift;
while (d->next!=&snd.record_head) {
d1=d->next;
dt=d1->time-d->time;
if (dt<0) {
QueRem(d1);
Free(d1);
} else
break;
}
}
d=snd.record_head.next;
k=0;
i=d->time*SNDFILE_SAMPLE_RATE;
while (d->next!=&snd.record_head) {
d1=d->next;
i1=d1->time*SNDFILE_SAMPLE_RATE;
if (i1-i) {
SndWaveAddBuf(swc,&s->body[k],i1-i,
Ona2Freq(d->ona),waveform,normalized_vol);
k+=i1-i;
i=i1;
}
QueRem(d);
Free(d);
d=d1;
}
//Average
if (averaging) {
avg=0;
for (i=0;i<cnt-1;i++)
s->body[i]=avg=LowPass1(averaging,avg,s->body[i],1.0);
}
//Reverb
if (reverb_intensity) {
if (dt=reverb_delay*SNDFILE_SAMPLE_RATE)
for (i=dt;i<cnt;i++)
s->body[i]+=reverb_intensity*s->body[i-dt];
}
//Get rid of D.C. component
for (k=0;k<3;k++) {
level=0;
for (i=0;i<cnt-1;i++)
level+=s->body[i];
level/=cnt-1;
for (i=0;i<cnt-1;i++)
s->body[i]=ClampI64(s->body[i]-level,I16_MIN,I16_MAX);
}
for (i=0;i<cnt-1;i++)
s->body[i]=EndianU16(s->body[i]);
s->body[cnt-1]=0;
d=snd.record_head.next;
while (d!=&snd.record_head) {
d1=d->next;
QueRem(d);
Free(d);
d=d1;
}
name2=MAlloc(StrLen(name)+3+1+3+1);
cnt2=cnt;
file_num=0;
while (cnt2>0) {
i=cnt2;
if (i>SND_FILE_DATA_MAX)
i=SND_FILE_DATA_MAX;
s->data_size=EndianU32(i*sizeof(I16));
MemCpy(s->body,&s->body[file_num*SND_FILE_DATA_MAX],i*sizeof(I16));
StrPrint(name2,"%s%03d.SND",name,file_num++);
FileWrite(name2,s,offset(CFileSND.body)+i*sizeof(I16));
cnt2-=i;
}
Free(s);
Free(name);
Free(name2);
SndWaveCtrlDel(swc);
return cnt;
}
-248
View File
@@ -1,248 +0,0 @@
#help_index "Snd/Math;Math"
public F64 Saw(F64 t,F64 period)
{//Sawtooth. 0.0 - 1.0 think "(Sin+1)/2"
if (period) {
if (t>=0.0)
return t%period/period;
else
return 1.0+t%period/period;
} else
return 0.0;
}
public F64 FullSaw(F64 t,F64 period)
{//Plus&Minus Sawtooth. 1.0 - -1.0 think "Sin"
if (period) {
if (t>=0.0)
return 2.0*(t%period/period)-1.0;
else
return 2.0*(t%period/period)+1.0;
} else
return 0.0;
}
public F64 Caw(F64 t,F64 period)
{//Cawtooth. 1.0 - 0.0 think "(Cos+1)/2"
if (period) {
if (t>=0.0)
return 1.0-t%period/period;
else
return -(t%period)/period;
} else
return 1.0;
}
public F64 FullCaw(F64 t,F64 period)
{//Plus&Minus Cawtooth. 1.0 - -1.0 think "Cos"
if (period) {
if (t>=0.0)
return -2.0*(t%period/period)+1.0;
else
return -2.0*(t%period/period)-1.0;
} else
return 1.0;
}
public F64 Tri(F64 t,F64 period)
{//Triangle waveform. 0.0 - 1.0 - 0.0
if (period) {
t=2.0*(Abs(t)%period)/period;
if (t<=1.0)
return t;
else
return 2.0-t;
} else
return 0.0;
}
public F64 FullTri(F64 t,F64 period)
{//Plus&Minus Triangle waveform. 0.0 - 1.0 - 0.0 - -1.0 -0.0
if (period) {
t=4.0*(t%period)/period;
if (t<=-1.0) {
if (t<=-3.0)
return t+4.0;
else
return -2.0-t;
} else {
if (t<=1.0)
return t;
else if (t<=3.0)
return 2.0-t;
else
return t-4.0;
}
} else
return 0.0;
}
#help_index "Snd/Math"
public I8 Note2Ona(I64 note,I64 octave=4)
{//Note to ona. Mid C is ona=51, note=3 and octave=4.
if (note<3)
return (octave+1)*12+note;
else
return octave*12+note;
}
public I8 Ona2Note(I8 ona)
{//Ona to note in octave. Mid C is ona=51, note=3 and octave=4.
return ona%12;
}
public I8 Ona2Octave(I8 ona)
{//Ona to octave. Mid C is ona=51, note=3 and octave=4.
I64 note=ona%12,octave=ona/12;
if (note<3)
return octave-1;
else
return octave;
}
F64 SinPhaseCont(F64 last_y,F64 last_dydt,
F64 current_amp,F64 phase_offset)
{//Next sample of sin waveform.
F64 phase;
phase=last_y/current_amp;
if (phase>1.0) phase=1.0;
if (phase<-1.0) phase=-1.0;
if (last_dydt<0)
phase=ã-ASin(phase);
else
phase=ASin(phase);
return phase-phase_offset;
}
public CSndWaveCtrl *SndWaveCtrlNew(I64 sample_rate=8000,I64 sample_bits=24,
I64 channels=2,CTask *mem_task=NULL)
{//MAlloc ctrl struct for generating waveforms.
CSndWaveCtrl *swc=CAlloc(sizeof(CSndWaveCtrl),mem_task);
swc->freq_multiplier=1.0;
swc->amp_multiplier=1.0;
swc->sample_rate=sample_rate;
swc->sample_bits=sample_bits;
swc->channels=channels;
swc->last_dydt=1.0;
return swc;
}
public U0 SndWaveCtrlDel(CSndWaveCtrl *swc)
{//Free waveform ctrl.
Free(swc);
}
#define WF_NULL 0
#define WF_SQUARE 1
#define WF_SINE 2
#define WF_TRI 3
#define WF_SAWTOOTH 4
#define WF_NOISE 5
#define WF_WAVEFORMS_NUM 6
public U0 SndWaveAddBuf(CSndWaveCtrl *swc,U8 *buf,I64 num_samples,
F64 _freq,I64 _waveform=WF_SQUARE,F64 _amp=1.0,F64 _left=1.0, F64 _right=1.0)
{//Add waveform to buffer.
//num_samples is multiplied by channels to get buf_len.
//left,right range from 0.0-1.0
//Supports 16,24 and 32 bits
I64 reg i,reg j,reg k;
F64 a,f,amp,reg phase;
if (!swc) return;
_freq*=swc->freq_multiplier;
_amp*=swc->amp_multiplier;
if (!_freq||!_amp) {
swc->last_y=swc->phase=0;
swc->last_dydt=1.0;
} else {
phase=swc->phase;
i=0;
amp=Min(I32_MAX,I32_MAX*_amp);
f=2*ã/swc->sample_rate*_freq;
switch (_waveform) {
case WF_NOISE:
a=2.0/ã*amp;
break;
case WF_SAWTOOTH:
a=amp/ã;
break;
case WF_SINE:
phase=SinPhaseCont(swc->last_y,swc->last_dydt,amp,0.0);
break;
}
while (phase<0)
phase+=2*ã;
while (phase>=2*ã)
phase-=2*ã;
num_samples*=swc->channels;
while (i<num_samples) {
switch (_waveform) {
case WF_SQUARE:
if (phase>=ã)
j=-amp;
else
j=amp;
break;
case WF_SINE:
j=amp*Sin(phase);
break;
case WF_TRI:
if (phase>=ã) {
swc->last_y=swc->next_y;
swc->next_y=-amp*Sign(swc->last_y)+.00001;
phase-=ã;
}
j=(swc->last_y*(ã-phase)+swc->next_y*phase)/ã;
break;
case WF_SAWTOOTH:
j=a*(phase-ã);
break;
case WF_NOISE:
if (phase<ã) {
if (phase<f) {
swc->last_y=swc->next_y;
swc->next_y=a*RandI16/U16_MAX;
}
j=swc->last_y*(ã-phase)+swc->next_y*phase;
} else {
if (phase-ã<f) {
swc->last_y=swc->next_y;
swc->next_y=a*RandI16/U16_MAX;
}
j=swc->last_y*(2.0*ã-phase)+swc->next_y*(phase-ã);
}
break;
}
//left channel
k=j*_left;
if (swc->sample_bits==16) {
k>>=16;
buf(I16 *)[i++]+=k;
} else {
if (swc->sample_bits==24)
k&=0xFFFFFF00;
buf(I32 *)[i++]+=k;
}
//right channel
if (swc->channels==2) {
k=j*_right;
if (swc->sample_bits==16) {
k>>=16;
buf(I16 *)[i++]+=k;
} else {
if (swc->sample_bits==24)
k&=0xFFFFFF00;
buf(I32 *)[i++]+=k;
}
}
phase+=f;
while (phase>=2*ã)
phase-=2*ã;
}
if (_waveform==WF_SINE) {
swc->last_y=amp*Sin(phase);
swc->last_dydt=Cos(phase);
}
swc->phase=phase;
}
}
-224
View File
@@ -1,224 +0,0 @@
#help_index "Snd/Music"
public class CMusicGlbls
{
U8 *cur_song;
CTask *cur_song_task;
I64 octave;
F64 note_len;
U8 note_map[7];
Bool mute;
I64 meter_top,meter_bottom;
F64 tempo,stacatto_factor;
//If you wish to sync with a
//note in a Play() string. 0 is the start
I64 play_note_num;
F64 tM_correction,last_Beat,last_tM;
} music={NULL,NULL,4,1.0,{0,2,3,5,7,8,10},FALSE,4,4,2.5,0.9,0,0,0,0};
#help_index "Snd/Music;Time/Seconds"
public F64 tM()
{//Time in seconds synced to music subsystem.
return (cnts.jiffies+music.tM_correction)/JIFFY_FREQ;
}
public F64 Beat()
{//Time in music beats.
F64 res,cur_tM;
PUSHFD
CLI
if (mp_cnt>1)
while (LBts(&sys_semas[SEMA_TMBEAT],0))
PAUSE
cur_tM=tM;
res=music.last_Beat;
if (music.tempo)
res+=(cur_tM-music.last_tM)*music.tempo;
music.last_tM=cur_tM;
music.last_Beat=res;
LBtr(&sys_semas[SEMA_TMBEAT],0);
POPFD
return res;
}
#help_index "Snd/Music"
U8 *MusicSetOctave(U8 *st)
{
I64 ch;
ch=*st++;
while ('0'<=ch<='9') {
music.octave=ch-'0';
ch=*st++;
}
return --st;
}
U8 *MusicSetMeter(U8 *st)
{
I64 ch;
ch=*st++;
while (ch=='M') {
ch=*st++;
if ('0'<=ch<='9') {
music.meter_top=ch-'0';
ch=*st++;
}
if (ch=='/')
ch=*st++;
if ('0'<=ch<='9') {
music.meter_bottom=ch-'0';
ch=*st++;
}
}
return --st;
}
U8 *MusicSetNoteLen(U8 *st)
{
Bool 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 U0 Play(U8 *st,U8 *words=NULL)
{/* Notes are entered with a capital letter.
Octaves are entered with a digit and
stay set until changed. Mid C is octave 4.
Durations are entered with
'w' whole note
'h' half note
'q' quarter note
'e' eighth note
't' sets to 2/3rds the current duration
'.' sets to 1.5 times the current duration
durations stay set until changed.
'(' tie, placed before the note to be extended
$LK,"music.meter_top",A="MN:CMusicGlbls"$,$LK,"music.meter_bottom",A="MN:CMusicGlbls"$ is set with
"M3/4"
"M4/4"
etc.
Sharp and flat are done with '#' or 'b'.
The var music.stacatto_factor can
be set to a range from 0.0 to 1.0.
The var music.tempo is quarter-notes
per second. It defaults to
2.5 and gets faster when bigger.
*/
U8 *word,*last_st;
I64 note,octave,i=0,ona,timeout_val,timeout_val2;
Bool tie;
F64 d,on_jiffies,off_jiffies;
music.play_note_num=0;
while (*st) {
timeout_val=cnts.jiffies;
tie=FALSE;
do {
last_st=st;
if (*st=='(') {
tie=TRUE;
st++;
} else {
st=MusicSetMeter(st);
st=MusicSetOctave(st);
st=MusicSetNoteLen(st);
}
} while (st!=last_st);
if (!*st) break;
note=*st++-'A';
if (note<7) {
note=music.note_map[note];
octave=music.octave;
if (*st=='b') {
note--;
if (note==2)
octave--;
st++;
} else if (*st=='#') {
note++;
if (note==3)
octave++;
st++;
}
ona=Note2Ona(note,octave);
} else
ona=ONA_REST;
if (words && (word=LstSub(i++,words)) && StrCmp(word," "))
"%s",word;
d=JIFFY_FREQ*music.note_len/music.tempo;
if (tie) {
on_jiffies =d;
off_jiffies =0;
} else {
on_jiffies =d*music.stacatto_factor;
off_jiffies =d*(1.0-music.stacatto_factor);
}
timeout_val+=on_jiffies;
timeout_val2=timeout_val+off_jiffies;
if (!music.mute)
Snd(ona);
SleepUntil(timeout_val);
music.tM_correction+=on_jiffies-ToI64(on_jiffies);
if (!music.mute)
Snd;
SleepUntil(timeout_val2);
music.tM_correction+=off_jiffies-ToI64(off_jiffies);
music.play_note_num++;
}
}
U0 MusicSettingsRst()
{
music.play_note_num=0;
music.stacatto_factor=0.9;
music.tempo=2.5;
music.octave=4;
music.note_len=1.0;
music.meter_top=4;
music.meter_bottom=4;
SndRst;
PUSHFD
CLI
if (mp_cnt>1)
while (LBts(&sys_semas[SEMA_TMBEAT],0))
PAUSE
music.last_tM=tM;
music.last_Beat=0.0;
LBtr(&sys_semas[SEMA_TMBEAT],0);
POPFD
}
MusicSettingsRst;
U0 CurSongTask()
{
Fs->task_end_cb=&SndTaskEndCB;
while (TRUE)
Play(music.cur_song);
}
Binary file not shown.
+1 -2
View File
@@ -6,8 +6,7 @@ CMsStateGlbls old_ms={{-1000,-1000,0},{-1000,-1000,0},{-1000,-1000,0},
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE
};
public CWinMgrGlbls winmgr={0,0,0,WINMGR_FPS,tS,tS,NULL,
Now,tS,NULL,NULL,NULL,FALSE,FALSE,FALSE,FALSE};
public CWinMgrGlbls winmgr={0,0,0,WINMGR_FPS,tS,tS,NULL,FALSE,FALSE,FALSE};
winmgr.t=CAlloc(sizeof(CWinMgrTimingGlbls));
winmgr.t->last_calc_idle_time=tS;
+17 -35
View File
@@ -31,24 +31,6 @@ public U0 Refresh(I64 cnt=1,Bool force=FALSE)
LBEqu(&Fs->task_flags,TASKf_IDLE,old_idle);
}
#help_index "Windows;Cmd Line (Typically)"
public Bool ScrnCast(Bool val=ON,U8 *print_fmt="B:/Tmp/%X.GR")
{//WinMgr saves GR files to a dir.
Bool old_val;
if (val) {
if (!(old_val=LBtr(&winmgr.scrn_cast,0))) {
Free(winmgr.scrn_cast_print_fmt);
winmgr.scrn_cast_print_fmt=AStrNew(print_fmt);
winmgr.scrn_cast_now=Now;
winmgr.scrn_cast_tS=tS;
LBts(&winmgr.scrn_cast,0);
}
} else
old_val=LBtr(&winmgr.scrn_cast,0);
return old_val;
}
#help_index "Windows"
I64 WinQueIPMsgs(Bool que)
@@ -288,28 +270,28 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
LBts(&sys_semas[SEMA_REFRESH_IN_PROGRESS],0);
GrUpdateScrn;
LBtr(&sys_semas[SEMA_REFRESH_IN_PROGRESS],0);
if (winmgr.scrn_cast) {
cdt=winmgr.scrn_cast_now+ToI64(CDATE_FREQ*(tS-winmgr.scrn_cast_tS));
if (!winmgr.scrn_cast_dc) {
winmgr.scrn_cast_dc=DCCopy(winmgr.dc2_alias);
winmgr.scrn_cast_dc->cdt=cdt;
st=MStrPrint(winmgr.scrn_cast_print_fmt,cdt);
GRWrite(st,winmgr.scrn_cast_dc);
if (scrncast.record && !scrncast.just_audio) {
cdt=scrncast.t0_now(I64)+ToI64(CDATE_FREQ*(tS-scrncast.t0_tS));
if (!scrncast.dc) {
scrncast.dc=DCCopy(scrncast.dc2_alias);
scrncast.dc->cdt=cdt;
st=MStrPrint(scrncast.print_fmt,cdt);
GRWrite(st,scrncast.dc);
Free(st);
} else if (MemCmp(winmgr.scrn_cast_dc->body,
winmgr.dc2_alias->body,MSize(winmgr.dc2_alias->body))) {
diff=DCDiff(winmgr.scrn_cast_dc,winmgr.dc2_alias);
} else if (MemCmp(scrncast.dc->body,
scrncast.dc2_alias->body,MSize(scrncast.dc2_alias->body))) {
diff=DCDiff(scrncast.dc,scrncast.dc2_alias);
diff->cdt=cdt;
st=MStrPrint(winmgr.scrn_cast_print_fmt,cdt);
st=MStrPrint(scrncast.print_fmt,cdt);
GRWrite(st,diff);
Free(st);
DCDel(diff);
Free(winmgr.scrn_cast_dc->body);
winmgr.scrn_cast_dc->body=MAllocIdent(winmgr.dc2_alias->body);
Free(scrncast.dc->body);
scrncast.dc->body=MAllocIdent(scrncast.dc2_alias->body);
}
} else if (winmgr.scrn_cast_dc) {
DCDel(winmgr.scrn_cast_dc); //TODO: $LK,"MemRep",A="MN:MemRep"$ can crash.
winmgr.scrn_cast_dc=NULL;
} else if (scrncast.dc) {
DCDel(scrncast.dc); //TODO: $LK,"MemRep",A="MN:MemRep"$ can crash.
scrncast.dc=NULL;
}
if (sys_focus_task && !Bt(&sys_focus_task->task_flags,TASKf_HAS_SONG)) {
Free(music.cur_song);
@@ -450,7 +432,7 @@ U0 WinMgrTask(I64)
gr.dc->win_task=Fs;
Fs->win_inhibit&=~WIF_SELF_CTRLS;
GrSetUpTables;
winmgr.dc2_alias=DCAlias(gr.dc2);
scrncast.dc2_alias=DCAlias(gr.dc2);
WinZBufUpdate;
LBts(&sys_run_level,RLf_WINMGR);
while (TRUE) {
-14
View File
@@ -165,20 +165,6 @@ $BG$class Frame
#define COURT_BORDER 10
#define COLLISION_DAMP 0.8
/* Viscosity is way bigger than
real air viscosity. In reality
air is approximated by V and V$SY,-3$2$SY,0$
terms and is smaller. However, I use
this to produce a rolling friction
value, too. If you want to see my
best attempt at realistic physics
download SimStructure.
http://www.templeos.org/files/SimStrSetUp.zip
This is just a video game. Relax.
*/
#define AIR_VISCOSITY 0.1
#define GRAVITY_ACCELERATION 500
+1 -1
View File
@@ -1,4 +1,4 @@
#help_index "Snd"
#help_index "Snd/Music/Apps"
Cd(__DIR__);;
#include "JukeBox"
+4 -4
View File
@@ -162,7 +162,7 @@ U0 UnitDirectFire(Unit *tmpu,Unit *target)
facing=0;
DamageDo(target,HitDamage(tmpu,target,facing,range_factor));
}
while (snd.ona!=ONA_REST) //see $LK,"Snd",A="MN:Snd"$()
while (scrncast.ona!=ONA_REST) //see $LK,"Snd",A="MN:Snd"$()
Yield;
target_unit=NULL;
}
@@ -195,7 +195,7 @@ Bool HexOccupy(Bool overrun,Unit *tmpu,Unit *target)
}
if (DamageDo(target,Round(damage))) {
"$$RED$$Success$$FG$$\n";
while (snd.ona!=ONA_REST) //see $LK,"Snd",A="MN:Snd"$()
while (scrncast.ona!=ONA_REST) //see $LK,"Snd",A="MN:Snd"$()
Yield;
return TRUE;
} else {
@@ -203,7 +203,7 @@ Bool HexOccupy(Bool overrun,Unit *tmpu,Unit *target)
VisRecalc(VR_FRIENDLY_UNIT_DIED,tmpu);
alive_cnt[tmpu->player]--;
"$$RED$$Failure$$FG$$\n";
while (snd.ona!=ONA_REST) //see $LK,"Snd",A="MN:Snd"$()
while (scrncast.ona!=ONA_REST) //see $LK,"Snd",A="MN:Snd"$()
Yield;
return FALSE;
}
@@ -267,7 +267,7 @@ U0 IndirectResolveAll()
}
Noise(2000*animation_delay,70,74);
Sleep(2000*animation_delay);
while (snd.ona!=ONA_REST) //see $LK,"Snd",A="MN:Snd"$()
while (scrncast.ona!=ONA_REST) //see $LK,"Snd",A="MN:Snd"$()
Yield;
indirect_explosion=FALSE;
Binary file not shown.
@@ -157,17 +157,17 @@ Bool MyPutKey(I64 ch,I64 sc)
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /FrameGrabber Sync");
else if (fg_on)
FrameGrabberToggle(FALSE,FALSE,FALSE);
FrameGrabberToggle(FALSE,FALSE);
else
FrameGrabberToggle(TRUE,FALSE,FALSE);
FrameGrabberToggle(TRUE,FALSE);
return TRUE;
case 'F': //With sync and intro TOS theme
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /FrameGrabber Intro");
else if (fg_on)
FrameGrabberToggle(FALSE,FALSE,TRUE);
FrameGrabberToggle(FALSE,FALSE);
else
FrameGrabberToggle(TRUE,TRUE,FALSE);
FrameGrabberToggle(TRUE,TRUE);
return TRUE;
case 'h':
if (sc&SCF_KEY_DESC)
Binary file not shown.
@@ -1,5 +1,7 @@
$WW,1$$FG,5$$TX+CX,"TODO"$$FG$
* Compiler Bug: $LK,"AUWrite",A="MN:AUWrite"$() dst->cdt=t0_now+ToI64(CDATE_FREQ*(tmpsd->tS-t0_tS));
* Make MV files combine disjoint rects for same frame.
* God said to reconsider switch start/end, perhaps preface portion?
+1 -1
View File
@@ -60,7 +60,7 @@ $ID,-2$$TR,"Titanium"$
$ID,2$I64 best_score=16469;
$ID,-2$$TR,"TOSRegen"$
$ID,2$progress1_tf=0.000;progress2_tf=0.000;
progress3_tf=0.000;progress4_tf=279.384;
progress3_tf=0.000;progress4_tf=341.847;
$ID,-2$$ID,-2$$TR,"Once"$
$ID,2$$TR,"Adam"$
$ID,2$$ID,-2$$TR,"User"$
+8 -8
View File
@@ -221,9 +221,9 @@ U0 UpdateISODocDefines()
try {
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V5.03",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
0.1*(10*Size("D:/TOS_Distro.ISO","+s")/1024/1024));
0.1*(10*Size("D:/Downloads/TOS_Distro.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSCD_K_SIZE",
"%dKB",Size("D:/TOS_Distro.ISO","+s")/1024);
"%dKB",Size("D:/Downloads/TOS_Distro.ISO","+s")/1024);
} catch
Fs->catch_except=TRUE;
}
@@ -270,22 +270,22 @@ U0 TOSRegen2()
TOSProgress("Make Standard Distro ISO");
MakeStdDistro;
DocClear;
Move(TOS_ISO_NAME,"D:/TOS_Distro.ISO");
Move(TOS_ISO_NAME,"D:/Downloads/TOS_Distro.ISO");
TOSProgress("Make Supplemental1 ISO");
RedSeaISO("D:/TOS_Supplemental1","C:/Home/Sup1");
RedSeaISO("D:/Downloads/TOS_Supplemental1","C:/Home/Sup1");
#if MAKE_DBG
TOSProgress("Make Dbg Distro ISO");
MakeDbgDistro;
DocClear;
Move(TOS_ISO_NAME,"D:/TOS_Dbg.ISO");
Move(TOS_ISO_NAME,"D:/Downloads/TOS_Dbg.ISO");
#endif
#if MAKE_STAFF
TOSProgress("Make Staff Distro ISO");
MakeStaffDistro;
DocClear;
Move(TOS_ISO_NAME,"D:/TOS_Staff.ISO");
Move(TOS_ISO_NAME,"D:/Downloads/TOS_Staff.ISO");
#endif
UpdateISODocDefines;
@@ -323,8 +323,8 @@ public U0 TOSPreRegen()
CopyTree("D:/Home/Sup1/Sup1Bin","C:/Home/Sup1/Sup1Bin");
Copy("D:/Home/Sup1/Sup1CodeScraps/Comm/TOSSocket*",
"C:/Home/Sup1/Sup1CodeScraps/Comm");
DelTree("C:/Linux");
CopyTree("D:/Linux","C:/Linux");
DelTree("C:/Downloads/Linux");
CopyTree("D:/Downloads/Linux","C:/Downloads/Linux");
}
public U0 TOSRegen()
+16 -24
View File
@@ -2,56 +2,47 @@
Bool fg_on =FALSE;
I64 CopyVideo(Bool reverb)
I64 CopyVideo()
{
I64 res=0;
F64 delay=0,intensity=0;
Bool old_silent=Silent;
if (reverb) {
delay=0.45;
intensity=0.35;
}
Del("D:/Tmp/*.SND");
Del("D:/Tmp/*.AU");
Del("D:/Tmp/*.MV");
Silent(old_silent);
RunFile("~/Sup1/Sup1Snd/SndFile",,
"D:/Tmp/AUD%03d.SND",0.115,0.0,1,delay,intensity,0.185);
SndShift(&scrncast.snd_head,0.185);
AUWrite("D:/Tmp/AUDIO",&scrncast.snd_head,scrncast.t0_now,scrncast.t0_tS);
QueDel(&scrncast.snd_head,TRUE);
GR2MV("D:/Tmp/VID%03d.MV","B:/Tmp","+d");
return res;
}
#help_index "Misc/TOS"
#help_index "ScrnCast/TOS"
U0 DelScrnShots()
{
Bool old_silent=Silent;
DelTree("B:/Tmp");
DirMk("B:/Tmp");
Del("D:/Tmp/*.SND");
Del("D:/Tmp/*.AU");
Del("D:/Tmp/*.MV");
Del("C:/Tmp/*.SND");
Del("C:/Tmp/*.AU");
Del("C:/Tmp/*.MV");
Silent(old_silent);
}
public U0 FrameGrabberToggle(Bool sync_tone,Bool tos_theme,
Bool reverb,Bool just_audio=FALSE)
Bool just_audio=FALSE)
{//The frame grabber saves GR files to B:/Tmp.
static F64 last_time=0;
if (tS-last_time>3.0) {
last_time=tS;
if (fg_on) {
fg_on=FALSE;
Snd;
wall->record=snd.record=FALSE;
ScrnCast(OFF);
User("CopyVideo(%d);Exit;\n",reverb);
User("CopyVideo;Exit;\n");
} else {
DelScrnShots;
fg_on=TRUE;
if (!just_audio)
ScrnCast(ON);
wall->record=snd.record=TRUE;
Snd;
ScrnCast(ON,just_audio);
if (sync_tone) {Beep;}
if (tos_theme) {User("ExeFile(\"~/TOS/TOSTheme\");Exit;\n");}
}
@@ -61,19 +52,19 @@ public U0 FrameGrabberToggle(Bool sync_tone,Bool tos_theme,
public U0 JukeSong(I64 num,I64 passes=2)
{//Make movie of one song.
if (!fg_on)
FrameGrabberToggle(FALSE,FALSE,FALSE);
FrameGrabberToggle(FALSE,FALSE);
JukeSongsPuppet("~/Sup1/Sup1Hymns",passes,num,num+1);
if (fg_on)
FrameGrabberToggle(FALSE,FALSE,TRUE);
FrameGrabberToggle(FALSE,FALSE);
}
public U0 JukeLines(I64 start_line,I64 end_line)
{//Make movie of many lines of songs, starting at 0.
if (!fg_on)
FrameGrabberToggle(FALSE,FALSE,FALSE);
FrameGrabberToggle(FALSE,FALSE);
JukeSongsPuppet("~/Sup1/Sup1Hymns",,start_line*5,end_line*5);
if (fg_on)
FrameGrabberToggle(FALSE,FALSE,TRUE);
FrameGrabberToggle(FALSE,FALSE);
}
public U0 TADHymn(I64 num)
@@ -81,6 +72,7 @@ public U0 TADHymn(I64 num)
JukeLines((num-1)*2,num*2);
}
#help_index "Misc/TOS"
public U0 DskChkAll()
{//DskChk on C & D.
U8 *ptr=TOS_HDS;
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
$WW,1$$FG,5$$TX+CX,"The Temple Operating System",HTML="http://www.templeos.org"$$FG,0$
$FG,4$$TX,"Downloads (100% Public Domain)",HTML="http://www.templeos.org/files"$$FG$
$FG,4$$TX,"TempleOS File Downloads (100% Public Domain)",HTML="http://www.templeos.org/Downloads"$$FG$
TempleOS is a free, public domain, open source, x86_64, non-preemptive multi-tasking, multi-cored, ring-0-only, single-address-map (identity-mapped), non-networked, PC operating system. Paging is, basically, not used.
@@ -8,4 +8,4 @@ The CIA obsfucates to foil India, China, Russia and Korea. They make things mor
God said TempleOS must be perfect, so backward compatibility is not promised.
I, Terry Davis, wrote all $TX,"81,281",D="DD_TEMPLEOS_LOC"$ lines of TempleOS over the last $TX,"13.9",D="DD_TEMPLEOS_AGE"$ years, including the 64-bit compiler. I have been a professional operating system developer since 1990 when I worked on Ticketmaster's VAX OS.
I, Terry Davis, wrote all $TX,"80,847",D="DD_TEMPLEOS_LOC"$ lines of TempleOS over the last $TX,"13.9",D="DD_TEMPLEOS_AGE"$ years, including the 64-bit compiler. I have been a professional operating system developer since 1990 when I worked on Ticketmaster's VAX OS.
+1 -3
View File
@@ -18,15 +18,13 @@ $TX,"tdavis@templeos.org",HTML="mailto:tdavis@templeos.org"$
$FG,5$About Me:$FG$
$TX,"ASU_Transcripts",HTML="http://www.templeos.org/files/ASU_Transcripts.pdf"$ $TX,"ASU Course Catalog (See page 261)",HTML="https://catalog.asu.edu/files/shared/archives/1994-1996/general/UG1994-1996.pdf/1994-1996-UG-241-267.pdf"$ $TX,"Dr. David Pheanis",HTML="https://webapp4.asu.edu/directory/person/77201"$
I was a National Merit Scholar with a 1440 SAT at Arizona State University. I have a bachelor's in Computer System Engineering from ASU, basically, embedded systems, and a master's in Electrical Engineering from ASU, control systems. I worked as a software, hardware and mechanical engineer at Ticketmaster from 1990-1996.
I designed a 3 axis stepper-motor-driven milling machine 1996-1997 with a CAD/CAM package for a company I started called Home Automation and Robotic Equipment.
$HC,"<center><img src=\"http://www.templeos.org/images/Machine.jpg\" width=\"600\" height=\"400\" alt=\"\"></center>"$
I worked for a company named Xytec Corp. 1997-1999. We made FPGA-based image processing equipment. I wrote $FG,2$$TX,"SimStructure",HTML="http://www.templeos.org/files/SimStrSetUp.zip"$$FG$ from 2000-2001 for H.A.R.E. I worked as head software/electrical engineer for a company called Graphic Technologies, 2001-2002, making replacement chips for toner printer cartridges so they could be refilled.
I worked for a company named Xytec Corp. 1997-1999. We made FPGA-based image processing equipment. I wrote $FG,2$SimStructure$FG$ from 2000-2001 for H.A.R.E. I worked as head software/electrical engineer for a company called Graphic Technologies, 2001-2002, making replacement chips for toner printer cartridges so they could be refilled.
$FG,5$Credits:$FG$
See $LK,"::/Doc/Credits.DD"$.
+3 -3
View File
@@ -1,6 +1,6 @@
$WW,1$$FG,5$$TX+CX,"Credits"$$FG$
I, $FG,2$Terry A. Davis$FG$, wrote all of TempleOS over the past $TX,"13.8",D="DD_TEMPLEOS_AGE"$ years (full-time). It can run on some bare metal 64-bit PC's from about 2005-2010 with no layering, libraries, tools, modules or anything from other sources. Otherwise, you run it in a virtual machine, like $FG,2$VMware$FG$, $FG,2$QEMU$FG$ or $FG,2$VirtualBox$FG$. It is independent and stands alone. It has no networking, so it certainly doesn't call home. 100% of the src code is including on all distro's, from the kernel to the compiler to the boot loaders! It is public domain, not GPL.
I, $FG,2$Terry A. Davis$FG$, wrote all of TempleOS over the past $TX,"13.9",D="DD_TEMPLEOS_AGE"$ years (full-time). It can run on some bare metal 64-bit PC's from about 2005-2010 with no layering, libraries, tools, modules or anything from other sources. Otherwise, you run it in a virtual machine, like $FG,2$VMware$FG$, $FG,2$QEMU$FG$ or $FG,2$VirtualBox$FG$. It is independent and stands alone. It has no networking, so it certainly doesn't call home. 100% of the src code is including on all distro's, from the kernel to the compiler to the boot loaders! It is public domain, not GPL.
*) $LK,"::/Kernel/FontStd.HC"$, is taken from $FG,4$$TX,"FreeDOS",HTML="http://www.freedos.org"$$FG$. It's public domain.
@@ -34,7 +34,7 @@ I, $FG,2$Terry A. Davis$FG$, wrote all of TempleOS over the past $TX,"13.8",D="D
*) God told me to stick with 640x480 16 color and single-voice 8-bit signed MIDI-like sample for sound. He kept me from zombie-walking into making child windows like $FG,2$Windows$FG$. Instead, I made one window per task with no child windows. He also guided my progress, very obviously.
*) I got $FG,4$$TX,"Webster's Dictionary",HTML="http://www.templeos.org/files/DICTIONARY.DD"$$FG$ and $FG,4$$TX,"The King James Bible",HTML="http://www.templeos.org/files/BIBLE.DD"$$FG$ from $FG,4$$TX,"Project Gutenberg",HTML="http://web.archive.org/web/20110730111436/http://promo.net/pg/"$$FG$.
*) I got $FG,4$$TX,"Webster's Dictionary",HTML="http://www.templeos.org/files/DICTIONARY.DD"$$FG$ and $LK,"The King James Bible",A="FI:::/Misc/Bible.TXT"$ from $FG,4$$TX,"Project Gutenberg",HTML="http://web.archive.org/web/20110730111436/http://promo.net/pg/"$$FG$.
*) John Carmack inspired me to use "$LK,"Clamp",A="MN:Clamp"$" as a name instead of "Limit". He inspired me to use "needle" and "haystack" as names. He inspired me to simplify my Frames-Per-Second code.
@@ -42,7 +42,7 @@ I, $FG,2$Terry A. Davis$FG$, wrote all of TempleOS over the past $TX,"13.8",D="D
*) I hired an artist, Cody Rigby, for $$3,000 worth of pixel art.
*) Erik van der Karbargenbok wrote /Linux shell scripts -- GodPassage, GodWords.
*) Erik van der Karbargenbok wrote /Downloads shell scripts -- gw.
*) The random number generator is from Donald Knuth in the wikipedia entry for $TX,"Linear_congruential_generator",HTML="http://en.wikipedia.org/wiki/Linear_congruential_generator"$.
+1 -1
View File
@@ -17,7 +17,7 @@ $LK,"::/Kernel/BlkDev/DskClus.HC"$ :152 All the clus operations become blk.
* VMware has a bug stretching 640x480 16 color to full scrn.
* VMware PC speaker's distortion is a good idea, but it is too much for hymns. VMware should make an adjustment for distortion and an adjustment for reverb.
* VMware PC speaker's distortion is a good idea, but it is too much for hymns.
* VMware and others must list TempleOS as an official 64-bit operating system.
Binary file not shown.
+1 -1
View File
@@ -49,7 +49,7 @@ I am tmpted to help amateur hardware device designers by making the hardware int
The original PC had general purpose digital IO through the parallel port. That was fun. I have enough battles to fight, so I'll leave being a savior to hobbiest hardware engineers to somebody else.
Digital cameras will be super-simple high speed serial, but TempleOS is forever limited to 16 colors and multimedia is banned because large files being loaded into memory fragments memory, so cameras are somewhat unwelcome. I have enough problems without making the Brits anxious about autonomous gun turrets and killer robots. The reason I say cameras will be super-simple serial is because we are replacing USB ports with super-simple serial. Windows/Linux will have only super-simple serial ports unless people buy a USB PCI expansion card. So, the digital cameras will be super-simple serial.
Digital cameras will be super-simple high speed serial, but TempleOS is forever limited to 16 colors and multimedia is banned because large files being loaded into memory fragments memory, so cameras are somewhat unwelcome. I have enough problems without making the Brits anxious about autonomous gun turrets and killer robots. The reason I say cameras will be super-simple serial is because we are replacing USB ports with super-simple serial. PC's will have only super-simple serial ports unless people buy a USB PCI expansion card. So, the digital cameras will be super-simple serial.
$FG,5$$TX+CX,"Version 1.0"$$FG$
Binary file not shown.
@@ -14,6 +14,8 @@
#define SHORT_MAX 0x7FFF
#define INT_MIN (-0x80000000)
#define INT_MAX 0x7FFFFFFF
#define LONG_LONG_MIN (-0x8000000000000000l)
#define LONG_LONG_MAX 0x7FFFFFFFFFFFFFFFl
#define DWORD_MIN 0
#define DWORD_MAX 0xFFFFFFFF
#define CDATE_FREQ 49710 // Hz
@@ -71,6 +73,56 @@ int FSize(FILE *f)
return res;
}
class CQue
{public:
CQue *next,*last;
};
void QueIns(void *entry,void *pred)
{
CQue * succ;
succ=((CQue *)pred)->next;
((CQue *)entry)->last=(CQue *)pred;
((CQue *)entry)->next=succ;
succ ->last=(CQue *)entry;
((CQue *)pred)->next=(CQue *)entry;
}
void QueRem(void *entry)
{
((CQue *)entry)->last->next=((CQue *)entry)->next;
((CQue *)entry)->next->last=((CQue *)entry)->last;
}
void QueDel(void *head,BOOL querem=FALSE)
{//Free entries in queue, not head.
CQue *tmpq=((CQue *)head)->next,*tmpq1;
while (tmpq!=head) {
tmpq1=((CQue *)tmpq)->next;
if (querem)
QueRem(tmpq);
Free(tmpq);
tmpq=tmpq1;
}
}
void QueInit(void *head)
{//Free entries in queue, not head.
((CQue *)head)->next=(CQue *)head;
((CQue *)head)->last=(CQue *)head;
}
int QueCnt(CQue *head)
{//Count of nodes in queue, not head.
CQue *tmpq=((CQue *)head)->next;
int res=0;
while (tmpq!=head) {
res++;
tmpq=((CQue *)tmpq)->next;
}
return res;
}
#define ARC_MAX_BITS 12
#define CT_NONE 1
@@ -322,20 +374,99 @@ BOOL Cvt(char *in_name,char *out_name,BOOL cvt_ascii)
return okay;
}
long long ona2freq[256]=
{0x0000000000000000,0x3F825AA2E3AF0B1E,0x3F83720820155763,0x3F849A0A791E127D,
0x3F85D3A6D600CAB9,0x3F871FE927CA0DE9,0x3F887FED4E47AE02,0x3F89F4E00A91D08B,
0x3F8B800000000000,0x3F8D229EC465C8A4,0x3F8EDE22007F7915,0x3F905A0250C2B956,
0x3F9152EC0E758E71,0x3F925AA2E3AF0B1E,0x3F93720820155763,0x3F949A0A791E127D,
0x3F95D3A6D600CAB9,0x3F971FE927CA0DE9,0x3F987FED4E47AE02,0x3F99F4E00A91D08B,
0x3F9B800000000000,0x3F9D229EC465C8A4,0x3F9EDE22007F7915,0x3FA05A0250C2B956,
0x3FA152EC0E758E71,0x3FA25AA2E3AF0B1E,0x3FA3720820155763,0x3FA49A0A791E127D,
0x3FA5D3A6D600CAB9,0x3FA71FE927CA0DE9,0x3FA87FED4E47AE02,0x3FA9F4E00A91D08B,
0x3FAB800000000000,0x3FAD229EC465C89F,0x3FAEDE22007F791A,0x3FB05A0250C2B956,
0x3FB152EC0E758E6E,0x3FB25AA2E3AF0B22,0x3FB3720820155763,0x3FB49A0A791E127A,
0x3FB5D3A6D600CABC,0x3FB71FE927CA0DE9,0x3FB87FED4E47ADFE,0x3FB9F4E00A91D08F,
0x3FBB800000000000,0x3FBD229EC465C89F,0x3FBEDE22007F791A,0x3FC05A0250C2B956,
0x3FC152EC0E758E6E,0x3FC25AA2E3AF0B22,0x3FC3720820155763,0x3FC49A0A791E127A,
0x3FC5D3A6D600CABC,0x3FC71FE927CA0DE9,0x3FC87FED4E47ADFE,0x3FC9F4E00A91D08F,
0x3FCB800000000000,0x3FCD229EC465C89F,0x3FCEDE22007F791A,0x3FD05A0250C2B956,
0x3FD152EC0E758E6E,0x3FD25AA2E3AF0B22,0x3FD3720820155763,0x3FD49A0A791E127A,
0x3FD5D3A6D600CABC,0x3FD71FE927CA0DE9,0x3FD87FED4E47ADFE,0x3FD9F4E00A91D08F,
0x3FDB800000000000,0x3FDD229EC465C89F,0x3FDEDE22007F791A,0x3FE05A0250C2B956,
0x3FE152EC0E758E6E,0x3FE25AA2E3AF0B22,0x3FE3720820155763,0x3FE49A0A791E127A,
0x3FE5D3A6D600CABC,0x3FE71FE927CA0DE9,0x3FE87FED4E47ADFE,0x3FE9F4E00A91D08F,
0x3FEB800000000000,0x3FED229EC465C8A2,0x3FEEDE22007F7918,0x3FF05A0250C2B956,
0x3FF152EC0E758E6F,0x3FF25AA2E3AF0B20,0x3FF3720820155763,0x3FF49A0A791E127B,
0x3FF5D3A6D600CABB,0x3FF71FE927CA0DE9,0x3FF87FED4E47AE00,0x3FF9F4E00A91D08D,
0x3FFB800000000000,0x3FFD229EC465C8A2,0x3FFEDE22007F7918,0x40005A0250C2B956,
0x400152EC0E758E6F,0x40025AA2E3AF0B20,0x4003720820155763,0x40049A0A791E127B,
0x4005D3A6D600CABB,0x40071FE927CA0DE9,0x40087FED4E47AE00,0x4009F4E00A91D08D,
0x400B800000000000,0x400D229EC465C8A0,0x400EDE22007F791A,0x40105A0250C2B956,
0x401152EC0E758E6F,0x40125AA2E3AF0B21,0x4013720820155763,0x40149A0A791E127A,
0x4015D3A6D600CABC,0x40171FE927CA0DE9,0x40187FED4E47ADFE,0x4019F4E00A91D08E,
0x401B800000000000,0x401D229EC465C8A0,0x401EDE22007F7918,0x40205A0250C2B956,
0x402152EC0E758E6F,0x40225AA2E3AF0B20,0x4023720820155763,0x40249A0A791E127A,
0x4025D3A6D600CABC,0x40271FE927CA0DE9,0x40287FED4E47ADFF,0x4029F4E00A91D08E,
0x402B800000000000,0x402D229EC465C8A0,0x402EDE22007F7918,0x40305A0250C2B956,
0x403152EC0E758E6F,0x40325AA2E3AF0B21,0x4033720820155763,0x40349A0A791E127B,
0x4035D3A6D600CABC,0x40371FE927CA0DE9,0x40387FED4E47ADFF,0x4039F4E00A91D08E,
0x403B800000000000,0x403D229EC465C8A0,0x403EDE22007F791A,0x40405A0250C2B956,
0x404152EC0E758E6F,0x40425AA2E3AF0B21,0x4043720820155763,0x40449A0A791E127A,
0x4045D3A6D600CABC,0x40471FE927CA0DE9,0x40487FED4E47ADFE,0x4049F4E00A91D08E,
0x404B800000000000,0x404D229EC465C8A2,0x404EDE22007F7918,0x40505A0250C2B956,
0x405152EC0E758E6F,0x40525AA2E3AF0B20,0x4053720820155763,0x40549A0A791E127B,
0x4055D3A6D600CABB,0x40571FE927CA0DE9,0x40587FED4E47AE00,0x4059F4E00A91D08D,
0x405B800000000000,0x405D229EC465C8A2,0x405EDE22007F7918,0x40605A0250C2B956,
0x406152EC0E758E6F,0x40625AA2E3AF0B20,0x4063720820155763,0x40649A0A791E127B,
0x4065D3A6D600CABB,0x40671FE927CA0DE9,0x40687FED4E47AE00,0x4069F4E00A91D08D,
0x406B800000000000,0x406D229EC465C89F,0x406EDE22007F791A,0x40705A0250C2B956,
0x407152EC0E758E6E,0x40725AA2E3AF0B22,0x4073720820155763,0x40749A0A791E127A,
0x4075D3A6D600CABC,0x40771FE927CA0DE9,0x40787FED4E47ADFE,0x4079F4E00A91D08F,
0x407B800000000000,0x407D229EC465C89F,0x407EDE22007F791A,0x40805A0250C2B956,
0x408152EC0E758E6E,0x40825AA2E3AF0B22,0x4083720820155763,0x40849A0A791E127A,
0x4085D3A6D600CABC,0x40871FE927CA0DE9,0x40887FED4E47ADFE,0x4089F4E00A91D08F,
0x408B800000000000,0x408D229EC465C89F,0x408EDE22007F791A,0x40905A0250C2B956,
0x409152EC0E758E6E,0x40925AA2E3AF0B22,0x4093720820155763,0x40949A0A791E127A,
0x4095D3A6D600CABC,0x40971FE927CA0DE9,0x40987FED4E47ADFE,0x4099F4E00A91D08F,
0x409B800000000000,0x409D229EC465C89F,0x409EDE22007F791A,0x40A05A0250C2B956,
0x40A152EC0E758E6E,0x40A25AA2E3AF0B22,0x40A3720820155763,0x40A49A0A791E127A,
0x40A5D3A6D600CABC,0x40A71FE927CA0DE9,0x40A87FED4E47ADFE,0x40A9F4E00A91D08F,
0x40AB800000000000,0x40AD229EC465C8A4,0x40AEDE22007F7915,0x40B05A0250C2B956,
0x40B152EC0E758E71,0x40B25AA2E3AF0B1E,0x40B3720820155763,0x40B49A0A791E127D,
0x40B5D3A6D600CAB9,0x40B71FE927CA0DE9,0x40B87FED4E47AE02,0x40B9F4E00A91D08B,
0x40BB800000000000,0x40BD229EC465C8A4,0x40BEDE22007F7915,0x40C05A0250C2B956,
0x40C152EC0E758E71,0x40C25AA2E3AF0B1E,0x40C3720820155763,0x40C49A0A791E127D,
0x40C5D3A6D600CAB9,0x40C71FE927CA0DE9,0x40C87FED4E47AE02,0x40C9F4E00A91D08B,
0x40CB800000000000,0x40CD229EC465C8A4,0x40CEDE22007F7915,0x40D05A0250C2B956,
0x40D152EC0E758E71,0x40D25AA2E3AF0B1E,0x40D3720820155763,0x40D49A0A791E127D};
#define ONA_REST CHAR_MIN
double Ona2Freq(char ona)
{//Ona to freq. Ona=60 is 440.0Hz.
double *d;
if (ona==ONA_REST)
return 0;
// else
// return 440.0/32*pow(2.0,ona/12.0);
else {
// return 440.0/32*pow(2.0,ona/12.0);
//This avoids needing to link math library to this file.
d=(double *)&ona2freq[ona+128];
return *d;
}
}
class CAUData
{public:
long long cdt;
char ona;
};
class CSndData
{public:
double time;
char ona;
CSndData *next,*last;
double tS;
char ona;
};
class CSndWaveCtrl
@@ -401,18 +532,17 @@ class CFileSND
#define SND_FILE_MAX 0x007FF000
int SndFileCreate(char *print_fmt,double normalized_vol=1.0,
double reverb_delay=0,double reverb_intensity=0,double time_shift=0)
int SndFileCreate(CSndData *head,char *print_fmt,double vol=1.0)
{
int i,i1,k,cnt,cnt2,level,file_num;
int i,i1,k,cnt,cnt2,file_num;
double dt;
CFileSND *s;
CSndWaveCtrl *swc=SndWaveCtrlNew(SNDFILE_SAMPLE_RATE);
CSndData *d,*d1;
CSndData *tmpsd;
char st[512];
FILE *out_file;
// dt=snd.record_head.last->time-snd.record_head.next->time;
dt=head->last->tS-head->tS;
if (!dt) return 0;
cnt=dt*SNDFILE_SAMPLE_RATE;
cnt++; //Terminator
@@ -424,74 +554,29 @@ int SndFileCreate(char *print_fmt,double normalized_vol=1.0,
s->sample_rate=EndianDWORD(SNDFILE_SAMPLE_RATE);
s->channels=EndianDWORD(1);
if (time_shift) {
// d=snd.record_head.next;
d->time-=time_shift;
// while (d->next!=&snd.record_head) {
while (TRUE) {
// d1=d->next;
dt=d1->time-d->time;
if (dt<0) {
// QueRem(d1);
// Free(d1);
} else
break;
}
}
// d=snd.record_head.next;
k=0;
i=d->time*SNDFILE_SAMPLE_RATE;
// while (d->next!=&snd.record_head) {
// d1=d->next;
i1=d1->time*SNDFILE_SAMPLE_RATE;
if (i1-i) {
i=head->tS*SNDFILE_SAMPLE_RATE;
tmpsd=head->next;
while (tmpsd!=head) {
i1=tmpsd->tS*SNDFILE_SAMPLE_RATE;
if (i1-i>0) {
if (k+i1-i>cnt) {
i1=cnt-k+i;
if (i1-i<=0)
break;
}
SndWaveAddBuf(swc,(BYTE *)&s->body[k],i1-i,
Ona2Freq(d->ona),normalized_vol);
Ona2Freq(tmpsd->last->ona),vol);
k+=i1-i;
i=i1;
}
// QueRem(d);
// Free(d);
d=d1;
// }
//Reverb
if (reverb_intensity) {
if (dt=reverb_delay*SNDFILE_SAMPLE_RATE)
for (i=dt;i<cnt;i++)
s->body[i]+=reverb_intensity*s->body[i-(DWORD)dt];
}
//Get rid of D.C. component
for (k=0;k<3;k++) {
level=0;
for (i=0;i<cnt-1;i++)
level+=s->body[i];
level/=cnt-1;
for (i=0;i<cnt-1;i++) {
if (s->body[i]-level<=SHORT_MIN)
s->body[i]=SHORT_MIN;
else if (s->body[i]-level>=SHORT_MIN)
s->body[i]=SHORT_MAX;
else
s->body[i]=s->body[i]-level;
}
tmpsd=tmpsd->next;
}
for (i=0;i<cnt-1;i++)
s->body[i]=EndianWORD(s->body[i]);
s->body[cnt-1]=0;
// d=snd.record_head.next;
// while (d!=&snd.record_head) {
// d1=d->next;
// QueRem(d);
// Free(d);
d=d1;
// }
cnt2=cnt;
file_num=0;
while (cnt2>0) {
@@ -509,7 +594,34 @@ int SndFileCreate(char *print_fmt,double normalized_vol=1.0,
}
Free(s);
Free(swc);
return cnt;
return file_num;
}
void AURead(CSndData *head,char *au_name)
{
CSndData *tmpsd;
FILE *in_file;
CAUData aud;
long long t0_cdt;
BOOL first=TRUE;
memset(head,0,sizeof(CSndData));
QueInit(head);
if (in_file=fopen(au_name,"rb")) {
while (fread(&aud,1,sizeof(CAUData),in_file)) {
if (first) {
tmpsd=head;
t0_cdt=aud.cdt;
first=FALSE;
} else {
tmpsd=(CSndData *)malloc(sizeof(CSndData));
QueIns(tmpsd,head->last);
}
tmpsd->ona=aud.ona;
tmpsd->tS=1.0*(aud.cdt-t0_cdt)/CDATE_FREQ;
}
fclose(in_file);
}
}
#define GR_WIDTH 640
@@ -539,7 +651,7 @@ class CBGR48
class CDC
{public:
CDate cdt;
long long cdt;
int x0,y0,
width,width_internal,
height,
@@ -625,7 +737,6 @@ BOOL GrBlot(CDC *dc,int x,int y,CDC *img)
}
#define BMP_COLORS_NUM 16
class CFileBMP
{public:
WORD type;
@@ -728,10 +839,8 @@ int MV2BMPLst(char *mv_print_fmt,char *dir_print_fmt,char *bmp_print_fmt,
CDC *dc,*base;
BYTE *src,*src_base;
char st[512],st_dir[512],st_bmp[512],st_mp4[512];
CDate cdt;
long long cdt=LONG_LONG_MIN;
FILE *mv_file,*lst_file=fopen("TOSZTEMP_VID_LIST.TXT","wt");
cdt.time=0;
cdt.date=INT_MIN;
if (mv_print_fmt)
mv_percent_cnt=StrOcc(mv_print_fmt,'%');
@@ -775,21 +884,16 @@ int MV2BMPLst(char *mv_print_fmt,char *dir_print_fmt,char *bmp_print_fmt,
break;
}
GrBlot(base,dc->x0,dc->y0,dc);
if (cdt.time==0 && cdt.date==INT_MIN) {
cdt.time=dc->cdt.time;
cdt.date=dc->cdt.date;
}
while (cdt.date<dc->cdt.date||
((cdt.date==dc->cdt.date) && (cdt.time<=dc->cdt.time))) {
if (cdt==LONG_LONG_MIN)
cdt=dc->cdt;
while (cdt<=dc->cdt) {
if (bmp_percent_cnt)
sprintf(st_bmp,bmp_print_fmt,bmp_num);
else
strcpy(st_bmp,bmp_print_fmt);
sprintf(st,"%s/%s",st_dir,st_bmp);
BMPWrite(st,base);
if (cdt.time>=DWORD_MAX-(DWORD)(CDATE_FREQ/fps)+1)
cdt.date++;
cdt.time+=(DWORD)(CDATE_FREQ/fps);
cdt+=(DWORD)(CDATE_FREQ/fps);
if (!bmp_percent_cnt) {
cont=FALSE;
break;
@@ -836,7 +940,7 @@ int MV2BMPLst(char *mv_print_fmt,char *dir_print_fmt,char *bmp_print_fmt,
int SND2MP4Lst(char *snd_print_fmt,char *mp4_print_fmt,char *out_name,
int rate=24000)
{//Cvt SND lst to BMP lst
{//Cvt SND lst to MP4
int num=0,snd_percent_cnt,mp4_percent_cnt,mkdir_percent_cnt;
char st[512],st_snd[512],st_mp4[512];
FILE *snd_file,*lst_file=fopen("TOSZTEMP_AUD_LIST.TXT","wt");
@@ -883,50 +987,42 @@ int SND2MP4Lst(char *snd_print_fmt,char *mp4_print_fmt,char *out_name,
return num;
}
int AU2SNDLst(char *au_name,char *snd_print_fmt,
char *mp4_print_fmt,char *out_name,int rate=24000)
{//Cvt AU file to SND lst to MP4
int num=0,snd_percent_cnt;
FILE *au_file;
CSndData head;
if (snd_print_fmt)
snd_percent_cnt=StrOcc(snd_print_fmt,'%');
else
snd_percent_cnt=0;
AURead(&head,au_name);
num=SndFileCreate(&head,snd_print_fmt);
QueDel(&head);
return SND2MP4Lst(snd_print_fmt,mp4_print_fmt,out_name,rate);
}
int main(int argc, char* argv[])
{
char *in_name,*out_name,st[256],
*mv_print_fmt,*snd_print_fmt;
char *in_name,*out_name,st[256],*mv_print_fmt,*au_name;
BOOL cvt_ascii,del_in=FALSE;
int i=1,l;
if (argc>i && !strcmp(argv[i],"-bmp")) {
if (argc>i && !strcmp(argv[i],"-mp4")) {
i++;
if (argc>i)
mv_print_fmt=argv[i++];
else
mv_print_fmt=(char *)"VID%03d.MV";
if (argc>i)
out_name=argv[i++];
au_name=argv[i++];
else
out_name=(char *)"VIDEO.MP4";
MV2BMPLst(mv_print_fmt,(char *)"TOSZTEMP%03d",(char *)"TOSZTEMP%06d.BMP",
(char *)"TOSZTEMPVID%03d.MP4",out_name);
} else if (argc>i && !strcmp(argv[i],"-snd")) {
i++;
if (argc>i)
snd_print_fmt=argv[i++];
else
snd_print_fmt=(char *)"AUD%03d.SND";
if (argc>i)
out_name=argv[i++];
else
out_name=(char *)"AUDIO.MP4";
SND2MP4Lst(snd_print_fmt,(char *)"TOSZTEMPAUD%03d.MP4",out_name);
} else if (argc>i && !strcmp(argv[i],"-mp4")) {
i++;
if (argc>i)
mv_print_fmt=argv[i++];
else
mv_print_fmt=(char *)"VID%03d.MV";
if (argc>i)
snd_print_fmt=argv[i++];
else
snd_print_fmt=(char *)"AUD%03d.SND";
au_name=(char *)"AUDIO.AU";
MV2BMPLst(mv_print_fmt,(char *)"TOSZTEMP%03d",
(char *)"TOSZTEMP%06d.BMP",(char *)"TOSZTEMPVID%03d.MP4",
(char *)"TOSZVIDEO.MP4");
SND2MP4Lst(snd_print_fmt,(char *)"TOSZTEMPAUD%03d.MP4",
(char *)"TOSZAUDIO.MP4");
(char *)"TOSZTEMP%06d.BMP",(char *)"TOSZTEMPVID%03d.MP4",
(char *)"TOSZVIDEO.MP4");
AU2SNDLst(au_name,(char *)"TOSZTEMP%03d.SND",
(char *)"TOSZTEMPAUD%03d.MP4",(char *)"TOSZAUDIO.MP4");
if (argc>i)
out_name=argv[i++];
else
@@ -973,19 +1069,13 @@ int main(int argc, char* argv[])
} else
printf("Fail: %s %s\r\n",in_name,out_name);
} else {
puts("TOSZ [-ascii] in_name [out_name]\r\n\r\n"
"TOSZ expands a single TempleOS file. "
puts("TOSZ [-ascii] in_name [out_name]\r\n"
"expands a single TempleOS file. "
"The -ascii flag will convert "
"nonstandard TempleOS ASCII "
"characters to regular ASCII.\r\n\r\n");
puts("TOSZ -bmp VID%03d.MV VIDEO.MP4\r\n"
"TOSZ will expand MV files to a sequence of BMP files and, "
"will call ffmpeg to convert BMP files to an MP4 file.\r\n\r\n");
puts("TOSZ -snd AUD%03d.SND AUDIO.MP4\r\n\r\n"
"TOSZ will call ffmpeg to convert SND files "
"to an MP4 file.\r\n");
puts("TOSZ -mp4 VID%03d.MV AUD%03d.SND MOVIE.MP4\r\n\r\n"
"TOSZ will call ffmpeg to convert MV files and SND files "
"characters to regular ASCII.\r\n\r\n"
"TOSZ -mp4 VID%03d.MV AUDIO.AU MOVIE.MP4\r\n"
"will call ffmpeg to convert MV files and an AU file "
"to a combined MP4 file.\r\n");
}
}
File renamed without changes.
@@ -5,5 +5,3 @@
echo Make TOSZ
cc TOSZ.CPP -o TOSZ
chmod 777 TOSZ
+23
View File
@@ -0,0 +1,23 @@
TempleOS
You can't do anything until you burn a TempleOS CD/DVD from the ISO file
and boot it, or you aim your virtual machine's CD/DVD at the ISO file
and boot.
TempleOS is 64-bit and will not run on 32-bit hardware.
TempleOS requires 512 Meg of RAM minimum and can have 256 Gig of RAM or more!
TempleOS files are compressed with a nonstandard LZW format and the source
code can only be compiled by the TempleOS compiler because it is HolyC, a
nonstandard C/C++ dialect. You must boot TempleOS. Then, you can compile it
because it is 100% open source and all source present on the distro.
If attempting to run on native hardware, TempleOS may require you to enter I/O
port addresses for the CD/DVD drive and the hard drive. In Windows, you can
find I/O port info in the Accessories/System Tools/System Info/Hardware
Resources/I/O ports. Look for and write down "IDE", "ATA" or "SATA" port numbers.
In Linux, use "lspci -v". Then, boot the TempleOS CD and try all combinations.
(Sorry, it's too difficult for TempleOS to figure-out port numbers, automatically.)
+1 -1
View File
@@ -26,7 +26,7 @@ CMsStateGlbls ms,ms_last;
CKbdStateGlbls kbd;
CKeyDevGlbls keydev;
CMsHardStateGlbls ms_hard,ms_hard_last;
CSndGlbls snd;
CScrnCastGlbls scrncast;
CTextGlbls text;
U8 *(*fp_getstr2)(I64 flags=0);
+4 -3
View File
@@ -48,9 +48,10 @@ U0 SysGlblsInit()
for (i=-308;i<309;i++)
pow10_I64[i+309]=Pow10(i);
snd.ona=ONA_REST;
QueInit(&snd.record_head);
snd.record_head.time=tS;
QueInit(&scrncast.snd_head);
scrncast.t0_now=Now;
scrncast.t0_tS=tS;
scrncast.ona=scrncast.snd_head.ona=ONA_REST;
ProgressBarsRst;
+25 -6
View File
@@ -183,26 +183,45 @@ U0 Snd(I8 ona=ONA_REST)
if (!Bt(&sys_semas[SEMA_MUTE],0) &&
!LBts(&sys_semas[SEMA_SND],0)) { //Mutex. Just throw-out if in use
if (ona<=ONA_REST) {
snd.ona=ona;
scrncast.ona=ona;
OutU8(0x61,InU8(0x61)&~3);
} else if (ona!=snd.ona) {
snd.ona=ona;
} else if (ona!=scrncast.ona) {
scrncast.ona=ona;
period=ClampI64(SYS_TIMER_FREQ/Ona2Freq(ona),1,U16_MAX);
OutU8(0x43,0xB6);
OutU8(0x42,period);
OutU8(0x42,period.u8[1]);
OutU8(0x61,3|InU8(0x61));
}
if (!IsDbgMode && snd.record) {
if (!IsDbgMode && scrncast.record) {
d=ACAlloc(sizeof(CSndData));
d->ona=ona;
d->time=tS;
QueIns(d,snd.record_head.last);
d->tS=tS;
QueIns(d,scrncast.snd_head.last);
}
LBtr(&sys_semas[SEMA_SND],0);
}
}
Bool ScrnCast(Bool val=ON,Bool just_audio=FALSE,U8 *print_fmt="B:/Tmp/%X.GR")
{//WinMgr saves GR files to a dir.
Bool old_val;
scrncast.just_audio=just_audio;
if (val) {
if (!(old_val=LBtr(&scrncast.record,0))) {
Free(scrncast.print_fmt);
scrncast.print_fmt=AStrNew(print_fmt);
scrncast.t0_now=Now;
scrncast.snd_head.tS=scrncast.t0_tS=tS;
scrncast.snd_head.ona=scrncast.ona;
LBts(&scrncast.record,0);
}
} else
old_val=LBtr(&scrncast.record,0);
Snd;
return old_val;
}
U0 SndRst()
{//Fix stuck sound.
if (Bt(&sys_semas[SEMA_SND],0)) {
+1614 -1640
View File
File diff suppressed because it is too large. Load diff
+20 -14
View File
@@ -1487,13 +1487,7 @@ public class CWinMgrGlbls
ideal_refresh_tS,
last_refresh_tS;
CWinMgrTimingGlbls *t;
CDate scrn_cast_now;
F64 scrn_cast_tS;
U8 *scrn_cast_print_fmt;
CDC *scrn_cast_dc,*dc2_alias;
Bool show_menu,
grab_scroll,grab_scroll_closed,
scrn_cast;
Bool show_menu,grab_scroll,grab_scroll_closed;
};
#help_index "AutoComplete"
@@ -3778,18 +3772,30 @@ class CKeyDevGlbls
#help_index "Snd"
#define ONA_REST I8_MIN
class CSndData
{
CSndData *next,*last;
F64 time;
#help_index "ScrnCast;Snd/AU Files"
public class CAUData
{//Fmt of AU files
CDate cdt;
I8 ona;
};
public class CSndGlbls
class CSndData
{//Fmt recorded in mem
CSndData *next,*last;
F64 tS;
I8 ona;
};
public class CScrnCastGlbls
{
CSndData record_head;
CSndData snd_head;
CDate t0_now;
F64 t0_tS;
U8 *print_fmt;
CDC *dc,*dc2_alias;
Bool record,just_audio;
I8 ona;
Bool record;
};
#help_index "Debugging/FunSeg"
+6 -2
View File
@@ -664,6 +664,11 @@ public extern U8 *IntEntryGet(I64 irq);
public extern U8 *IntEntrySet(I64 irq,
U0 (*fp_new_hndlr)(),I64 type=IDTET_IRQ,I64 dpl=0);
#help_index "ScrnCast;Cmd Line (Typically)"
public extern Bool ScrnCast(Bool val=ON,Bool just_audio=FALSE,
U8 *print_fmt="B:/Tmp/%X.GR")
public extern CScrnCastGlbls scrncast;
#help_index "Snd"
#help_file "::/Doc/Snd"
public extern U0 Beep(I8 ona=62,Bool busy=FALSE);
@@ -673,7 +678,6 @@ public extern Bool Mute(Bool val);
public extern F64 Ona2Freq(I64 ona);
public extern U0 Snd(I8 ona=ONA_REST);
public extern U0 SndRst();
public extern CSndGlbls snd;
#help_index "StdIn"
#help_file "::/Doc/Streams"
@@ -725,7 +729,6 @@ public extern CTask *Spawn(U0 (*fp_addr)(U8 *data),U8 *data=NULL,
#help_index "Time/CPU Cycles;Time/HPET;Time/Jiffies"
public extern CCntsGlbls cnts;
#help_index "Time/Date/CDate;Date/CDate"
#help_file "::/Doc/TimeDate"
public extern U0 Date2Struct(CDateStruct *_ds,CDate cdt);
@@ -749,6 +752,7 @@ public extern U16 mon_start_days2[12];
#help_index "Time/HPET"
#help_file "::/Doc/TimeHPET"
public extern I64 HPET();
#help_index "Time/Jiffies"
#help_file "::/Doc/TimeJiffy"
public extern I64 SysTimerRead();//18.33333*65536Hz (SYS_TIMER_FREQ)
Binary file not shown.
+1 -1
View File
@@ -32,7 +32,7 @@ U0 MakeMyISO(U8 *_out_iso_filename)
//To save space, optionally delete dictionary.
//Del("/Distro/Adam/AutoComplete/ACDefs.DATA");
CopyTree("/Linux","/Distro/Linux"); //You can leave this out.
CopyTree("/Downloads","/Distro/Downloads"); //You can leave this out.
DirMk("/Distro/Tmp");
DirMk("/Distro/Tmp/ScrnShots");
RedSeaISO(out_iso_filename,"/Distro","/Distro" BOOT_DIR_KERNEL_BIN_C);
-22
View File
@@ -1,22 +0,0 @@
TempleOS
You can't do much until you burn a TempleOS CD/DVD from the ISO file
and boot it, or you aim your virtual machine's CD/DVD at the ISO file
and boot. TempleOS files are compressed and the source code can only be
compiled by the TempleOS compiler... which is available when you boot
the CD/DVD. TempleOS is 100% open source with all source present.
TempleOS is 64-bit and will not run on 32-bit hardware.
TempleOS requires 512 Meg of RAM minimum.
TempleOS may require you to enter I/O port addresses for the CD/DVD drive
and the hard drive. In Windows, you can find I/O port info in the
Accessories/System Tools/System Info/Hardware Resources/I/O ports.
Look for and write down "IDE", "ATA" or "SATA" port numbers. In Linux, use
"lspci -v". Then, boot the TempleOS CD and try all combinations. (Sorry,
it's too difficult for TempleOS to figure-out port numbers, automatically.)
The source code can also be found at the TempleOS web site,
http://www.templeos.org but cannot be compiled outside TempleOS because
it's HolyC, a nonstandard C/C++ dialect, and asm.