COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### MIDI header in C

• Email
• Follow

Hey!

Can anybody give me a full MIDI header in C. I already have sth. like this:

char           ID[4];
unsigned long  Length;
unsigned short Format;
unsigned short NumTracks;
unsigned short Division;
unsigned char  Data[6];
};

but something is wrong, because when I try to read the Format value, it
gives me 256 (and it should be between 0 and 2 ;) ). What should I do? any
tips?

Kuba


 0
Reply Kuba 3/4/2004 12:48:29 PM

See related articles to this posting

Kuba Araszkiewicz wrote:
> Hey!
>
> Can anybody give me a full MIDI header in C. I already have sth. like this:
>
> struct Header     {
>    char           ID[4];
>    unsigned long  Length;
>    unsigned short Format;
>    unsigned short NumTracks;
>    unsigned short Division;
>    unsigned char  Data[6];
> };
>
> but something is wrong, because when I try to read the Format value, it
> gives me 256 (and it should be between 0 and 2 ;) ). What should I do? any
> tips?

values in a MIDI file are not in intel byte order so you cannot use this
as struct on intel machines

you must define them e.g.  as

unsigned char Format[2]

and read them reverse

e.g. by resorting them before reading
or better
by shifting the bytes to
their correct position inside the larger value  (shift operator    <<)

see Jeff Glatt pages about MIDI format


 0
Reply Guenter 3/4/2004 1:35:14 PM

1 Replies
228 Views

Similar Articles

12/7/2013 3:19:56 AM
page loaded in 263191 ms. (0)

Similar Artilces:

I would make - if a user is not allowed to see my page - print an error document. -> 403. (in case below 404) In php i used something like if ($ans = array_search($ip, $iparray)) { header("status: 404"); header("HTTP/1.0 404 Not Found"); Why does this not work. How can i get the official 403/ 404 page. Without ..htacces please. FiremanSAM "FiremanSAM" <firemansam@co.uk> schrieb: > if ($ans = array_search($ip,$iparray)) { Are you sure that you don't want to use | if ($ans == array_search($ip, $iparray)) { or | if ($ans === array_search($ip,$iparray)) { ? Regards, Matthias

Hiya, just need help with PHP headers. I have an index php page which has the following code within a header redirect: <?php if ( empty($_GET['month']) ) if (empty($_GET['year']) ) { $month = date(n);$year = date(Y); header("Location: index.php?month=$month&year=$year"); } ?> On the same index.php page, I have a shoutbox (include file) which inputs the content of the shoutbox form into a database. After the user fills out the form, I want the index page to refresh again because if I leave it as it is and a user inputs info into the form, if they press refresh, the form resubmits thus recording two entries into the shoutbox, or however many times refresh is pressed. When I add a header redirect into the shoutbox include file, once the user clicks on send, index.php throws a headers cannot be sent error message. Can anyone help? Cheers. DaRemedy wrote: > Hiya, just need help with PHP headers. > Multi-posting to at least three different news groups, it looks like you need some help posting to usenet properly to... If you want to post to more than 1 newsgroup, use the Newsgroups: field to compose a comma-seperated list of target

I have used the action= statement to send the form to a new page which can get the posted variables. I have used the header("Location: foo.php) statement after testing on the submit with isset. What I want to know is if they can be combined. That is, test first with the isset, and if no errors go to the action call. Simply going with the header call doesn't seem to send the form variables. Am I missing something? Shelly sheldonlg@gmail.com wrote: > I have used the action= statement to send the form to a new page which > can get the posted variables. > > I have used the header("Location: foo.php) statement after testing on > the submit with isset. > > What I want to know is if they can be combined. That is, test first > with the isset, and if no errors go to the action call. Simply going > with the header call doesn't seem to send the form variables. > > Am I missing something? > > Shelly > Should be pretty easy - just try the following: header("Location: foo.php?varname=varvalue&varname2=varvalue2"); This won't really work if you are passing sensitive information to the next page

Hi. I wrote form in html and script php for it (all in one file - index.php) //index.php //some if statements to set $dobry to true or false .... //here is the if statement that isn't working properly if($dobry==TRUE){ session_start(); $_SESSION['strona1']=base64_encode(serialize($_POST)); header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/wyszukiwanie.php"); exit(); } else{ header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'...;strona1']=base64_encode(serialize($_POST)); > header("Location: > http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/wyszukiwanie.php"); > exit(); > } > else{ > header("Location: > http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/bladdanych.php"); > exit(); > } > //and after is form in html > > The problem is that$dobry is true and i'm not going to wyszukiwanie.php. > I'm getting blank page index.php > Could

Hi all, Using memoir class, how can I change the header of only a page? I'm using \openright \pagestyle{ruled}% and I have something like \begin{document} \frontmatter %\pagenumbering{roman} \cleardoublepage% \tableofcontents \clearpage% \listoffigures \clearpage% \listoftables \clearpage% \lstlistoflistings \clearpage% \chapter{Title 1} 2 pages \clearpage% \mainmatter %\pagenumbering{arabic} \maxsecnumdepth{paragraph}% \setsecnumdepth{subsubsection}% \part{Project} \chapter*{Title 2} Some more pages \end{document} The issue is that for chapter Title 2 it is displayed title one in the header. TA On Apr 2, 1:51 pm, George <george.n...@NOSPAMgmx.net> wrote: > Hi all, > > Using memoir class, how can I change the header of only a page? I'm using > If you only want to change the style of one page, use: \thispagestyle{<option>} See p. 183 ff. for the various default types, etc. Cheers, jon. I also want to set the correct header. Right now in stead of having the label I want it is printed the previous chapter label. Any help "jon" <jonwrobinson@gmail.com> wrote in news

Hi all What does the group think of the practise of including one header file from inside another? I have some legacy code where this has been done, and it creates a dependency on a module (collection of files) which are not required, except for one header file's contents. I'd say 'No, header files should be included in the C source, not in another header', but I've always come across strong arguments for the latter. What do you think, and what is accepted practise? Thanks JS In article <cdl6fm$lmj$1@newstree.wise.edt.ericsson.se>, "John Smith" <soneone@microsoft.com> wrote: > Hi all > > What does the group think of the practise of including one header file from > inside another? > > I have some legacy code where this has been done, and it creates a > dependency on a module (collection of files) which are not required, except > for one header file's contents. > > I'd say 'No, header files should be included in the C source, not in another > header', but I've always come across strong arguments for the latter. > > What do you think, and what is accepted practise