Any C programmers wanna help convert code to convert between MIDI + CSV?
#17
(08-26-2022, 02:54 AM)bplus Wrote:
(08-26-2022, 01:48 AM)TempodiBasic Wrote:
(08-25-2022, 11:32 PM)madscijr Wrote: But beyond this MIDI to CSV project, you may have seen my many posts going on about this ridiculous pipe dream of getting the PC to read 2 or more USB mice as separate input devices, for local multiplayer Pong games I have dreamed of for a long time. Well, I found some code that supposedly does that, and it is also in C! I gather that this mouse stuff is much lower level operations, and needs to be in a language like C, so that piece of software will probably be a DLL that a QB64 program calls. So yet another reason I would like a C compiler! And there is at least one other project that similarly has me looking at C code (I don't recall what it was, but it's there!)

Really, I am not that excited about doing C. It's a necessary evil and I just want to get the dirty work done, so I can get back to writing QB64 code! 

Anyway I hope that explains where I'm coming from a little more. Thanks again for your reply!

Ok MadSciJr
reading your answer to my post this is the first attempt to translate 
mid2asc.c

I have read the instructions to use it here http://www.archduke.org/midi/instrux.html

I have used C, but I've not so practice with all its structures and ways to code... never used and seen Assert.h  https://en.wikipedia.org/wiki/Assert.h
and never seen this way to assign a value to a string variable 
  buf[p][0]="CDEFGAB"[(n+700000)%7];

it seems to me
buf(p,0) = "CDEFGAB " + ltrim$(str$(n+700000 mod 7))

I have tried to compile this C code with Gcc /G++ getting back only so much warning about dirty use/assign/modify of *char and *string not compatible with ISO C and using wstring/ Wchar_t*   https://en.wikipedia.org/wiki/C_string_handling


Starting from code you have posted mid2asc.c   I have put in QB64 comment by ' the code in BASIC in relation with code in C showed above.

Quote:stuff

Just a first step towards your goal...


"... very long and... " 

what?

Hi Bplus,
I have had a problem on formatting the previous post... I clicked on "Insert a Quote"  button  at the place of " Code"

Here above I have cancelled the long boring post and it stays the nucleum of my message...
in the C code of file Mid2Asc.C   I have written , IMHO, the sequential code in QB64 just under each C block of code.
So I have type " ' " as starting character and then the QB64 code to get the same result and operations made in C code.

first dubt is
1.
 never seen this way to assign a value to a string variable  in C
  buf[p][0]="CDEFGAB"[(n+700000)%7];

it seems to me
buf(p,0) = "CDEFGAB " + ltrim$(str$(n+700000 mod 7))

2.
trying to compile by using G++ or GCC compilers I got a set of Warnings about a deprecated way to use Strings and the suggestion to use Wstring based on Wchar_t  type of data.

Thanks for reading
Reply


Messages In This Thread
RE: Any C programmers wanna help convert code to convert between MIDI + CSV? - by TempodiBasic - 08-26-2022, 08:36 PM



Users browsing this thread: 47 Guest(s)