Skip to content

Commit

Permalink
8bit pcm のときに壊れるのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
autch committed Dec 6, 2024
1 parent 4d1f3da commit 9db96aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kpisrla/SampleHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ uint32_t SampleHolder::render_8(BYTE* pBuffer, DWORD dwSampleOffset, DWORD dwSam
for (int ch = 0; ch < num_channels; ch++)
{
int32_t sample = channels[ch][s];
reinterpret_cast<int8_t*>(pBuffer)[offset * num_channels + ch] = static_cast<int8_t>(sample - 128);
reinterpret_cast<uint8_t*>(pBuffer)[offset * num_channels + ch] = static_cast<uint8_t>(sample + 128);
}
}
return dwSampleUpperLimit - dwSampleOffset;
Expand Down
4 changes: 2 additions & 2 deletions srlaenc/Deinterleaver.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class Deinterleaver
case 8:
return [](void* input, size_t sample, int ch, int num_channels) -> int32_t
{
auto p = static_cast<int8_t*>(input);
return p[sample * num_channels + ch] - 128;
auto p = static_cast<uint8_t*>(input);
return static_cast<int32_t>(p[sample * num_channels + ch]) - 128;
};
case 16:
return [](void* input, size_t sample, int ch, int num_channels) -> int32_t
Expand Down

0 comments on commit 9db96aa

Please sign in to comment.