Dynamically Sized Array?
Jeff
Posts: 374
Is there any way in AMX to have an array that is as big as I need it, but no more?
I'm controlling a MediaPOINTE recorder. I need to get a list of the active files on the device, but the number of files is going to change all the time as they record new things. There's no limit to the number of files it can record. I want to have an array of the names of all of the files that I display on the panel, so that the user can see the names of files and select one and play it. I've got all the logic figured out to display it on the screen and cycle through it, but what I don't have is the ability to make my array big enough for them to have 200 files.
Should I just declare an array big enough for them to have like 1000 files on there and hope they don't hit it, or is there actually a way to make my array sizing dynamic?
J
I'm controlling a MediaPOINTE recorder. I need to get a list of the active files on the device, but the number of files is going to change all the time as they record new things. There's no limit to the number of files it can record. I want to have an array of the names of all of the files that I display on the panel, so that the user can see the names of files and select one and play it. I've got all the logic figured out to display it on the screen and cycle through it, but what I don't have is the ability to make my array big enough for them to have 200 files.
Should I just declare an array big enough for them to have like 1000 files on there and hope they don't hit it, or is there actually a way to make my array sizing dynamic?
J
0
Comments
I?m not familiar with MediaPOINTE so I don?t know how easy it is to retrieve data but you may want to consider querying the device dynamically for one ?page? of data a time.
If you take that approach (assuming the device can handle it) then your array only has to be big enough to hold the maximum amount of data that you can display on the touch screen at any given time. It won?t matter if there are 2 recordings or 2 million recordings; the code is inherently scalable with no wasted memory. This is the type of approach to take when interfacing with a device like the iPod.
If the paging approach isn?t possible for your situation then you might want to consider writing the data to disk and retrieve as needed. Or you might just have to say the heck with it and declare your array way big enough within reason knowing there is a built in limitation.
I hear Duet calling you.......
Unless they know something noone else does, there is always a limit. Mayeb you can find out what it is and go from there, but a dynamic system might be better as others have described.
Paul