Mu0n
Well-known member
I've been working on programatically open up a .mid file, parse it to find the minimal MIDI command bytes out of it and set up a data structure that makes it easy to play it back on a System 7 Mac SE/30. All the more esoteric parts of the project have been more or less solved already, but this basic memory related behavior is stumping me.
It may not be the most space-efficient way of storing the MIDI data ever, but it has proven to work in a python version of my project, that I did for fast prototyping. I'm well aware that python consumes lots of resources to make programming more thoughtless and I don't really want to enter a philosophical debate about this.
But, I have a working python script that works on my modern PC machine. See here if you're curious: https://github.com/Mu0n/PythonMidiPlayer
My next step is to make it work in C.
I've got these 3 typedef structs to hold my MIDI data in.
Problem: I can't seem to make internal assignments 'stick' for some reason. it has worked some times by stepping through with the debugger, sometimes stuff like theBigList.TrackEventList[j].trackno stays at 0 instead of taking values like 1,2,3,4,etc.
Things I tried (none worked)
Bump up the project allocation to 1024 K from 384K (but this barely uses it)
clear out the debugger expressions and retype them from scratch from the loop
This is the source of the faulty code stripped down to the bare minimum. I use Symantec C++ 6.0. I'm just adding the standard library of ANSI to get tried and true simple printf outputs to get sanity checks for this prototype. Or I use the debugger.
I had to check it out in one of these C sandbox websites. Everything works peach perfect there.
programiz.pro
It may not be the most space-efficient way of storing the MIDI data ever, but it has proven to work in a python version of my project, that I did for fast prototyping. I'm well aware that python consumes lots of resources to make programming more thoughtless and I don't really want to enter a philosophical debate about this.
But, I have a working python script that works on my modern PC machine. See here if you're curious: https://github.com/Mu0n/PythonMidiPlayer
My next step is to make it work in C.
I've got these 3 typedef structs to hold my MIDI data in.
Problem: I can't seem to make internal assignments 'stick' for some reason. it has worked some times by stepping through with the debugger, sometimes stuff like theBigList.TrackEventList[j].trackno stays at 0 instead of taking values like 1,2,3,4,etc.
Things I tried (none worked)
Bump up the project allocation to 1024 K from 384K (but this barely uses it)
clear out the debugger expressions and retype them from scratch from the loop
This is the source of the faulty code stripped down to the bare minimum. I use Symantec C++ 6.0. I'm just adding the standard library of ANSI to get tried and true simple printf outputs to get sanity checks for this prototype. Or I use the debugger.
C:
#include <stdio.h>
typedef struct aMIDIEvent {
int deltaToGo;
int bytecount;
char* msgToSend;
} aME;
typedef struct aTableOfEvent {
int trackno;
int eventcount; //keeps track of total events for playback
int eventleft; //rises when building up, lowers when playing back
aME* trackEvents;
} aTOE, *aTOEPtr;
typedef struct bigParsedEventList {
int trackcount;
aTOE* TrackEventList;
Boolean hasBeenUsed;
} bigParsed;
bigParsed theBigList;
void main()
{
int j=0;
printf("hello");
theBigList.trackcount = 6;
theBigList.TrackEventList = (aTOEPtr)malloc(6*sizeof(aTOE));
if(theBigList.TrackEventList == NULL)
{
printf("ERRORRRRR\n");
}
for(j=0;j<6;j++)
{
theBigList.TrackEventList[j].trackno=j;
}
}
I had to check it out in one of these C sandbox websites. Everything works peach perfect there.
C Playground - Online C Programming IDE
C Playground: An online IDE to practice C programming. Write, edit & run code online. Suitable for all skill levels. Try now.