Jump to content
IGNORED

small feature request: length of data


kisrael

Recommended Posts

I'm not sure exactly what the code should be, but it would be cool if there was a way to talk about the length of a data set (this can be determined at compile time)

 

Right now I have something like

 

if musicNotePointer > 11 then musicNotePointer = 0 : rem 11 notes in all!

data musicPitch

6,7,8,9,10,11,12,13,14,15,-1

end

 

but if I could say something like

 

if musicNotePointer > musicPitch.length then musicNotePointer = 0

data musicPitch

6,7,8,9,10,11,12,13,14,15,-1

end

 

of XXX.length could be XXX.datalength or datalength(XXX) -- whatever is easy to parse.

 

This would be nice, because then when the data changed, you wouldn't have to keep track of its length seperately as a kind of arbitray "magic number"

 

I know this is one of those features that might be surprisingly irritating to code, but it would be nice.

Link to comment
Share on other sites

I'll second that feature. Would come in handy.

 

However, I must point out the information you need can be encoded into the data itself too. A bitmask can be used to make use of the unused bits in the pitch values, making the 'end of data byte' unneeded. Takes a bit longer (coupla cycles), but end result is about the same.

 

Set the high bit for the last note and it lets the playloop know to reset the notepointer...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...