-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure bridge code so everything isn't declared in one file
- Loading branch information
1 parent
979b2ee
commit 7e6bba4
Showing
17 changed files
with
213 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <juce_audio_basics/juce_audio_basics.h> | ||
#include <rust/cxx.h> | ||
|
||
namespace cxx_juce::iir_filter | ||
{ | ||
std::unique_ptr<juce::SingleThreadedIIRFilter> createIIRFilter (std::array<rust::f32, 5> coefficients); | ||
std::array<rust::f32, 5> makeLowPass (double sampleRate, double cutoffFrequency, double q); | ||
std::array<rust::f32, 5> makeHighPass (double sampleRate, double cutoffFrequency, double q); | ||
std::array<rust::f32, 5> makeNotchFilter (double sampleRate, double cutoffFrequency, double q); | ||
} // namespace cxx_juce::iir_filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
bridge/cxx_juce_audio_devices/cxx_juce_audio_callback_handle.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#include "juce_audio_devices/juce_audio_devices.h" | ||
#include <rust/cxx.h> | ||
|
||
namespace cxx_juce | ||
{ | ||
|
||
struct BoxedAudioIODeviceCallback; | ||
|
||
class AudioCallbackHandle : public juce::AudioIODeviceCallback | ||
{ | ||
public: | ||
explicit AudioCallbackHandle (juce::AudioDeviceManager& audioDeviceManager, | ||
rust::Box<BoxedAudioIODeviceCallback> callback); | ||
~AudioCallbackHandle() override; | ||
|
||
void audioDeviceAboutToStart (juce::AudioIODevice* device) override; | ||
void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, | ||
int numInputChannels, | ||
float* const* outputChannelData, | ||
int numOutputChannels, | ||
int numSamples, | ||
const juce::AudioIODeviceCallbackContext& context) override; | ||
void audioDeviceStopped() override; | ||
|
||
private: | ||
juce::AudioDeviceManager& _audioDeviceManager; | ||
rust::Box<BoxedAudioIODeviceCallback> _callback; | ||
}; | ||
|
||
} // namespace cxx_juce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
bridge/cxx_juce_audio_devices/cxx_juce_audio_device_manager.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#pragma once | ||
|
||
#include "cxx_juce_audio_callback_handle.h" | ||
#include "cxx_juce_audio_device_setup.h" | ||
|
||
#include <juce_audio_devices/juce_audio_devices.h> | ||
#include <rust/cxx.h> | ||
|
||
namespace cxx_juce | ||
{ | ||
|
||
struct BoxedAudioIODeviceType; | ||
|
||
struct AudioDeviceManager | ||
{ | ||
void initialiseWithDefaultDevices (rust::i32 inputChannels, | ||
rust::i32 outputChannels); | ||
[[nodiscard]] std::unique_ptr<AudioDeviceSetup> getAudioDeviceSetup() const; | ||
void setAudioDeviceSetup (const AudioDeviceSetup& setup); | ||
[[nodiscard]] std::unique_ptr<AudioCallbackHandle> | ||
addAudioCallback (rust::Box<BoxedAudioIODeviceCallback> callback); | ||
void addAudioDeviceType (rust::Box<BoxedAudioIODeviceType> audioIODeviceType); | ||
void setCurrentAudioDeviceType (rust::Str audioDeviceTypeName); | ||
void playTestSound(); | ||
juce::AudioIODevice* getCurrentAudioDevice() const; | ||
const juce::OwnedArray<juce::AudioIODeviceType>& getAvailableDeviceTypes(); | ||
juce::AudioIODeviceType* getCurrentDeviceTypeObject() const; | ||
|
||
juce::AudioDeviceManager _audioDeviceManager; | ||
}; | ||
|
||
std::unique_ptr<AudioDeviceManager> createAudioDeviceManager(); | ||
|
||
} // namespace cxx_juce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.