Skip to content

Commit a25513b

Browse files
committed
Adding default audio buffer size to libopenshot settings, and setting default to 512. Also, adding some debugging output. This will allow users to override the default audio buffer size, to better customize for their system.
1 parent ad5a600 commit a25513b

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/AudioReaderSource.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include "AudioReaderSource.h"
1414
#include "Exceptions.h"
1515
#include "Frame.h"
16-
#include "ZmqLogger.h"
17-
1816

1917
using namespace std;
2018
using namespace openshot;
@@ -44,8 +42,6 @@ void AudioReaderSource::getNextAudioBlock(const juce::AudioSourceChannelInfo& in
4442
}
4543

4644
while (remaining_samples > 0) {
47-
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::getNextAudioBlock", "remaining_samples", remaining_samples);
48-
4945
try {
5046
// Get current frame object
5147
if (reader) {

src/Qt/AudioPlaybackThread.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ namespace openshot
5959

6060
std::stringstream constructor_title;
6161
constructor_title << "AudioDeviceManagerSingleton::Instance (default audio device type: " <<
62-
Settings::Instance()->PLAYBACK_AUDIO_DEVICE_TYPE << ", default audio device name: " <<
63-
Settings::Instance()->PLAYBACK_AUDIO_DEVICE_NAME << ")";
64-
ZmqLogger::Instance()->AppendDebugMethod(constructor_title.str(), "channels", channels);
62+
Settings::Instance()->PLAYBACK_AUDIO_DEVICE_TYPE << ", default audio device name: " <<
63+
Settings::Instance()->PLAYBACK_AUDIO_DEVICE_NAME << ")";
64+
ZmqLogger::Instance()->AppendDebugMethod(constructor_title.str(), "channels", channels, "buffer", Settings::Instance()->PLAYBACK_AUDIO_BUFFER_SIZE);
6565

6666
// Get preferred audio device type and name (if any - these can be blank)
6767
openshot::AudioDeviceInfo requested_device = {Settings::Instance()->PLAYBACK_AUDIO_DEVICE_TYPE,
@@ -113,7 +113,7 @@ namespace openshot
113113
AudioDeviceManager::AudioDeviceSetup deviceSetup = AudioDeviceManager::AudioDeviceSetup();
114114
deviceSetup.inputChannels = 0;
115115
deviceSetup.outputChannels = channels;
116-
deviceSetup.bufferSize = 512;
116+
deviceSetup.bufferSize = Settings::Instance()->PLAYBACK_AUDIO_BUFFER_SIZE;
117117

118118
// Loop through common sample rates, starting with the user's requested rate
119119
// Not all sample rates are supported by audio devices, for example, many VMs

src/Settings.h

+3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ namespace openshot {
103103
/// The device type for the playback audio devices
104104
std::string PLAYBACK_AUDIO_DEVICE_TYPE = "";
105105

106+
/// Size of playback buffer before audio playback starts
107+
int PLAYBACK_AUDIO_BUFFER_SIZE = 512;
108+
106109
/// The current install path of OpenShot (needs to be set when using Timeline(path), since certain
107110
/// paths depend on the location of OpenShot transitions and files)
108111
std::string PATH_OPENSHOT_INSTALL = "";

0 commit comments

Comments
 (0)