ChunkTemplate

git-svn-id: svn://elaine/murooma/trunk@45 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-06-29 16:04:46 +00:00
parent 7ef8fd3f4a
commit 8699eb8bc2
3 changed files with 27 additions and 19 deletions

20
chunk.h
View file

@ -5,19 +5,27 @@
#define SAMPLE_BIT (16)
#define CHANNELS (2)
#define CHUNK_MS (40)
//44100 / 20 = 2205
#define CHUNK_SIZE (SAMPLE_RATE*CHANNELS*SAMPLE_BIT/8*CHUNK_MS/1000)
#define FRAMES_PER_BUFFER (CHUNK_SIZE/4)
#define WIRE_CHUNK_MS (40)
#define WIRE_CHUNK_SIZE (SAMPLE_RATE*CHANNELS*SAMPLE_BIT/8*WIRE_CHUNK_MS/1000)
#define PLAYER_CHUNK_MS (5)
#define PLAYER_CHUNK_SIZE (SAMPLE_RATE*CHANNELS*SAMPLE_BIT/8*PLAYER_CHUNK_MS/1000)
#define FRAMES_PER_BUFFER (WIRE_CHUNK_SIZE/4)
int bufferMs;
struct Chunk
template <size_t T>
struct ChunkT
{
int32_t tv_sec;
int32_t tv_usec;
char payload[CHUNK_SIZE];
char payload[T];
};
typedef ChunkT<WIRE_CHUNK_SIZE> Chunk;
typedef ChunkT<PLAYER_CHUNK_SIZE> PlayerChunk;
#endif