- Now labels must include its number
This commit is contained in:
16
chirp.cpp
16
chirp.cpp
@@ -37,7 +37,6 @@ struct channel_t {
|
|||||||
char* stack[10] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
|
char* stack[10] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
|
||||||
uint8_t stackpos = 0;
|
uint8_t stackpos = 0;
|
||||||
char* labels[10] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
|
char* labels[10] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
|
||||||
uint8_t numlabels = 0;
|
|
||||||
};
|
};
|
||||||
static channel_t channels[MAX_CHANNELS];
|
static channel_t channels[MAX_CHANNELS];
|
||||||
|
|
||||||
@@ -145,7 +144,6 @@ int chirp_play(const char* new_song) {
|
|||||||
channels[c].tempo=44100;
|
channels[c].tempo=44100;
|
||||||
channels[c].waveform=0;
|
channels[c].waveform=0;
|
||||||
channels[c].stackpos=0;
|
channels[c].stackpos=0;
|
||||||
channels[c].numlabels=0;
|
|
||||||
channels[c].song = (char*)malloc( strlen( new_song ) + 1 );
|
channels[c].song = (char*)malloc( strlen( new_song ) + 1 );
|
||||||
strcpy( channels[c].song, new_song );
|
strcpy( channels[c].song, new_song );
|
||||||
channels[c].song_ptr = channels[c].song;
|
channels[c].song_ptr = channels[c].song;
|
||||||
@@ -207,16 +205,20 @@ int32_t interpret_next_token(const int c) { //uint8_t* buffer) {
|
|||||||
return 0;
|
return 0;
|
||||||
case '=':
|
case '=':
|
||||||
channels[c].stackpos = 0;
|
channels[c].stackpos = 0;
|
||||||
channels[c].numlabels = 0;
|
|
||||||
channels[c].song_ptr = channels[c].song;
|
channels[c].song_ptr = channels[c].song;
|
||||||
return 0;
|
return 0;
|
||||||
case '[':
|
case '[':
|
||||||
++*token;
|
param = *++*token;
|
||||||
channels[c].labels[channels[c].numlabels] = *token; //channels[c].song_ptr;
|
if( param >= 48 && param <= 57 ) { param -= 48; ++*token; } else { param = 0; }
|
||||||
channels[c].numlabels++;
|
channels[c].labels[uint8_t(param)] = *token; //channels[c].song_ptr;
|
||||||
{
|
{
|
||||||
char* nextpos = *token;
|
char* nextpos = *token;
|
||||||
while(*nextpos!=']') nextpos++;
|
uint8_t innerblocks=0;
|
||||||
|
while(innerblocks>0 || *nextpos!=']') {
|
||||||
|
if (*nextpos=='[') innerblocks++;
|
||||||
|
if (*nextpos==']') innerblocks--;
|
||||||
|
nextpos++;
|
||||||
|
}
|
||||||
channels[c].stack[channels[c].stackpos]=nextpos+1;
|
channels[c].stack[channels[c].stackpos]=nextpos+1;
|
||||||
}
|
}
|
||||||
channels[c].stackpos++;
|
channels[c].stackpos++;
|
||||||
|
|||||||
@@ -2,8 +2,15 @@ x=0
|
|||||||
|
|
||||||
function _init()
|
function _init()
|
||||||
text="HOLA MINI"
|
text="HOLA MINI"
|
||||||
playchirp("v4[l0ceg]v2@0v1@0")
|
--playchirp("l0v4o4fg#o5cv2o4fg#o5cv1o4fg#o5cv4o4fg#o5cv2o4fg#o5cv1o4fg#o5c")
|
||||||
--playchirp("o4w4go5c")
|
|
||||||
|
--playchirp("w3t4l0o2fv2fv4l1fv2l0fv1fv4l1fv2l0fv1fv4l1fv2l0fv1fv4fv2fv4l1fv2l0fv1fv4l1g#v2l0g#v1g#v4l1a#v2l0a#v1a#v4o3l1cv2l0cv1c")
|
||||||
|
--playchirp("t9 v4l0 o2fco1f#o0g# l6r o2l0f v3f v2f v1f v4l4r l0rv1rv4fv3fv2fv1fv4fco1f#o0g#l3ro2l0fco1f#o0g#l3ro2l0fv3fv2fv1fl6r=")
|
||||||
|
|
||||||
|
playchirp("w4t9l0v4o3fg#o4cv2o3fg#o4cv1o3fg#o4cl4rl0rv4o3fg#o4cv2o3fg#o4cv1o3fg#o4cl4rl0r")
|
||||||
|
playchirp("w0t9 [0v4o2l0fv3fv2fv1fv4fv3fv2fv1fl3rv4l0fv3fv2fv1frv3rv2rv1rv4fv3fv2fv1fl3rv4l0fv3fv2fv1f][1v4fv3fv2fv1fv4l3rl0dv3dv2dv1dv4l3rl0d#v3d#v2d#v1d#v4l3rl0ev3ev2ev1el3r]@0[2v4fv3fv2fv1fv4l3rl0gv3gv2gv1gv4l3rl0g#v3g#v2g#v1g#v4l3rl0av3av2av1al3r]=")
|
||||||
|
playchirp("w3t9 v3l0o2fco1f#o0g# l6r o2l0nv3nv2nv1n l5r v4l0nv3nv2nv1n v3l0o2fco1f#o0g# l3r v3l0o2fco1f#o0g# l3r o2l0nv3nv2nv1n l6r=")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function _update()
|
function _update()
|
||||||
@@ -12,3 +19,26 @@ function _update()
|
|||||||
x=x+1
|
x=x+1
|
||||||
if x>160 then x=-strlen(text)*4 end
|
if x>160 then x=-strlen(text)*4 end
|
||||||
end
|
end
|
||||||
|
0 x
|
||||||
|
1 xx
|
||||||
|
2 xxx
|
||||||
|
3 xxxx
|
||||||
|
4 xxxxxx
|
||||||
|
5 xxxxxxxx
|
||||||
|
6 xxxxxxxxxxxx
|
||||||
|
7 xxxxxxxxxxxxxxxx
|
||||||
|
8 xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
|
||||||
|
t9 {1w4v44422211a037037037} i1 l5 f l4 r l0 r l5 f l4 r l0 r
|
||||||
|
|
||||||
|
w4 t9
|
||||||
|
l0
|
||||||
|
v4 o3f g# o4c
|
||||||
|
v2 o3f g# o4c
|
||||||
|
v1 o3f g# o4c
|
||||||
|
l4r l0r
|
||||||
|
v4 o3f g# o4c
|
||||||
|
v2 o3f g# o4c
|
||||||
|
v1 o3f g# o4c
|
||||||
|
l4r l0r
|
||||||
Reference in New Issue
Block a user