mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-18 11:36:14 +02:00
chunks have shorts
git-svn-id: svn://elaine/murooma/trunk@65 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
a379d5903f
commit
7f3642c730
3 changed files with 10 additions and 11 deletions
3
chunk.h
3
chunk.h
|
@ -10,8 +10,7 @@
|
||||||
|
|
||||||
#define PLAYER_CHUNK_MS (10)
|
#define PLAYER_CHUNK_MS (10)
|
||||||
#define PLAYER_CHUNK_SIZE (SAMPLE_RATE*CHANNELS*PLAYER_CHUNK_MS/1000)
|
#define PLAYER_CHUNK_SIZE (SAMPLE_RATE*CHANNELS*PLAYER_CHUNK_MS/1000)
|
||||||
|
#define FRAMES_PER_BUFFER (SAMPLE_RATE*PLAYER_CHUNK_MS/1000)
|
||||||
#define FRAMES_PER_BUFFER (PLAYER_CHUNK_SIZE/CHANNELS)
|
|
||||||
|
|
||||||
|
|
||||||
template <size_t T>
|
template <size_t T>
|
||||||
|
|
14
client.cpp
14
client.cpp
|
@ -197,7 +197,7 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
|
||||||
{
|
{
|
||||||
skip++;
|
skip++;
|
||||||
chunk = new PlayerChunk();
|
chunk = new PlayerChunk();
|
||||||
memset(&(chunk->payload[0]), 0, PLAYER_CHUNK_SIZE);
|
memset(&(chunk->payload[0]), 0, sizeof(int16_t)*PLAYER_CHUNK_SIZE);
|
||||||
// std::cerr << "age < bufferMs (" << age << " < " << bufferMs << "), playing silence\n";
|
// std::cerr << "age < bufferMs (" << age << " < " << bufferMs << "), playing silence\n";
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
shortBuffer.clear();
|
shortBuffer.clear();
|
||||||
|
@ -326,18 +326,18 @@ int main (int argc, char *argv[])
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
std::cerr << "Unsuccessful in setting thread realtime prio" << std::endl;
|
std::cerr << "Unsuccessful in setting thread realtime prio" << std::endl;
|
||||||
*/
|
*/
|
||||||
// initAudio();
|
initAudio();
|
||||||
Chunk* chunk = new Chunk();
|
Chunk* chunk = new Chunk();
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
zmq::message_t update;
|
zmq::message_t update;
|
||||||
subscriber.recv(&update);
|
subscriber.recv(&update);
|
||||||
memcpy(chunk, update.data(), sizeof(Chunk));
|
memcpy(chunk, update.data(), sizeof(Chunk));
|
||||||
timeval now;
|
// timeval now;
|
||||||
gettimeofday(&now, NULL);
|
// gettimeofday(&now, NULL);
|
||||||
// std::cerr << "New chunk: " << chunkTime(*chunk) << "\t" << timeToStr(now) << "\t" << getAge(*chunk) << "\n";
|
// std::cerr << "New chunk: " << chunkTime(*chunk) << "\t" << timeToStr(now) << "\t" << getAge(*chunk) << "\n";
|
||||||
std::cerr << chunk->tv_sec << "\t" << now.tv_sec << "\n";
|
// std::cerr << chunk->tv_sec << "\t" << now.tv_sec << "\n";
|
||||||
/* for (size_t n=0; n<WIRE_CHUNK_MS/PLAYER_CHUNK_MS; ++n)
|
for (size_t n=0; n<WIRE_CHUNK_MS/PLAYER_CHUNK_MS; ++n)
|
||||||
{
|
{
|
||||||
PlayerChunk* playerChunk = new PlayerChunk();
|
PlayerChunk* playerChunk = new PlayerChunk();
|
||||||
playerChunk->tv_sec = chunk->tv_sec;
|
playerChunk->tv_sec = chunk->tv_sec;
|
||||||
|
@ -349,7 +349,7 @@ int main (int argc, char *argv[])
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
cv.notify_all();
|
cv.notify_all();
|
||||||
}
|
}
|
||||||
*/ }
|
}
|
||||||
delete chunk;
|
delete chunk;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,8 @@ int main () {
|
||||||
// else if (diff_ms(now, ts) > 1000)
|
// else if (diff_ms(now, ts) > 1000)
|
||||||
// ts = now;
|
// ts = now;
|
||||||
|
|
||||||
chunk->tv_sec = now.tv_sec;
|
chunk->tv_sec = ts.tv_sec;
|
||||||
chunk->tv_usec = now.tv_usec;
|
chunk->tv_usec = ts.tv_usec;
|
||||||
zmq::message_t message(sizeof(Chunk));
|
zmq::message_t message(sizeof(Chunk));
|
||||||
memcpy(message.data(), chunk, sizeof(Chunk));
|
memcpy(message.data(), chunk, sizeof(Chunk));
|
||||||
// snprintf ((char *) message.data(), size, "%05d %d", zipcode, c);
|
// snprintf ((char *) message.data(), size, "%05d %d", zipcode, c);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue