Jump to content

Photo

small feature request: length of data


2 replies to this topic

#1 kisrael OFFLINE  

kisrael

    HMBL 2600 coder

  • 4,071 posts
  • Location:Boston Burbs, MA

Posted Wed Aug 17, 2005 11:03 AM

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.

#2 kisrael OFFLINE  

kisrael

    HMBL 2600 coder

  • Topic Starter
  • 4,071 posts
  • Location:Boston Burbs, MA

Posted Wed Aug 17, 2005 1:02 PM

Also, it would be GREAT if you could write

data foo
  1,1,1,
  2,2,2
end

instead of just
data foo
  1,1,1
  2,2,2
end

not being able to put in that comma stumped me for a bit!

#3 potatohead OFFLINE  

potatohead

    River Patroller

  • 4,404 posts
  • Location:Portland, Oregon

Posted Wed Aug 17, 2005 1:37 PM

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...




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users