Commit db045b1947e80c781f4eeea1af988c701e56d196
Update readme and arguments
- Make latency an argument - Default to no midi devicecel committed on 11/5/2016, 1:27:14 AM
Parent: 1d67f693f364e55fe7c4f752a49923bb51c6875b
Files changed
README.md | changed |
foostudio.c | changed |
README.md | |||
---|---|---|---|
@@ -1,18 +1,19 @@ | |||
1 | 1 … | # foostudio | |
2 | 2 … | ||
3 | -Foo Studio is an environment for live-coding algorithmic music in C. Inspired | ||
4 | -by [code-music-studio][]. Currently Linux-only, as it depends on ALSA and | ||
3 … | +Foo Studio is an environment for live-coding low-latency algorithmic music in | ||
4 … | +C. Inspired by [code-music-studio][]. Linux-only, it depends on ALSA and | ||
5 | 5 … | inotify. | |
6 | 6 … | ||
7 | 7 … | ## Usage | |
8 | 8 … | ||
9 | 9 … | ``` | |
10 | -# Compile the program | ||
10 … | +# Compile | ||
11 | 11 … | make | |
12 | 12 … | ||
13 | 13 … | # Run the studio | |
14 | -./foostudio tune.c plughw:0,0 | ||
14 … | +# Usage: foostudio [source file] [playback device] [capture device] [midi device] [latency us] | ||
15 … | +./foostudio tune.c plughw:0,0 plughw:0,0 hw:0 10000 | ||
15 | 16 … | ||
16 | 17 … | # In another terminal, edit the music file. When you save it, foostudio will recompile and reload it. | |
17 | 18 … | vim tune.c | |
18 | 19 … | ``` | |
@@ -26,8 +27,12 @@ | |||
26 | 27 … | - http://www.linuxjournal.com/article/6735?page=0,1#N0x19ab2890.0x19ba78d8 | |
27 | 28 … | ||
28 | 29 … | [code-music-studio]: https://github.com/substack/code-music-studio | |
29 | 30 … | ||
31 … | +## TODO | ||
32 … | + | ||
33 … | +- better CLI option syntax | ||
34 … | + | ||
30 | 35 … | ## License | |
31 | 36 … | ||
32 | 37 … | Copyright (C) 2016 Charles Lehner | |
33 | 38 … |
foostudio.c | ||
---|---|---|
@@ -16,9 +16,8 @@ | ||
16 | 16 … | |
17 | 17 … | static unsigned int rate = 48000; |
18 | 18 … | static unsigned int channels_out = 1; |
19 | 19 … | static unsigned int channels_in = 1; |
20 | -static unsigned int latency = 10000; // us | |
21 | 20 … | static int resample = 1; // allow resampling |
22 | 21 … | static int16_t maxval = 0x7fff; |
23 | 22 … | |
24 | 23 … | static snd_pcm_format_t format = SND_PCM_FORMAT_S16; |
@@ -34,18 +33,17 @@ | ||
34 | 33 … | snd_rawmidi_t *midi_in = NULL; |
35 | 34 … | const char *src_fname = "tune.c"; |
36 | 35 … | const char *device_out = "default"; |
37 | 36 … | const char *device_in = "default"; |
38 | - const char *midi_device_in = "default"; | |
37 … | + const char *midi_device_in = NULL; | |
38 … | + int latency = 10000; // us | |
39 | 39 … | |
40 | 40 … | if (argc > 1) src_fname = argv[1]; |
41 | 41 … | if (argc > 2) device_out = argv[2]; |
42 | - if (argc > 3) device_in = argv[3]; | |
43 | - if (argc > 4) midi_device_in = argv[4]; | |
42 … | + if (argc > 3 && argv[3][0]) device_in = argv[3]; | |
43 … | + if (argc > 4 && argv[4][0]) midi_device_in = argv[4]; | |
44 … | + if (argc > 5) latency = atoi(argv[5]); | |
44 | 45 … | |
45 | - if (device_in[0] == '\0') device_in = NULL; | |
46 | - if (midi_device_in[0] == '\0') midi_device_in = NULL; | |
47 | - | |
48 | 46 … | ccdl_init(&ccdl, src_fname, "play"); |
49 | 47 … | |
50 | 48 … | if (ccdl_watch(&ccdl)) { |
51 | 49 … | errx(1, "ccdl_watch"); |
Built with git-ssb-web