-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mostly just cleanup work. Added ModuleWaveshaper, but I have my doubt…
…s that it is working correctly. I'll be reaserhing this more later.
- Loading branch information
Showing
14 changed files
with
320 additions
and
34 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,6 @@ | ||
#ifndef WaveshaperTables_h | ||
#define WaveshaperTables_h | ||
|
||
extern const uint8_t WAVE_SHAPER_TABLES[][4096]; | ||
|
||
#endif |
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,34 @@ | ||
|
||
#include "defines.h" | ||
#include "ModuleWaveshaper.h" | ||
#include "GlobalWaveshaperTables.h" | ||
|
||
ModuleWaveshaper::ModuleWaveshaper() | ||
{ | ||
// Initialize all inputs | ||
this->audio_input = NULL; | ||
this->mix_input = NULL; | ||
this->waveshaper_input = NULL; | ||
} | ||
|
||
uint16_t ModuleWaveshaper::compute() | ||
{ | ||
// Read inputs | ||
uint16_t audio = this->readInput(audio_input); | ||
uint16_t waveshaper = this->readInput(waveshaper_input,0,4); | ||
uint16_t wet_mix = this->readInput(mix_input); | ||
|
||
uint16_t dry_mix = 4095 - wet_mix; | ||
|
||
uint16_t shaped_output = WAVE_SHAPER_TABLES[waveshaper][audio]; | ||
|
||
if(wet_mix == 0) | ||
{ | ||
return(audio); | ||
} | ||
else | ||
{ | ||
return(((shaped_output * wet_mix) >> 12) + ((audio * dry_mix) >> 12)); | ||
} | ||
} | ||
|
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,35 @@ | ||
/* | ||
* +----------------------+ | ||
* | ModuleWaveshaper | | ||
* |----------------------| | ||
* > audio_input | | ||
* | | | ||
* | output > | ||
* +----------------------+ | ||
!!!!!!! This module doesn't work at all yet !!!!!!!!!!!!!!! | ||
*/ | ||
|
||
|
||
#ifndef ModuleWaveshaper_h | ||
#define ModuleWaveshaper_h | ||
|
||
#include "Module.h" | ||
|
||
class ModuleWaveshaper : public Module | ||
{ | ||
|
||
public: | ||
|
||
// Methods | ||
ModuleWaveshaper(); | ||
uint16_t compute(); | ||
|
||
// Inputs | ||
Module *audio_input; | ||
Module *mix_input; | ||
Module *waveshaper_input; | ||
}; | ||
|
||
#endif |
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,16 @@ | ||
#include "SynthTutorial16.h" | ||
|
||
SynthTutorial16::SynthTutorial16(Inputs* inputs) | ||
{ | ||
ModuleWavetableOsc *wavetable_osc = new ModuleWavetableOsc(); | ||
ModuleWaveshaper *wave_shaper = new ModuleWaveshaper(); | ||
|
||
wavetable_osc->wavetable_input = inputs->mod; | ||
wavetable_osc->frequency_input = inputs->sr; | ||
|
||
wave_shaper->audio_input = wavetable_osc; | ||
wave_shaper->mix_input = inputs->param1; | ||
wave_shaper->waveshaper_input = inputs->param2; | ||
|
||
this->last_module = wave_shaper; | ||
} |
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,28 @@ | ||
// ============================================================================= | ||
// | ||
// Name: SynthTutorial16 | ||
// Written by: Bret Truchan, 2014 | ||
// | ||
// Description: Demonstration of ModuleWaveShaper | ||
// | ||
// SR - Sample rate input | ||
// MOD - Wavetable selection | ||
// [1] - Wet/Dry mix for waveshaper | ||
// [2] - not used | ||
// [3] - not used | ||
// GATE - not used | ||
// | ||
// ============================================================================= | ||
|
||
#ifndef SynthTutorial16_h | ||
#define SynthTutorial16_h | ||
|
||
#include "Synth.h" | ||
|
||
class SynthTutorial16 : public Synth | ||
{ | ||
public: | ||
SynthTutorial16(Inputs *inputs); | ||
}; | ||
|
||
#endif |
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.