1
1
#include " PluginProcessor.h"
2
2
#include " PluginEditor.h"
3
3
4
- std::mutex NdiAudioProcessor::init_mutex {};
4
+ std::mutex NdiAudioProcessor::init_mutex{};
5
5
6
6
// ==============================================================================
7
7
NdiAudioProcessor::NdiAudioProcessor ()
8
8
// : AudioProcessor()
9
9
: AudioProcessor(
10
10
BusesProperties ()
11
11
.withInput(" Input" , juce::AudioChannelSet::stereo(), true)
12
- .withOutput(" Output" , juce::AudioChannelSet::stereo(), true))
13
- , apvts {*this , nullptr , juce::Identifier (" APVTS" ), createParameterLayout ()}
12
+ .withOutput(" Output" , juce::AudioChannelSet::stereo(), true)),
13
+ apvts {*this , nullptr , juce::Identifier (" APVTS" ), createParameterLayout ()}
14
14
{
15
15
std::scoped_lock init_lock (init_mutex);
16
16
17
- std::string ndi_runtime_path {};
17
+ std::string ndi_runtime_path{};
18
18
auto ndi_runtime_path_included =
19
19
#ifdef __linux__
20
20
File::getSpecialLocation (File::userApplicationDataDirectory)
21
21
#else
22
22
File::getSpecialLocation (File::commonApplicationDataDirectory)
23
- #endif
24
- #ifdef __APPLE__
25
- .getChildFile (" Application Support" )
26
23
#endif
27
24
.getChildFile (JucePlugin_Name)
28
25
.getChildFile (NDILIB_LIBRARY_NAME)
29
26
.getFullPathName ();
30
27
28
+ #ifdef __APPLE__
29
+ ndi_runtime_path_included =
30
+ File::File (" /usr/local/lib" )
31
+ .getChildFile (NDILIB_LIBRARY_NAME)
32
+ .getFullPathName ();
33
+ #endif
34
+
31
35
#ifdef __linux__
32
36
// linux and macos
33
37
goto linux_load;
34
38
linux_load:
35
39
#define dynamic_load 1
36
40
hNDILib = nullptr ;
37
- const char * p_ndi_runtime_v5 = getenv (NDILIB_REDIST_FOLDER);
41
+ const char * p_ndi_runtime_v5 = getenv (NDILIB_REDIST_FOLDER);
38
42
if (p_ndi_runtime_v5)
39
43
{
40
44
ndi_runtime_path = p_ndi_runtime_v5;
@@ -58,10 +62,10 @@ NdiAudioProcessor::NdiAudioProcessor()
58
62
hNDILib = dlopen (ndi_runtime_path.c_str (), RTLD_LOCAL | RTLD_LAZY);
59
63
60
64
// The main NDI entry point for dynamic loading if we got the librari
61
- const NDIlib_v5* (*NDIlib_v5_load)(void ) = nullptr ;
65
+ const NDIlib_v5 * (*NDIlib_v5_load)(void ) = nullptr ;
62
66
if (hNDILib)
63
67
{
64
- *((void **)&NDIlib_v5_load) = dlsym (hNDILib, " NDIlib_v5_load" );
68
+ *((void **)&NDIlib_v5_load) = dlsym (hNDILib, " NDIlib_v5_load" );
65
69
}
66
70
if (!NDIlib_v5_load)
67
71
{
@@ -82,7 +86,7 @@ NdiAudioProcessor::NdiAudioProcessor()
82
86
// Windows 32 and 64
83
87
#define dynamic_load 1
84
88
85
- char * p_ndi_runtime_v5 = nullptr ;
89
+ char * p_ndi_runtime_v5 = nullptr ;
86
90
size_t sz = 0 ;
87
91
auto err = _dupenv_s (&p_ndi_runtime_v5, &sz, NDILIB_REDIST_FOLDER);
88
92
if (!err && p_ndi_runtime_v5 != nullptr )
@@ -109,10 +113,10 @@ NdiAudioProcessor::NdiAudioProcessor()
109
113
}
110
114
hNDILib = LoadLibraryA (ndi_runtime_path.c_str ());
111
115
112
- const NDIlib_v5* (*NDIlib_v5_load)(void ) = nullptr ;
116
+ const NDIlib_v5 * (*NDIlib_v5_load)(void ) = nullptr ;
113
117
if (hNDILib)
114
118
{
115
- *((FARPROC*)&NDIlib_v5_load) =
119
+ *((FARPROC *)&NDIlib_v5_load) =
116
120
GetProcAddress (hNDILib, " NDIlib_v5_load" );
117
121
}
118
122
@@ -276,7 +280,7 @@ const juce::String NdiAudioProcessor::getProgramName(int index)
276
280
}
277
281
278
282
void NdiAudioProcessor::changeProgramName (int index,
279
- const juce::String& newName)
283
+ const juce::String & newName)
280
284
{
281
285
(void )index;
282
286
(void )newName;
@@ -350,7 +354,7 @@ void NdiAudioProcessor::releaseResources()
350
354
}
351
355
352
356
#ifndef JucePlugin_PreferredChannelConfigurations
353
- bool NdiAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
357
+ bool NdiAudioProcessor::isBusesLayoutSupported (const BusesLayout & layouts) const
354
358
{
355
359
(void )layouts;
356
360
// This checks if the input layout matches the output layout
@@ -360,8 +364,8 @@ bool NdiAudioProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
360
364
#endif
361
365
362
366
template <typename T>
363
- void NdiAudioProcessor::processBlock2 (juce::AudioBuffer<T>& buffer,
364
- juce::MidiBuffer& midiMessages)
367
+ void NdiAudioProcessor::processBlock2 (juce::AudioBuffer<T> & buffer,
368
+ juce::MidiBuffer & midiMessages)
365
369
{
366
370
(void )midiMessages;
367
371
@@ -432,7 +436,7 @@ void NdiAudioProcessor::processBlock2(juce::AudioBuffer<T>& buffer,
432
436
recv_channels.size () <= totalNumOutputChannels)
433
437
{
434
438
select_channels_ok = true ;
435
- for (auto && i : recv_channels)
439
+ for (auto && i : recv_channels)
436
440
{
437
441
if (i > num_source_channels)
438
442
select_channels_ok = false ;
@@ -478,13 +482,13 @@ bool NdiAudioProcessor::hasEditor() const
478
482
return true ; // (change this to false if you choose to not supply an editor)
479
483
}
480
484
481
- juce::AudioProcessorEditor* NdiAudioProcessor::createEditor ()
485
+ juce::AudioProcessorEditor * NdiAudioProcessor::createEditor ()
482
486
{
483
487
return new NdiAudioProcessorEditor (*this );
484
488
}
485
489
486
490
// ================================================================= =
487
- void NdiAudioProcessor::getStateInformation (juce::MemoryBlock& destData)
491
+ void NdiAudioProcessor::getStateInformation (juce::MemoryBlock & destData)
488
492
{
489
493
// block. You should use this method to store your parameters in
490
494
// the memory block. You could do that either as raw data, or use the X
@@ -499,7 +503,7 @@ void NdiAudioProcessor::getStateInformation(juce::MemoryBlock& destData)
499
503
copyXmlToBinary (*xml, destData);
500
504
}
501
505
502
- void NdiAudioProcessor::setStateInformation (const void * data, int sizeInBytes)
506
+ void NdiAudioProcessor::setStateInformation (const void * data, int sizeInBytes)
503
507
{
504
508
// memory You should use this method to restore your paramete
505
509
// rs from this memory block, whose contents will have been created by the
@@ -522,7 +526,7 @@ void NdiAudioProcessor::setStateInformation(const void* data, int sizeInBytes)
522
526
return ;
523
527
}
524
528
525
- void NdiAudioProcessor::parameterChanged (const String& parameterID,
529
+ void NdiAudioProcessor::parameterChanged (const String & parameterID,
526
530
float newValue)
527
531
{
528
532
if (!p_NDILib)
@@ -596,7 +600,7 @@ void NdiAudioProcessor::parameterChanged(const String& parameterID,
596
600
597
601
// ==============================================================================
598
602
// This creates new instances of the plugin..
599
- juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter ()
603
+ juce::AudioProcessor * JUCE_CALLTYPE createPluginFilter ()
600
604
{
601
605
return new NdiAudioProcessor ();
602
606
}
0 commit comments