Example #1
0
/* helper function to spell a char if voice UI is enabled */
static void kbd_spellchar(char c)
{
    static char spell_char[2] = "\0\0"; /* store char to pass to talk_spell */

    if (global_settings.talk_menu) /* voice UI? */
    {
        spell_char[0] = c; 
        talk_spell(spell_char, false);
    }
}
Example #2
0
/* ------------------------------------------------------------------------*/
static void say_bookmark(const char* bookmark,
                         int bookmark_id, bool show_playlist_name)
{
    if (!parse_bookmark(bookmark, true))
    {
        talk_id(LANG_BOOKMARK_INVALID, false);
        return;
    }

    talk_number(bookmark_id + 1, false);

#if CONFIG_CODEC == SWCODEC
    bool is_dir = (global_temp_buffer[0]
              && global_temp_buffer[strlen(global_temp_buffer)-1] == '/');

    /* HWCODEC cannot enqueue voice file entries and .talk thumbnails
       together, because there is no guarantee that the same mp3
       parameters are used. */
    if(show_playlist_name)
    {   /* It's useful to know which playlist this is */
        if(is_dir)
            talk_dir_or_spell(global_temp_buffer,
                              TALK_IDARRAY(VOICE_DIR), true);
        else talk_file_or_spell(NULL, global_temp_buffer,
                                TALK_IDARRAY(LANG_PLAYLIST), true);
    }
#else
    (void)show_playlist_name;
#endif

    if(bm.shuffle)
        talk_id(LANG_SHUFFLE, true);

    talk_id(VOICE_BOOKMARK_SELECT_INDEX_TEXT, true);
    talk_number(bm.resume_index + 1, true);
    talk_id(LANG_TIME, true);
    talk_value(bm.resume_time / 1000, UNIT_TIME, true);

#if CONFIG_CODEC == SWCODEC
    /* Track filename */
    if(is_dir)
        talk_file_or_spell(global_temp_buffer, global_filename,
                           TALK_IDARRAY(VOICE_FILE), true);
    else
    {   /* Unfortunately if this is a playlist, we do not know in which
           directory the file is and therefore cannot find the track's
           .talk file. */
        talk_id(VOICE_FILE, true);
        talk_spell(global_filename, true);
    }
#endif
}
void main()
{
  spkr = talk_run(sound_port, 9);
  talk_set_speaker(spkr, 0, 90);
  talk_set_speaker(spkr, 1, 110);
  talk_set_speaker(spkr, 2, 100);
  talk_say(spkr, "#1mae d\'og~ is n/ot u k\\at. its tr\'\'%125oo%. ae can pr\'\'%150oo%v it.");
  talk_say(spkr, "#0en espany/oal porfuv/or.");
  talk_say(spkr, "#1%80mee p\'ayrroa n/oa es] oon g\'ahtoa. e es va rd\'ad. pw/aydoa ]proab\'\'arloa...");
  talk_say(spkr, "#0kan y\'oo spell misis//ipee. #1%75++sh\'\'oo]]er ae kan.");
  talk_spell(spkr, "Mississippi");
  talk_say(spkr, ".misis\'ipee. #0v\'\'a ree g//uu\\\\uud%...");
  talk_say(spkr, "#1aem g\'oing too t\'el yoo u s\'eecret. (dhu proapeler is uh reelee kool~ chip)...");
  // Kinda noisy. Must be some overflow happening...
  talk_say(spkr, "#0%75sh\'ee sels s\'eeshels bae dhu s\'eeshor.");
  talk_say(spkr, "#1%50p\'eeter p\'aeper pikt u pek~, uv p\'ikuld p\'epers.");
  talk_say(spkr, "#0%75r\'uber b\'aebee b\'ugee b\'umpers...");
  talk_say(spkr, "#2f\'oaer sc\'oaer and s\'even yeeers agoa, ouer f\'odhers brot forth on dhis c\'ontinent a n\'ew n\'ayshun;");
  talk_say(spkr, "cuns\'eevd in l\'ibertee, and d\'edicayted too dhu propoas\'ishun~ dhat ol men ar cree\'ayted \'eekwul.");
  talk_say(spkr, "n/ow w\\ee ar \\eng/\'ayj~d in u gr\'ayt s\'ivil w\'ar, t\'esting hwedher dh\'at n\'ayshun, or /\'an\\ee n\'ayshun");
  talk_say(spkr, "s/\'oa cons\'\\eevd and s/\'oa d\'\\edicayted can l/\'ong end\'\\ooer...");
  talk_say(spkr, "#0kan yoo res\'aet anee p/oaetree. #1%75++sh\'\'oo]]er ae kan..");
  talk_say(spkr, "#1%75dhayer w/uns ]wus a m/an ]frum nant\'uke");
  talk_say(spkr, "}#0+5woa, ]woa, ]w\\\\\\oa. yoo c\'\'ant tel dh/\'at w\\un h/ee\\er.");
  talk_say(spkr, "#1%75but ae doant n\'oa anee cl/een wu\\ns...");
  talk_say(spkr, "#2wun~, too, three, for, faev, siks, s\'even~, ayt, naen~, ten~, el\'even~, twelv, th\'irteen~, f\'orteen~, f\'ifteen~,");
  talk_say(spkr, "s\'iksteen~, s\'eventeen~, \'aytteen~, n\'aenteen~, tw\'entee, th\'irtee, f\'ortee, f\'iftee, s\'ikstee, s\'eventee,");
  talk_say(spkr, "\'aytee, n\'aentee, h\'undred, th\'ousand, m\'ilyun~, b\'ilyun~, tr\'ilyun~, kwodr\'ilyun~, kwint\'ilyun~, sekst\'ilyun~...");
  talk_say(spkr, "first, s\'ecund, third, forth, fifth, siksth, s\'eventh, aytth, naenth, tenth...");
  talk_say(spkr, "see m\'ayjer. C2doa,Dray,Emee,Ffah,Gsoal,Alah,Btee,C3d%200oa.");
  talk_say(spkr, "see m\'aener. C2doa,Dray,E-mee,Ffah,Gsoal,A-lah,Btee,C3d%200oa.");
  talk_say(spkr, "=1C2o<Do<Eo<Fo<Go<Ao<Bo<C3%400o%...");
  talk_say(spkr, "#1aybee+7seedee++ee ef--jee, --aychae-jaykay--elemenoa--pee, +7kewar--esand-teeew--vee, +5dubul--yewand-ekswae--z%150ee%;");
  talk_say(spkr, "_nowyoov+7herdmae++aybee--sees, --telmee-wutyoo--thinkuv--m%200ee%...");
  talk_say(spkr, "+4mai--ree --had ++u ++litul lam, its --flees wus ++waet --as --sn%200oa%}}.");
  talk_say(spkr, "++and~ ++evr--ee --wa er ++dhat~ ++mairee went, dhe --lam wuz ++shuur --too --g%200oa%...");
  talk_say(spkr, "#1guud~ m[[oa\\\\rning~ ch/ip. [mae n\\aim~ is proap/e\\eler. aem~ r\'edee for mae [first l\'\\esun now.");
}
Example #4
0
int kbd_input(char* text, int buflen)
{
    bool done = false;
    bool redraw = true;
    bool line_edit = false;
    int page = 0, x = 0;
    int linelen;

    int len, i;
    int editpos, curpos, leftpos;
    unsigned short* line = kbd_setupkeys(page, &linelen);
    unsigned char temptext[12];

    int button, lastbutton = 0;

    editpos = strlen(text);

    if (global_settings.talk_menu) /* voice UI? */
        talk_spell(text, true); /* spell initial text */ 

    while (!done)
    {
        len = strlen(text);
        
        if (redraw)
        {
            if (line_edit) 
            {
                lcd_putc(0, 0, ' ');
                lcd_putc(0, 1, KEYBOARD_ARROW);
            }
            else
            {
                lcd_putc(0, 0, KEYBOARD_ARROW);
                lcd_putc(0, 1, ' ');
            }

            /* Draw insert chars */
            temptext[0] = KEYBOARD_INSERT_LEFT;
            temptext[1] = line[x];
            temptext[2] = KEYBOARD_INSERT_RIGHT;
            for (i = 1; i < 8; i++)
            {
                temptext[i+2] = line[(x+i)%linelen];
            }
            temptext[i+2] = 0;
            lcd_puts(1, 0, temptext);

            /* write out the text */
            curpos = MIN(MIN(editpos, 10 - MIN(len - editpos, 3)), 9);
            leftpos = editpos - curpos;
            strncpy(temptext, text + leftpos, 10);
            temptext[10] = 0;
            
            if (leftpos)
                temptext[0] = '<';
            if (len - leftpos > 10)
                temptext[9] = '>';

            lcd_remove_cursor();
            lcd_puts(1, 1, temptext);
            lcd_put_cursor(curpos + 1, 1, KEYBOARD_CURSOR);
            
            status_draw(true);
        }

        /* The default action is to redraw */
        redraw = true;

        button = button_get_w_tmo(HZ/2);
        switch (button)
        {
            case BUTTON_STOP:  /* abort */
                return -1;
                break;
            
            case BUTTON_MENU:  /* page flip */
                if (++page == KEYBOARD_PAGES)
                    page = 0;
                line = kbd_setupkeys(page, &linelen);
                if (x > linelen - 1)
                    x = linelen - 1;
                kbd_spellchar(line[x]);
                break;

            case BUTTON_ON:    /* toggle mode */
                line_edit = !line_edit;
                if (!line_edit)
                    kbd_spellchar(line[x]);
                break;

            case BUTTON_RIGHT:
            case BUTTON_RIGHT | BUTTON_REPEAT:
                if (line_edit)
                {
                    if (editpos < len)
                    {
                        editpos++;
                        kbd_spellchar(text[editpos]);
                    }
                }
                else
                {
                    if (++x >= linelen)
                        x = 0;
                    kbd_spellchar(line[x]);
                }
                break;

            case BUTTON_LEFT:
            case BUTTON_LEFT | BUTTON_REPEAT:
                if (line_edit)
                {
                    if (editpos)
                    {
                        editpos--;
                        kbd_spellchar(text[editpos]);
                    }
                }
                else
                {
                    if (--x < 0)
                        x = linelen - 1;
                    kbd_spellchar(line[x]);
                }
                break;

            case BUTTON_PLAY | BUTTON_REPEAT:
                /* accepts what was entered and continues */
                done = true;
                break;

            case BUTTON_PLAY | BUTTON_REL:
                if (lastbutton != BUTTON_PLAY)
                    break;
                if (line_edit) /* backspace in line_edit */
                {
                    if (editpos > 0)
                    {
                        for (i = editpos; i < len; i++)
                            text[i-1] = text[i];
                        text[i-1] = '\0';
                        editpos--;
                    }
                }
                else  /* inserts the selected char */
                {
                    if (len + 1 < buflen)
                    {
                        for (i = len ; i > editpos; i--)
                            text[i] = text[i-1];
                        text[len+1] = 0;
                        text[editpos] = line[x];
                        editpos++;
                    }
                }
                if (global_settings.talk_menu) /* voice UI? */
                    talk_spell(text, false); /* speak revised text */
                break;

            case BUTTON_NONE:
                status_draw(false);
                redraw = false;
                break;

            default:
                default_event_handler(button);
                break;
        }
        if (button != BUTTON_NONE)
            lastbutton = button;
    }
    
    return 0;
}
Example #5
0
static int tree_voice_cb(int selected_item, void * data)
{
    struct tree_context * local_tc=(struct tree_context *)data;
    char *name;
    int attr=0;
#ifdef HAVE_TAGCACHE
    bool id3db = *(local_tc->dirfilter) == SHOW_ID3DB;
    char buf[AVERAGE_FILENAME_LENGTH*2];

    if (id3db)
    {
        attr = tagtree_get_attr(local_tc);
        name = tagtree_get_entry_name(local_tc, selected_item, buf, sizeof(buf));
    }
    else
#endif
    {
        struct entry* e = tree_get_entry_at(local_tc, selected_item);
        name = e->name;
        attr = e->attr;
    }
    bool is_dir = (attr & ATTR_DIRECTORY);
    bool did_clip = false;
    /* First the .talk clip case */
    if(is_dir)
    {
        if(global_settings.talk_dir_clip)
        {
            did_clip = true;
            if(ft_play_dirname(name) <0)
                /* failed, not existing */
                did_clip = false;
        }
    } else { /* it's a file */
        if (global_settings.talk_file_clip && (attr & FILE_ATTR_THUMBNAIL))
        {
            did_clip = true;
            ft_play_filename(local_tc->currdir, name);
        }
    }
    if(!did_clip)
    {
        /* say the number or spell if required or as a fallback */
        switch (is_dir ? global_settings.talk_dir : global_settings.talk_file)
        {
        case 1: /* as numbers */
            talk_id(is_dir ? VOICE_DIR : VOICE_FILE, false);
            talk_number(selected_item+1        - (is_dir ? 0 : local_tc->dirsindir),
                        true);
            if(global_settings.talk_filetype
               && !is_dir && *local_tc->dirfilter < NUM_FILTER_MODES)
                say_filetype(attr);
            break;
        case 2: /* spelled */
            talk_shutup();
            if(global_settings.talk_filetype)
            {
                if(is_dir)
                    talk_id(VOICE_DIR, true);
                else if(*local_tc->dirfilter < NUM_FILTER_MODES)
                    say_filetype(attr);
            }
            talk_spell(name, true);
            break;
        }
    }
    return 0;
}