login

online now

We have 106 guests and no members online

search

 
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Storing notes/allophones in progmem

Storing notes/allophones in progmem 4 years 1 month ago #428

Is it possible to use progmem for notes/allophones? They do not seem to use the right types and I can't seem to get data using that keyword to work.
Thanks,
Tripp
Last Edit: 4 years 1 month ago by administrator.
The administrator has disabled public write access.

Re: Storing notes/allophones in progmem 4 years 1 month ago #429

HI Trip, you should be able to. The note data type ( GSNote ) is a c++ enumeration, which most compilers turn into an integer. Since the actual enumeration goes from 0-123 ( see GinSingDefs.h ), you can store them as simple unsigned chars if you like to save space, and just cast them to a GSNote in the function call.

so you could for example do something like this:

char notedata[] = { (char) DS_3, (char) B_7, ... }; // put this in progmem

GS.getVoice()->setNote ( (GSNote) notedata[0] ); // set the speaking note to first element in note data
The administrator has disabled public write access.

Re: Storing notes/allophones in progmem 4 years 1 month ago #430

It's really not that simple. setNote cannot directly access anything declared with a PROGMEM directive. The solution is to use a temporary buffer and copy the progmem into RAM before sending it to the setNote command.
load the ram buffer using memcpy_PF.
or in the case of using a single byte in progmem you will need to loop manually and load each byte using pgm_read_byte.

this is only useful in cases like mine that have a huge library of songs but can only play one at a time.

shame is that it isn't trivial to do this sort of thing like on one of those other von-something processor architectures.
The administrator has disabled public write access.

Re: Storing notes/allophones in progmem 4 years 1 month ago #431

I see. Sorry I misunderstood - I thought it was a problem with the variable type rather than the directive itself. It seems you could copy one note at a time, but probably would not be very useful.
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.212 seconds