Skip to content

Commit

Permalink
Merge pull request #515 from ferdnyc/audio-path-config
Browse files Browse the repository at this point in the history
Enable building with a libopenshot-audio that's based on non-bundled JUCE
  • Loading branch information
ferdnyc committed May 19, 2020
2 parents 9922479 + affd4b2 commit 25ca2d0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions include/Qt/AudioPlaybackThread.h
Expand Up @@ -75,7 +75,7 @@ namespace openshot
static AudioDeviceManagerSingleton * Instance();

/// Public device manager property
AudioDeviceManager audioDeviceManager;
juce::AudioDeviceManager audioDeviceManager;

/// Close audio device
void CloseAudioDevice();
Expand All @@ -86,9 +86,9 @@ namespace openshot
*/
class AudioPlaybackThread : juce::Thread
{
AudioSourcePlayer player;
AudioTransportSource transport;
MixerAudioSource mixer;
juce::AudioSourcePlayer player;
juce::AudioTransportSource transport;
juce::MixerAudioSource mixer;
AudioReaderSource *source;
double sampleRate;
int numChannels;
Expand Down
13 changes: 7 additions & 6 deletions src/Frame.cpp
Expand Up @@ -829,7 +829,7 @@ void Frame::AddImage(std::shared_ptr<QImage> new_image, bool only_odd_lines)
if (ret) {
return;
}

// Get the frame's image
const GenericScopedLock<juce::CriticalSection> lock(addingImageSection);
#pragma omp critical (AddImage)
Expand Down Expand Up @@ -979,7 +979,8 @@ void Frame::Play()
return;

juce::AudioDeviceManager deviceManager;
String error = deviceManager.initialise (0, /* number of input channels */
juce::String error = deviceManager.initialise (
0, /* number of input channels */
2, /* number of output channels */
0, /* no XML settings.. */
true /* select default device on failure */);
Expand All @@ -992,17 +993,17 @@ void Frame::Play()
juce::AudioSourcePlayer audioSourcePlayer;
deviceManager.addAudioCallback (&audioSourcePlayer);

ScopedPointer<AudioBufferSource> my_source;
my_source = new AudioBufferSource(audio.get());
std::unique_ptr<AudioBufferSource> my_source;
my_source.reset (new AudioBufferSource (audio.get()));

// Create TimeSliceThread for audio buffering
juce::TimeSliceThread my_thread("Audio buffer thread");

// Start thread
my_thread.startThread();

AudioTransportSource transport1;
transport1.setSource (my_source,
juce::AudioTransportSource transport1;
transport1.setSource (my_source.get(),
5000, // tells it to buffer this many samples ahead
&my_thread,
(double) sample_rate,
Expand Down
3 changes: 3 additions & 0 deletions src/bindings/ruby/CMakeLists.txt
Expand Up @@ -72,6 +72,9 @@ endif()
set_property(SOURCE openshot.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE openshot.i PROPERTY SWIG_MODULE_NAME openshot)

### Unbreak std::isfinite()
add_compile_definitions(HAVE_ISFINITE=1)

### Suppress a ton of warnings in the generated SWIG C++ code
set(SWIG_CXX_FLAGS "-Wno-unused-variable -Wno-unused-function \
-Wno-deprecated-copy -Wno-class-memaccess -Wno-cast-function-type \
Expand Down

0 comments on commit 25ca2d0

Please sign in to comment.