summaryrefslogtreecommitdiff
path: root/examples/mp3.c
blob: 7ca545d9d4188a8ec7fe9cbdc9cb3299dfbf0d25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <mossrose.h>
#include <portaudio.h>

#define SAMPLE_RATE 44100
#define N_CHANNELS 8

int main()
{
	int err = mossrose_init(SAMPLE_RATE, N_CHANNELS, true);
	if (err != 0)
		fprintf(stderr, "FAILED TO INITIALIZE MOSSROSE\n");
	
	struct mossrose_sound_t *mono = mossrose_load_mp3("sine-mono.mp3");
	struct mossrose_sound_t *stereo = mossrose_load_mp3("weird-stereo.mp3");

	int chan = mossrose_play(mono, -1, 1);
	Pa_Sleep(1000);
	chan = mossrose_play(stereo, -1, 1);
	Pa_Sleep(1000);

	mossrose_terminate();
	mossrose_free_sound(mono);
	mossrose_free_sound(stereo);
	return 0;
}