05.09.2013 Views

2.3 Relaxatie-oscillator

2.3 Relaxatie-oscillator

2.3 Relaxatie-oscillator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ool CMyDlg::FileODlg(void)<br />

{<br />

bool os; // os records succes of GetOpenFileName<br />

char tmp[maxP]; // temporary store for Path+Filename+Extension<br />

OPENFILENAME ofn; // structure to FILE ofn<br />

}<br />

ZeroMemory(&ofn, sizeof(ofn));<br />

ofn.lStructSize = sizeof(ofn);<br />

ofn.lpstrFilter = “Standard MIDI files\0*.MID\0ALL\0*.*\0”;<br />

ofn.lpstrFile = tmp;<br />

ofn.lpstrFile[0] = ‘\0’; // Set lpstrFile[0] to ‘\0’ so that GetOpenFileName<br />

// does not use contents of szFile to initialize<br />

ofn.nMaxFile = maxP; // Max. length of filename. Must be declared!!<br />

ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;<br />

os=(GetOpenFileName(&ofn)==TRUE);<br />

if (os)<br />

{<br />

FONm=tmp; // see declaration for explanation of these members<br />

FOLp=tmp+ofn.nFileOffset;<br />

FOFn=FOLp.Left(ofn.nFileExtension-ofn.nFileOffset-1);<br />

FOEx=tmp+ofn.nFileExtension;<br />

}<br />

return (os); // check if file was selected. If selected, nResult=True<br />

bool CMyDlg::FileSDlg(void) // char array for path + file name<br />

{<br />

bool os; // os records succes of GetOpenFileName<br />

char tmp[maxP]; // temporary store for Filename<br />

OPENFILENAME ofn; // structure to FILE ofn<br />

ZeroMemory(&ofn, sizeof(ofn));<br />

ofn.lStructSize = sizeof(ofn);<br />

ofn.lpstrFilter = “Text Files (*.txt)\0*.txt\0ALL\0*.*\0”;<br />

ofn.lpstrFile = tmp;<br />

ofn.lpstrFile[0] = ‘\0’; // Set lpstrFile[0] to ‘\0’ so that GetOpenFileName<br />

// does not use the contents of szFile to initialize<br />

ofn.nMaxFile = maxP;<br />

ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;<br />

os=(GetSaveFileName(&ofn)==TRUE);<br />

if (os)<br />

{<br />

FSNm=tmp; // see declaration for explanation of these members<br />

FSLp=tmp+ofn.nFileOffset;<br />

FSFn=FSLp.Left(ofn.nFileExtension-ofn.nFileOffset-1);<br />

FSEx=tmp+ofn.nFileExtension;<br />

FSPt=FSNm.Left(ofn.nFileOffset);<br />

}<br />

return (os); // check if file was selected. If selected, nResult=True<br />

}<br />

bool CMyDlg::Convert(void)<br />

{<br />

SaveMsg(“Analyzing File...”+FOLp);<br />

FILE *fp,*o;<br />

CString bsenm; // basename for output files<br />

CString outnm; // name for output files<br />

CString ascnum; // name for ascii extension<br />

int c; // readed byte always stored in c<br />

int i; // counter to order the readed bytes<br />

int head; // kind tells function whether header or track<br />

int track; // every time a new track comes, track ++<br />

char what2do; // what2do tells function what to do with the byte<br />

char mfmt; // file tells type of midi file (0,1 or 2)<br />

int mres; // resolution of the delta-time, in ticks/quarter note<br />

unsigned long chunkl; // length of chunk (4 bytes max.)<br />

char dtm; // flag for status of reading. TRUE: read delta time<br />

unsigned long vrl; // result of variable length calculation<br />

unsigned long sdtm; // savereg. for temporarily storing delta time<br />

unsigned long cumdtm; // cumulative deltatime<br />

66

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!