add soft-clipping of mixed sounds using tanh

expose ADSR to TinyAudio API
enable envelope when playing wav files
This commit is contained in:
Erwin Coumans
2017-04-28 12:39:51 -07:00
parent 821ad96549
commit c95a1c9c33
8 changed files with 51 additions and 19 deletions

View File

@@ -80,7 +80,7 @@ public:
virtual void initPhysics()
{
int numSoundSources = 8;
int numSoundSources = 32;
bool useRealTimeDac = true;
m_soundEngine.init(numSoundSources, useRealTimeDac);
@@ -138,10 +138,13 @@ public:
b3SoundMessage msg;
msg.m_type = B3_SOUND_SOURCE_SINE_OSCILLATOR;
msg.m_frequency = freq;
msg.m_amplitude = .25;
msg.m_amplitude = 1;
//msg.m_type = B3_SOUND_SOURCE_WAV_FILE;
//msg.m_wavId = m_wavId;
msg.m_type = B3_SOUND_SOURCE_WAV_FILE;
msg.m_wavId = m_wavId;
msg.m_attackRate = 1;
msg.m_sustainLevel = 1;
msg.m_releaseRate = 0.001;
m_soundEngine.startSound(soundSourceIndex, msg);
m_keyToSoundSource.insert(hs,soundSourceIndex);