Oops, don't enable timestretching on all samples by default.
[calfbox.git] / ui.c
bloba444df91b40aa87290abc090926367b5d8116eed
1 /*
2 Calf Box, an open source musical instrument.
3 Copyright (C) 2010 Krzysztof Foltman
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "ui.h"
21 #include <assert.h>
22 #include <stdio.h>
23 #include <ncurses.h>
25 void cbox_ui_start()
27 initscr();
28 cbreak();
29 noecho();
30 start_color();
31 keypad(stdscr, TRUE);
34 int cbox_ui_run(struct cbox_ui_page *page)
36 int ch, res;
37 if (page->draw)
38 page->draw(page);
39 if (page->on_idle)
40 halfdelay(1);
41 while(1)
43 ch = getch();
44 if (ch == ERR && page->on_idle)
46 res = page->on_idle(page);
47 if (res != 0)
48 return res;
49 continue;
51 res = page->on_key(page, ch);
52 if (res != 0)
53 return res;
55 cbreak();
58 void cbox_ui_stop()
60 endwin();