mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 15:46:42 +02:00
chunk
git-svn-id: svn://elaine/murooma/trunk@25 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
fa67bad1e3
commit
a6b5ef2f0e
2 changed files with 21 additions and 15 deletions
20
chunk.h
Normal file
20
chunk.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef CHUNK_H
|
||||||
|
#define CHUNK_H
|
||||||
|
|
||||||
|
#define MS (50)
|
||||||
|
//44100 / 20 = 2205
|
||||||
|
#define SAMPLE_RATE (44100)
|
||||||
|
#define SIZE (SAMPLE_RATE*4*MS/1000)
|
||||||
|
int bufferMs;
|
||||||
|
#define FRAMES_PER_BUFFER (SIZE/4)
|
||||||
|
|
||||||
|
|
||||||
|
struct Chunk
|
||||||
|
{
|
||||||
|
int32_t tv_sec;
|
||||||
|
int32_t tv_usec;
|
||||||
|
char payload[SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
16
client.cpp
16
client.cpp
|
@ -17,23 +17,9 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <portaudio.h>
|
#include <portaudio.h>
|
||||||
|
#include "chunk.h"
|
||||||
|
|
||||||
|
|
||||||
#define MS (50)
|
|
||||||
//44100 / 20 = 2205
|
|
||||||
#define SAMPLE_RATE (44100)
|
|
||||||
#define SIZE (SAMPLE_RATE*4*MS/1000)
|
|
||||||
int bufferMs;
|
|
||||||
#define FRAMES_PER_BUFFER (SIZE/4)
|
|
||||||
|
|
||||||
|
|
||||||
struct Chunk
|
|
||||||
{
|
|
||||||
int32_t tv_sec;
|
|
||||||
int32_t tv_usec;
|
|
||||||
char payload[SIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
std::deque<Chunk*> chunks;
|
std::deque<Chunk*> chunks;
|
||||||
std::deque<int> timeDiffs;
|
std::deque<int> timeDiffs;
|
||||||
std::mutex mtx;
|
std::mutex mtx;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue