mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-14 09:36:41 +02:00
xxx
git-svn-id: svn://elaine/murooma/trunk@99 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
d539ae5ea0
commit
b8f97a36f2
2 changed files with 8 additions and 3 deletions
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
|
|
||||||
int bufferMs;
|
int bufferMs;
|
||||||
|
int deviceIdx;
|
||||||
Stream* stream;
|
Stream* stream;
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,7 +93,8 @@ int initAudio()
|
||||||
std::cerr << "Device " << i << ": " << deviceInfo->name << "\n";
|
std::cerr << "Device " << i << ": " << deviceInfo->name << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
|
outputParameters.device = deviceIdx==-1?Pa_GetDefaultOutputDevice():deviceIdx; /* default output device */
|
||||||
|
std::cerr << "Using Device: " << outputParameters.device << "\n";
|
||||||
if (outputParameters.device == paNoDevice)
|
if (outputParameters.device == paNoDevice)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"Error: No default output device.\n");
|
fprintf(stderr,"Error: No default output device.\n");
|
||||||
|
@ -100,7 +102,7 @@ int initAudio()
|
||||||
}
|
}
|
||||||
outputParameters.channelCount = CHANNELS; /* stereo output */
|
outputParameters.channelCount = CHANNELS; /* stereo output */
|
||||||
outputParameters.sampleFormat = paInt16; /* 32 bit floating point output */
|
outputParameters.sampleFormat = paInt16; /* 32 bit floating point output */
|
||||||
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
|
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency;
|
||||||
outputParameters.hostApiSpecificStreamInfo = NULL;
|
outputParameters.hostApiSpecificStreamInfo = NULL;
|
||||||
|
|
||||||
err = Pa_OpenStream(
|
err = Pa_OpenStream(
|
||||||
|
@ -140,9 +142,12 @@ error:
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
deviceIdx = -1;
|
||||||
bufferMs = 300;
|
bufferMs = 300;
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
bufferMs = atoi(argv[1]);
|
bufferMs = atoi(argv[1]);
|
||||||
|
if (argc > 2)
|
||||||
|
deviceIdx = atoi(argv[2]);
|
||||||
|
|
||||||
stream = new Stream();
|
stream = new Stream();
|
||||||
stream->setBufferLen(bufferMs);
|
stream->setBufferLen(bufferMs);
|
||||||
|
|
|
@ -171,7 +171,7 @@ void Stream::getChunk(short* outputBuffer, double outputBufferDacTime, unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
timeval tv = getNextPlayerChunk(outputBuffer, correction);
|
timeval tv = getNextPlayerChunk(outputBuffer, correction);
|
||||||
int age = getAge(tv) - bufferMs + outputBufferDacTime*1000;
|
int age = getAge(tv) - bufferMs;// + outputBufferDacTime*1000;
|
||||||
pBuffer->add(age);
|
pBuffer->add(age);
|
||||||
pShortBuffer->add(age);
|
pShortBuffer->add(age);
|
||||||
// std::cerr << "Chunk: " << age << "\t" << outputBufferDacTime*1000 << "\n";
|
// std::cerr << "Chunk: " << age << "\t" << outputBufferDacTime*1000 << "\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue