From 10a652728f2bc8e5f01aedf97ccc849b8ac686ba Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 31 Aug 2022 14:34:38 -0500 Subject: update example.c and add panning example --- examples/example.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'examples/example.c') diff --git a/examples/example.c b/examples/example.c index 9ae3acc..5e65d82 100644 --- a/examples/example.c +++ b/examples/example.c @@ -20,22 +20,32 @@ int main() sin1[i] = sin(2*PI*f1*time); sin2[i] = sin(2*PI*f2*time); } - mossrose_init(SAMPLE_RATE, N_CHANNELS); + + struct mossrose_sound_t sound_440 = { + .left = sin1, .right = NULL, .mono = true, .len = SAMPLE_RATE + }; + struct mossrose_sound_t sound_512 = { + .left = sin2, .right = NULL, .mono = true, .len = SAMPLE_RATE + }; + + int err = mossrose_init(SAMPLE_RATE, N_CHANNELS, true); + if (err != 0) + fprintf(stderr, "FAILED TO INITIALIZE MOSSROSE\n"); Pa_Sleep(500); printf("play 1\n"); - mossrose_play(sin1, NULL, SAMPLE_RATE, -1); + mossrose_play(&sound_512, -1); printf("wait\n"); Pa_Sleep(1000); printf("play 2\n"); - mossrose_play(sin2, NULL, SAMPLE_RATE, -1); + mossrose_play(&sound_440, -1); printf("wait\n"); Pa_Sleep(500); printf("play 3\n"); - mossrose_play(NULL, sin1, SAMPLE_RATE, -1); + mossrose_play(&sound_512, -1); printf("wait\n"); Pa_Sleep(1000); -- cgit v1.2.1