kopia lustrzana https://github.com/OpenRTX/OpenRTX
Adapt code to the new audio stream API.
rodzic
24208db609
commit
7d90d15a5f
|
@ -120,9 +120,8 @@ bool codec_startEncode(const pathId path)
|
|||
|
||||
running = true;
|
||||
|
||||
pathInfo_t pathInfo = audioPath_getInfo(path);
|
||||
audioStream = inputStream_start(pathInfo.source, pathInfo.prio, audioBuf,
|
||||
320, BUF_CIRC_DOUBLE, 8000);
|
||||
audioStream = audioStream_start(path, audioBuf, 320, 8000,
|
||||
STREAM_INPUT | BUF_CIRC_DOUBLE);
|
||||
|
||||
if(audioStream < 0)
|
||||
{
|
||||
|
@ -154,9 +153,8 @@ bool codec_startDecode(const pathId path)
|
|||
running = true;
|
||||
|
||||
memset(audioBuf, 0x00, 320 * sizeof(stream_sample_t));
|
||||
pathInfo_t pathInfo = audioPath_getInfo(path);
|
||||
audioStream = outputStream_start(pathInfo.sink, pathInfo.prio, audioBuf,
|
||||
320, BUF_CIRC_DOUBLE, 8000);
|
||||
audioStream = audioStream_start(path, audioBuf, 320, 8000,
|
||||
STREAM_OUTPUT | BUF_CIRC_DOUBLE);
|
||||
|
||||
if(audioStream == -1)
|
||||
{
|
||||
|
@ -299,7 +297,7 @@ static void *encodeFunc(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
inputStream_stop(audioStream);
|
||||
audioStream_terminate(audioStream);
|
||||
codec2_destroy(codec2);
|
||||
|
||||
return NULL;
|
||||
|
@ -357,8 +355,7 @@ static void *decodeFunc(void *arg)
|
|||
}
|
||||
|
||||
// Stop stream and wait until its effective termination
|
||||
outputStream_stop(audioStream);
|
||||
outputStream_sync(audioStream, false);
|
||||
audioStream_stop(audioStream);
|
||||
codec2_destroy(codec2);
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -190,7 +190,7 @@ void M17Demodulator::terminate()
|
|||
{
|
||||
// Ensure proper termination of baseband sampling
|
||||
audioPath_release(basebandPath);
|
||||
inputStream_stop(basebandId);
|
||||
audioStream_terminate(basebandId);
|
||||
|
||||
// Delete the buffers and deallocate memory.
|
||||
baseband_buffer.reset();
|
||||
|
@ -205,11 +205,10 @@ void M17Demodulator::terminate()
|
|||
void M17Demodulator::startBasebandSampling()
|
||||
{
|
||||
basebandPath = audioPath_request(SOURCE_RTX, SINK_MCU, PRIO_RX);
|
||||
basebandId = inputStream_start(SOURCE_RTX, PRIO_RX,
|
||||
baseband_buffer.get(),
|
||||
2 * M17_SAMPLE_BUF_SIZE,
|
||||
BUF_CIRC_DOUBLE,
|
||||
M17_RX_SAMPLE_RATE);
|
||||
basebandId = audioStream_start(basebandPath, baseband_buffer.get(),
|
||||
2 * M17_SAMPLE_BUF_SIZE, M17_RX_SAMPLE_RATE,
|
||||
STREAM_INPUT | BUF_CIRC_DOUBLE);
|
||||
|
||||
// Clean start of the demodulation statistics
|
||||
resetCorrelationStats();
|
||||
resetQuantizationStats();
|
||||
|
@ -219,11 +218,11 @@ void M17Demodulator::startBasebandSampling()
|
|||
|
||||
void M17Demodulator::stopBasebandSampling()
|
||||
{
|
||||
inputStream_stop(basebandId);
|
||||
audioPath_release(basebandPath);
|
||||
phase = 0;
|
||||
syncDetected = false;
|
||||
locked = false;
|
||||
audioStream_terminate(basebandId);
|
||||
audioPath_release(basebandPath);
|
||||
phase = 0;
|
||||
syncDetected = false;
|
||||
locked = false;
|
||||
}
|
||||
|
||||
void M17Demodulator::resetCorrelationStats()
|
||||
|
|
|
@ -63,7 +63,7 @@ void M17Modulator::terminate()
|
|||
// Terminate an ongoing stream, if present
|
||||
if(txRunning)
|
||||
{
|
||||
outputStream_terminate(outStream);
|
||||
audioStream_terminate(outStream);
|
||||
txRunning = false;
|
||||
}
|
||||
|
||||
|
@ -97,9 +97,9 @@ void M17Modulator::start()
|
|||
return;
|
||||
}
|
||||
|
||||
outStream = outputStream_start(SINK_RTX, PRIO_TX, baseband_buffer.get(),
|
||||
2*M17_FRAME_SAMPLES, BUF_CIRC_DOUBLE,
|
||||
M17_TX_SAMPLE_RATE);
|
||||
outStream = audioStream_start(outPath, baseband_buffer.get(),
|
||||
2*M17_FRAME_SAMPLES, M17_TX_SAMPLE_RATE,
|
||||
STREAM_OUTPUT | BUF_CIRC_DOUBLE);
|
||||
idleBuffer = outputStream_getIdleBuffer(outStream);
|
||||
#else
|
||||
sendBaseband();
|
||||
|
@ -130,8 +130,7 @@ void M17Modulator::stop()
|
|||
if(txRunning == false)
|
||||
return;
|
||||
|
||||
outputStream_stop(outStream);
|
||||
outputStream_sync(outStream, false);
|
||||
audioStream_stop(outStream);
|
||||
txRunning = false;
|
||||
idleBuffer = baseband_buffer.get();
|
||||
audioPath_release(outPath);
|
||||
|
|
Ładowanie…
Reference in New Issue