chunks have shorts

git-svn-id: svn://elaine/murooma/trunk@65 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-07-03 21:10:02 +00:00
parent a379d5903f
commit 7f3642c730
3 changed files with 10 additions and 11 deletions

View file

@ -10,8 +10,7 @@
#define PLAYER_CHUNK_MS (10)
#define PLAYER_CHUNK_SIZE (SAMPLE_RATE*CHANNELS*PLAYER_CHUNK_MS/1000)
#define FRAMES_PER_BUFFER (PLAYER_CHUNK_SIZE/CHANNELS)
#define FRAMES_PER_BUFFER (SAMPLE_RATE*PLAYER_CHUNK_MS/1000)
template <size_t T>

View file

@ -197,7 +197,7 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
{
skip++;
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";
buffer.clear();
shortBuffer.clear();
@ -326,18 +326,18 @@ int main (int argc, char *argv[])
if (ret != 0)
std::cerr << "Unsuccessful in setting thread realtime prio" << std::endl;
*/
// initAudio();
initAudio();
Chunk* chunk = new Chunk();
while (1)
{
zmq::message_t update;
subscriber.recv(&update);
memcpy(chunk, update.data(), sizeof(Chunk));
timeval now;
gettimeofday(&now, NULL);
// timeval now;
// gettimeofday(&now, NULL);
// std::cerr << "New chunk: " << chunkTime(*chunk) << "\t" << timeToStr(now) << "\t" << getAge(*chunk) << "\n";
std::cerr << chunk->tv_sec << "\t" << now.tv_sec << "\n";
/* for (size_t n=0; n<WIRE_CHUNK_MS/PLAYER_CHUNK_MS; ++n)
// std::cerr << chunk->tv_sec << "\t" << now.tv_sec << "\n";
for (size_t n=0; n<WIRE_CHUNK_MS/PLAYER_CHUNK_MS; ++n)
{
PlayerChunk* playerChunk = new PlayerChunk();
playerChunk->tv_sec = chunk->tv_sec;
@ -349,7 +349,7 @@ int main (int argc, char *argv[])
mutex.unlock();
cv.notify_all();
}
*/ }
}
delete chunk;
return 0;
}

View file

@ -56,8 +56,8 @@ int main () {
// else if (diff_ms(now, ts) > 1000)
// ts = now;
chunk->tv_sec = now.tv_sec;
chunk->tv_usec = now.tv_usec;
chunk->tv_sec = ts.tv_sec;
chunk->tv_usec = ts.tv_usec;
zmq::message_t message(sizeof(Chunk));
memcpy(message.data(), chunk, sizeof(Chunk));
// snprintf ((char *) message.data(), size, "%05d %d", zipcode, c);