Skip to content
Open
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a9b04a4
Remove FIFO thread
sakertooth Mar 18, 2025
378d6b4
Fix selection of frames per period
sakertooth Mar 18, 2025
c02c27f
Add "is running" flag for audio devices
sakertooth Mar 18, 2025
1311ce6
Remove extra start/stop flags in audio devices
sakertooth Mar 18, 2025
9d9ca6f
Revert "Remove extra start/stop flags in audio devices"
sakertooth Mar 18, 2025
27272f7
Store separate frames per period size in audio device
sakertooth Mar 18, 2025
5eaff81
Add chunking
sakertooth Mar 19, 2025
07737ce
Fix dummy sound output
sakertooth Mar 19, 2025
72d2882
Specify nullptr explicitly
sakertooth Mar 19, 2025
bd52612
Attempt to fix MINGW and MSVC builds
sakertooth Mar 19, 2025
0a130b4
Attempt to fix MINGW and MSVC builds
sakertooth Mar 19, 2025
7fb14b7
Pass in size parameter to getNextBuffer, return bool instead
sakertooth Mar 19, 2025
b84bec1
Remove processNextBuffer and move writeBuffer into AudioDevice
sakertooth Mar 23, 2025
aeb5fdf
Create AudioDevice::nextBuffer function to simplify translation of re…
sakertooth Mar 23, 2025
c8ef1a6
Fix nextBuffer function
sakertooth Mar 23, 2025
3dd62ee
Calculate the number of frames based on the length parameter in sdlAu…
sakertooth Mar 23, 2025
7ebb85a
Use SND_PCM_FORMAT_FLOAT in ALSA
sakertooth Mar 23, 2025
6597ce3
Remove assert
sakertooth Mar 23, 2025
cfd51c1
Fix comparison warnings
sakertooth Mar 23, 2025
f414cf5
Pass in correct frame count when fetching buffers in PortAudio callback
sakertooth Mar 23, 2025
8e5cede
Use PA_SAMPLE_FLOAT32 in PulseAudio
sakertooth Mar 23, 2025
a7d5e4b
Use pa_stream_begin_write to avoid extra copies
sakertooth Mar 23, 2025
f5dc315
Fix soundio callback
sakertooth Mar 23, 2025
f5d0e4c
Do not ignore return type on write call in OSS
sakertooth Mar 23, 2025
d562fe9
Ensure to silence buffer if nextBuffer returns false for callback-bas…
sakertooth Mar 23, 2025
10c55da
Use same signedness
sakertooth Mar 23, 2025
b5bfa07
Fix more signedness issues
sakertooth Mar 23, 2025
bc0abb7
Fix a few issues
sakertooth Mar 25, 2025
f23122b
Split nextBuffer declaration into two (one for interleaved, one for p…
sakertooth Jun 1, 2025
4d1e182
Update src/core/audio/AudioAlsa.cpp
sakertooth Jun 18, 2025
821189e
Use static_cast instead of reinterpret_cast
sakertooth Jun 28, 2025
ce20d72
Use new audio buffer view classes
sakertooth Jun 28, 2025
abd51d6
Render next buffer after resetting timer
sakertooth Jun 28, 2025
ee70d3f
Remove endian handling within audio devices
sakertooth Jun 28, 2025
243f299
Make start and stop functions non-virtual, add pure virtual impl func…
sakertooth Jun 28, 2025
8ffa18a
Make startProcessing and stopProcessing non virtual
sakertooth Jun 29, 2025
0dd7795
Remove unused function that was added in here
sakertooth Jun 29, 2025
717e49f
Remove temp
sakertooth Jul 3, 2025
9a7fc69
Add isRunning function
sakertooth Jul 5, 2025
5bdff28
Merge remote-tracking branch 'upstream' into fix-resampling
sakertooth Jul 31, 2025
a7df657
Fix build
sakertooth Jul 31, 2025
1eb4ef4
Merge remote-tracking branch 'upstream' into revamp-buffers
sakertooth Aug 15, 2025
195b823
Simplify nextBuffer function with new AudioBufferView concept
sakertooth Aug 16, 2025
f8995b7
Simplify loop even further
sakertooth Aug 16, 2025
4d0d8fe
Check if device running in while loop
sakertooth Aug 16, 2025
05f41b2
Remove m_quit variable
sakertooth Aug 16, 2025
cd63c6a
Add sample function in buffer view classes
sakertooth Sep 8, 2025
5f71b0b
Remove framesPerPeriod from AudioDevice
sakertooth Sep 11, 2025
af53322
Set the buffer size for the JACK backend
sakertooth Sep 11, 2025
872baef
Use framesPerAudioBuffer where appropriate
sakertooth Sep 11, 2025
26ba7ad
Move template instantiations down the file
sakertooth Sep 13, 2025
c1857a2
Do not call stopProcessing in destructor, assert that device is stopp…
sakertooth Sep 13, 2025
6c97be8
Merge remote-tracking branch 'upstream' into revamp-buffers
sakertooth Nov 16, 2025
e00f57f
Set frames per audio buffer within engine
sakertooth Nov 21, 2025
4a17480
Add new renderNextPeriod function, move use of nextBuffer to renderNe…
sakertooth Nov 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions src/core/audio/AudioDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,35 @@ template void AudioDevice::nextBuffer<InterleavedBufferView<float>>(InterleavedB
template void AudioDevice::nextBuffer<PlanarBufferView<float>>(PlanarBufferView<float> dst);
void AudioDevice::nextBuffer(AudioBufferView<float> auto dst)
{
for (auto frame = std::size_t{0}; frame < dst.frames(); ++frame)
auto dstAt = [&dst](ch_cnt_t channel, f_cnt_t frame) -> float& {
return decltype(dst)::Interleaved ? dst[frame][channel] : dst[channel][frame];
};

for (auto frame = f_cnt_t{0}; frame < dst.frames(); ++frame)
{
if (m_audioEngineBufferIndex == 0) { m_audioEngineBuffer = m_audioEngine->renderNextBuffer(); }
const auto audioEngineFrame = m_audioEngineBuffer[m_audioEngineBufferIndex];

for (auto channel = 0; channel < dst.channels(); ++channel)
switch (dst.channels())
{
if (dst.channels() == 1)
{
if constexpr (decltype(dst)::Interleaved) { dst[frame][0] = audioEngineFrame.average(); }
else { dst[channel][frame] = audioEngineFrame.average(); }
continue;
}

if constexpr (decltype(dst)::Interleaved)
case 0:
assert(false);
break;
case 1:
dstAt(0, frame) = audioEngineFrame.average();
break;
case 2:
dstAt(0, frame) = audioEngineFrame[0];
dstAt(1, frame) = audioEngineFrame[1];
break;
default:
dstAt(0, frame) = audioEngineFrame[0];
dstAt(1, frame) = audioEngineFrame[1];
for (auto channel = 2; channel < dst.channels(); ++channel)
{
dst[frame][channel] = channel < DEFAULT_CHANNELS ? audioEngineFrame[channel] : 0.f;
dst[frame][channel] = 0.f;
}
else { dst[channel][frame] = channel < DEFAULT_CHANNELS ? audioEngineFrame[channel] : 0.f; }
break;
}

m_audioEngineBufferIndex = (m_audioEngineBufferIndex + 1) % m_audioEngine->framesPerPeriod();
Expand Down
Loading