-
Notifications
You must be signed in to change notification settings - Fork 0
/
AlsaIo.h
33 lines (29 loc) · 879 Bytes
/
AlsaIo.h
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
29
30
31
#pragma once
#include <zita-alsa-pcmi.h>
#include <libraries/Pipe/Pipe.h>
#include "CircularBuffer.h"
#include <Bela.h> // for AuxiliaryTask, which should anyhow be replaced
class AlsaIo
{
public:
bool setup(const char* device, unsigned int fromHostChannels, unsigned int toHostChannels, unsigned int newBlockSize, unsigned int bufferSize, float rate);
void cleanup();
void sendReceive(float* fromHost, float* toHost, int samples);
static void task(void* nil);
private:
void sendToRt(float* toRt, int samples);
int receiveFromRt(float* fromRt, int samples);
void hostIo();
enum { numBufs = 2 };
CircularBuffer<float> hostIoInputBuffer;
CircularBuffer<float> fromHostBuffer;
CircularBuffer<float> toHostBuffer;
float *buf;
const char* playdev;
const char* captdev;
int blockSize;
Alsa_pcmi *D;
AuxiliaryTask auxTask;
Pipe toHostPipe;
Pipe fromHostPipe;
};