git ssb

0+

cel / foostudio



Commit 2afb25b2316215a66cf266f58b979bd0ce84e04a

Note code taken from alsa-lib

cel committed on 10/27/2016, 12:22:47 AM
Parent: 181a071b13ee98141c4e505a58d5eb0c43b71236

Files changed

foostudio.cchanged
foostudio.cView
@@ -39,9 +39,10 @@
3939 }
4040 return err;
4141 }
4242
43-static void generate(struct ccdl *ccdl,
43 +/* generate(): adapted from generate_sine() from alsa-lib/test/pcm.c */
44 +static void generate(struct tune *tune,
4445 const snd_pcm_channel_area_t *areas,
4546 snd_pcm_uframes_t offset,
4647 int count, double *_phase)
4748 {
@@ -69,10 +70,8 @@
6970 steps[chn] = areas[chn].step / 8;
7071 samples[chn] += offset * steps[chn];
7172 }
7273
73- struct tune *tune = ccdl_get(ccdl);
74-
7574 /* fill the channel areas */
7675 while (count-- > 0) {
7776 union {
7877 float f;
@@ -154,8 +153,9 @@
154153 snd_pcm_sframes_t avail, commitres;
155154 snd_pcm_state_t state;
156155 int first = 1;
157156
157 + /* main loop: adapted from direct_loop() from alsa-lib/test/pcm.c */
158158 while (1) {
159159 state = snd_pcm_state(pcm_out);
160160 if (state == SND_PCM_STATE_XRUN) {
161161 err = xrun_recovery(pcm_out, -EPIPE);
@@ -211,10 +211,10 @@
211211 exit(EXIT_FAILURE);
212212 }
213213 first = 1;
214214 }
215- generate(&ccdl, my_areas, offset, frames, &phase);
216- // generate_sine(my_areas, offset, frames, &phase);
215 + struct tune *tune = ccdl_get(&ccdl);
216 + generate(tune, my_areas, offset, frames, &phase);
217217 commitres = snd_pcm_mmap_commit(pcm_out, offset, frames);
218218 if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) {
219219 if ((err = xrun_recovery(pcm_out, commitres >= 0 ? -EPIPE : commitres)) < 0) {
220220 printf("MMAP commit error: %s\n", snd_strerror(err));

Built with git-ssb-web