[client] audio: cosmetics

This commit is contained in:
Geoffrey McRae 2022-01-27 17:24:43 +11:00
parent 41884bfcc5
commit 016001da67

View file

@ -260,7 +260,8 @@ static int playbackPullFrames(uint8_t * dst, int frames)
} }
} }
PlaybackDeviceTick tick = { PlaybackDeviceTick tick =
{
.nextTime = data->nextTime, .nextTime = data->nextTime,
.nextPosition = data->nextPosition .nextPosition = data->nextPosition
}; };
@ -406,10 +407,10 @@ void audio_playbackData(uint8_t * data, size_t size)
int64_t now = nanotime(); int64_t now = nanotime();
// Convert from s16 to f32 samples // Convert from s16 to f32 samples
int spiceStride = audio.playback.channels * sizeof(int16_t); int spiceStride = audio.playback.channels * sizeof(int16_t);
int frames = size / spiceStride; int frames = size / spiceStride;
bool periodChanged = frames != spiceData->periodFrames; bool periodChanged = frames != spiceData->periodFrames;
bool init = spiceData->periodFrames == 0; bool init = spiceData->periodFrames == 0;
if (periodChanged) if (periodChanged)
{ {
@ -531,15 +532,17 @@ void audio_playbackData(uint8_t * data, size_t size)
int consumed = 0; int consumed = 0;
while (consumed < frames) while (consumed < frames)
{ {
SRC_DATA srcData = { SRC_DATA srcData =
.data_in = spiceData->framesIn + consumed * audio.playback.channels, {
.data_out = spiceData->framesOut, .data_in = spiceData->framesIn +
.input_frames = frames - consumed, consumed * audio.playback.channels,
.output_frames = spiceData->framesOutSize, .data_out = spiceData->framesOut,
.input_frames = frames - consumed,
.output_frames = spiceData->framesOutSize,
.input_frames_used = 0, .input_frames_used = 0,
.output_frames_gen = 0, .output_frames_gen = 0,
.end_of_input = 0, .end_of_input = 0,
.src_ratio = ratio .src_ratio = ratio
}; };
int error = src_process(spiceData->src, &srcData); int error = src_process(spiceData->src, &srcData);