basic audio generation

This commit is contained in:
Edouard Dupin 2012-07-25 12:31:27 +02:00
parent 45932442a4
commit 87db64f5f9
5 changed files with 614 additions and 58 deletions

View File

@ -48,6 +48,18 @@
#undef __class__
#define __class__ "MainWindows"
static const char* const l_applEventPlay = "appl-play";
static const char* const l_applEventBlit = "appl-Blit";
static const char* const l_applEventJump = "appl-Jump";
static const char* const l_applEventHit = "appl-Hit";
static const char* const l_applEventPowerUp = "appl-PowerUp";
static const char* const l_applEventExplosion = "appl-Explosion";
static const char* const l_applEventLaser = "appl-Laser";
static const char* const l_applEventPick = "appl-Pick";
static const char* const l_applEventRandom = "appl-Random";
static const char* const l_applEventMutant = "appl-Mutant";
MainWindows::MainWindows(void)
{
APPL_DEBUG("CREATE WINDOWS ... ");
@ -69,25 +81,42 @@ MainWindows::MainWindows(void)
mySizerVert2 = new ewol::SizerVert();
mySizerHori->SubWidgetAdd(mySizerVert2);
myButton = new ewol::Button("Play");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventPlay);
mySizerVert2->SubWidgetAdd(myButton);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendY(true);
mySizerVert2->SubWidgetAdd(mySpacer);
myButton = new ewol::Button("BLIP/SELECT");
myButton = new ewol::Button("Blip/Select");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventBlit);
mySizerVert2->SubWidgetAdd(myButton);
myButton = new ewol::Button("JUMP");
myButton = new ewol::Button("Jump");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventJump);
mySizerVert2->SubWidgetAdd(myButton);
myButton = new ewol::Button("HIT/HURT");
myButton = new ewol::Button("Hit/Hurt");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventHit);
mySizerVert2->SubWidgetAdd(myButton);
myButton = new ewol::Button("POWER UP");
myButton = new ewol::Button("Power up");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventPowerUp);
mySizerVert2->SubWidgetAdd(myButton);
myButton = new ewol::Button("EXPLOSION");
myButton = new ewol::Button("Explosion");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventExplosion);
mySizerVert2->SubWidgetAdd(myButton);
myButton = new ewol::Button("LASER/SHOOT");
myButton = new ewol::Button("Laser/Shoot");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventLaser);
mySizerVert2->SubWidgetAdd(myButton);
myButton = new ewol::Button("PICKUP/COIN");
myButton = new ewol::Button("Pick up/Coin");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventPick);
mySizerVert2->SubWidgetAdd(myButton);
myButton = new ewol::Button("Random");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventRandom);
mySizerVert2->SubWidgetAdd(myButton);
myButton = new ewol::Button("Mutant");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_applEventMutant);
mySizerVert2->SubWidgetAdd(myButton);
mySizerVert2 = new ewol::SizerVert();
mySizerHori->SubWidgetAdd(mySizerVert2);
@ -98,37 +127,67 @@ MainWindows::MainWindows(void)
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("HP FILTER CUTOFF SWEEP");
myLabel = new ewol::Label("HP filter cutoff sweep");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("HP FILTER CUTOFF");
myLabel = new ewol::Label("HP filter cutoff");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("LP FILTER RESONANCE");
myLabel = new ewol::Label("LP filter resonance");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("LP FILTER CUTOFF SWEEP");
myLabel = new ewol::Label("LP filter cutoff sweep");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("LP FILTER CUTOFF");
myLabel = new ewol::Label("LP filter cutoff");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySpacer = new ewol::Spacer();
@ -137,16 +196,28 @@ MainWindows::MainWindows(void)
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("PHASER SWEEP");
myLabel = new ewol::Label("Phaser sweep");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("PHASER OFFSET");
myLabel = new ewol::Label("Phaser offset");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
@ -156,9 +227,15 @@ MainWindows::MainWindows(void)
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("REPEAT SPEED");
myLabel = new ewol::Label("Repeat speed");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
@ -168,16 +245,28 @@ MainWindows::MainWindows(void)
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("DUTY SWEEP");
myLabel = new ewol::Label("Duty sweep");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("SQUARE DUTY");
myLabel = new ewol::Label("Square duty");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySpacer = new ewol::Spacer();
@ -186,16 +275,28 @@ MainWindows::MainWindows(void)
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("CHANGE SPEED");
myLabel = new ewol::Label("Change speed");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("CHANGE AMOUNT");
myLabel = new ewol::Label("Change amount");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
@ -206,44 +307,80 @@ MainWindows::MainWindows(void)
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("VIBRATO SPEED");
myLabel = new ewol::Label("Vibrato speed");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("VIBRATO DEPTH");
myLabel = new ewol::Label("Vibrato depth");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("DELTA SLIDE");
myLabel = new ewol::Label("Delta slide");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("SLIDE");
myLabel = new ewol::Label("Slide");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("MIN FREQUENCY");
myLabel = new ewol::Label("Min frequency");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("START FREQUENCY");
myLabel = new ewol::Label("Start frequency");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySpacer = new ewol::Spacer();
@ -252,30 +389,54 @@ MainWindows::MainWindows(void)
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("DECAY TIME");
myLabel = new ewol::Label("Decay time");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("SUSTAIN PUNCH");
myLabel = new ewol::Label("Sustain punch");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("SUSTAIN TIME");
myLabel = new ewol::Label("Sustain time");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
myLabel = new ewol::Label("ATTACK TIME");
myLabel = new ewol::Label("Attack time");
mySizerHori2->SubWidgetAdd(myLabel);
mySpacer = new ewol::Spacer();
mySpacer->SetExpendX(true);
mySizerHori2->SubWidgetAdd(mySpacer);
mySlider = new ewol::Slider();
mySlider->SetMinSize(300);
mySlider->SetMin(0);
mySlider->SetMax(100);
mySizerHori2->SubWidgetAdd(mySlider);
mySizerHori = new ewol::SizerHori();
@ -294,11 +455,6 @@ MainWindows::MainWindows(void)
(void)myMenu->Add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
*/
m_widgetLabelFileName = new ewol::Label("FileName");
m_widgetLabelFileName->SetExpendX(true);
m_widgetLabelFileName->SetFillY(true);
mySizerHori->SubWidgetAdd(m_widgetLabelFileName);
// Generic event ...
//RegisterMultiCast(ednMsgGuiSaveAs);
@ -324,7 +480,27 @@ const char *const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected";
void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
{
ewol::Windows::OnReceiveMessage(CallerObject, eventId, data);
if (eventId == l_applEventPlay) {
generator::PlaySample();
} else if (eventId == l_applEventBlit) {
generator::GenerateBasicBlipSelect();
} else if (eventId == l_applEventJump) {
generator::GenerateBasicJump();
} else if (eventId == l_applEventHit) {
generator::GenerateBasicHitHurt();
} else if (eventId == l_applEventPowerUp) {
generator::GenerateBasicPowerUp();
} else if (eventId == l_applEventExplosion) {
generator::GenerateBasicExplosion();
} else if (eventId == l_applEventLaser) {
generator::GenerateBasicLaserShoot();
} else if (eventId == l_applEventPick) {
generator::GenerateBasicPickUpCoin();
} else if (eventId == l_applEventRandom) {
generator::GenerateBasicRandom();
} else if (eventId == l_applEventMutant) {
generator::GenerateBasicMutate();
}
return;
}

View File

@ -34,7 +34,6 @@ class MainWindows : public ewol::Windows
{
private:
int32_t m_currentSavingAsIdBuffer;
ewol::Label* m_widgetLabelFileName;
public:
// Constructeur
MainWindows(void);

View File

@ -343,7 +343,7 @@ void ResetSample(bool restart)
}
}
void PlaySample()
void generator::PlaySample(void)
{
ResetSample(false);
playing_sample=true;
@ -534,24 +534,24 @@ void SynthSample(int length, float* buffer, FILE* file)
//lets use SDL in stead
static void SDLAudioCallback(int16_t *stream, int32_t len)
void generator::GenerateAudio(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{
if (playing_sample) {
float fbuf[len];
memset(fbuf, 0, sizeof(int32_t));
SynthSample(len, fbuf, NULL);
while (len--) {
float f = fbuf[len];
float fbuf[nbSample];
memset(fbuf, 0, sizeof(float));
SynthSample(nbSample, fbuf, NULL);
while (nbSample--) {
float f = fbuf[nbSample];
if (f < -1.0) {
f = -1.0;
}
if (f > 1.0) {
f = 1.0;
}
stream[len] = (int16_t)(f * 32767);
for (int32_t iii=0; iii<nbChannels; iii++) {
bufferInterlace[nbSample*nbChannels+iii] = (int16_t)(f * 32767);
}
}
} else {
memset(stream, 0, len*sizeof(int16_t));
}
}
@ -594,7 +594,7 @@ bool ExportWAV(char* filename)
file_sampleswritten=0;
filesample=0.0f;
fileacc=0;
PlaySample();
generator::PlaySample();
while(playing_sample) {
SynthSample(256, NULL, foutput);
}
@ -615,7 +615,7 @@ bool ExportWAV(char* filename)
// pickup/coin
void GenerateBasicPickUpCoin(void)
void generator::GenerateBasicPickUpCoin(void)
{
ResetParams();
p_base_freq=0.4f+frnd(0.5f);
@ -631,7 +631,7 @@ void GenerateBasicPickUpCoin(void)
}
void GenerateBasicLaserShoot(void)
void generator::GenerateBasicLaserShoot(void)
{
ResetParams();
wave_type=rnd(2);
@ -673,7 +673,7 @@ void GenerateBasicLaserShoot(void)
}
void GenerateBasicExplosion(void)
void generator::GenerateBasicExplosion(void)
{
ResetParams();
wave_type=3;
@ -711,7 +711,7 @@ void GenerateBasicExplosion(void)
}
void GenerateBasicPowerUp(void)
void generator::GenerateBasicPowerUp(void)
{
ResetParams();
if(rnd(1)) {
@ -738,7 +738,7 @@ void GenerateBasicPowerUp(void)
}
void GenerateBasicHitHurt(void)
void generator::GenerateBasicHitHurt(void)
{
ResetParams();
wave_type=rnd(2);
@ -760,7 +760,7 @@ void GenerateBasicHitHurt(void)
}
void GenerateBasicJump(void)
void generator::GenerateBasicJump(void)
{
ResetParams();
wave_type=0;
@ -780,7 +780,7 @@ void GenerateBasicJump(void)
}
void GenerateBasicBlipSelect(void)
void generator::GenerateBasicBlipSelect(void)
{
ResetParams();
wave_type=rnd(1);
@ -795,7 +795,7 @@ void GenerateBasicBlipSelect(void)
PlaySample();
}
void GenerateBasicRandom(void)
void generator::GenerateBasicRandom(void)
{
p_base_freq=pow(frnd(2.0f)-1.0f, 2.0f);
if(rnd(1)) {
@ -840,7 +840,7 @@ void GenerateBasicRandom(void)
}
void GenerateBasicMutate(void)
void generator::GenerateBasicMutate(void)
{
if(rnd(1)) p_base_freq+=frnd(0.1f)-0.05f;
// if(rnd(1)) p_freq_limit+=frnd(0.1f)-0.05f;
@ -868,3 +868,312 @@ void GenerateBasicMutate(void)
PlaySample();
}
void generator::SetWaveType(int32_t newVal)
{
wave_type = newVal;
}
int32_t generator::GetWaveType(void)
{
return wave_type;
}
void generator::SetBaseFreq(float newVal)
{
p_base_freq = newVal;
}
float generator::GetBaseFreq(void)
{
return p_base_freq;
}
void generator::SetFreqLimit(float newVal)
{
p_freq_limit = newVal;
}
float generator::GetFreqLimit(void)
{
return p_freq_limit;
}
void generator::SetFreqRamp(float newVal)
{
p_freq_ramp = newVal;
}
float generator::GetFreqRamp(void)
{
return p_freq_ramp;
}
void generator::SetFreqDRamp(float newVal)
{
p_freq_dramp = newVal;
}
float generator::GetFreqDRamp(void)
{
return p_freq_dramp;
}
void generator::SetDuty(float newVal)
{
p_duty = newVal;
}
float generator::GetDuty(void)
{
return p_duty;
}
void generator::SetDutyRamp(float newVal)
{
p_duty_ramp = newVal;
}
float generator::GetDutyRamp(void)
{
return p_duty_ramp;
}
void generator::SetVibStrength(float newVal)
{
p_vib_strength = newVal;
}
float generator::GetVibStrength(void)
{
return p_vib_strength;
}
void generator::SetVibSpeed(float newVal)
{
p_vib_speed = newVal;
}
float generator::GetVibSpeed(void)
{
return p_vib_speed;
}
void generator::SetVibDelay(float newVal)
{
p_vib_delay = newVal;
}
float generator::GetVibDelay(void)
{
return p_vib_delay;
}
void generator::SetEnvAttack(float newVal)
{
p_env_attack = newVal;
}
float generator::GetEnvAttack(void)
{
return p_env_attack;
}
void generator::SetEnvSustain(float newVal)
{
p_env_sustain = newVal;
}
float generator::GetEnvSustain(void)
{
return p_env_sustain;
}
void generator::SetEnvDecay(float newVal)
{
p_env_decay = newVal;
}
float generator::GetEnvDecay(void)
{
return p_env_decay;
}
void generator::SetEnvPunch(float newVal)
{
p_env_punch = newVal;
}
float generator::GetEnvPunch(void)
{
return p_env_punch;
}
void generator::SetFilterOn(bool newVal)
{
filter_on = newVal;
}
bool generator::GetFilterOn(void)
{
return filter_on;
}
void generator::SetLPFResonance(float newVal)
{
p_lpf_resonance = newVal;
}
float generator::GetLPFResonance(void)
{
return p_lpf_resonance;
}
void generator::SetLPFFreq(float newVal)
{
p_lpf_freq = newVal;
}
float generator::GetLPFFreq(void)
{
return p_lpf_freq;
}
void generator::SetLPFRamp(float newVal)
{
p_lpf_ramp = newVal;
}
float generator::GetLPFRamp(void)
{
return p_lpf_ramp;
}
void generator::SetHPFFreq(float newVal)
{
p_hpf_freq = newVal;
}
float generator::GetHPFFreq(void)
{
return p_hpf_freq;
}
void generator::SetHPFRamp(float newVal)
{
p_hpf_ramp = newVal;
}
float generator::GetHPFRamp(void)
{
return p_hpf_ramp;
}
void generator::SetPhaseOffset(float newVal)
{
p_pha_offset = newVal;
}
float generator::GetPhaseOffset(void)
{
return p_pha_offset;
}
void generator::SetPhaseRamp(float newVal)
{
p_pha_ramp = newVal;
}
float generator::GetPhaseRamp(void)
{
return p_pha_ramp;
}
void generator::SetRepeatSpeed(float newVal)
{
p_repeat_speed = newVal;
}
float generator::GetRepeatSpeed(void)
{
return p_repeat_speed;
}
void generator::SetArpSpeed(float newVal)
{
p_arp_speed = newVal;
}
float generator::GetArpSpeed(void)
{
return p_arp_speed;
}
void generator::SetArpMod(float newVal)
{
p_arp_mod = newVal;
}
float generator::GetArpMod(void)
{
return p_arp_mod;
}
void generator::SetMasterVolume(float newVal)
{
master_vol = newVal;
}
float generator::GetMasterVolume(void)
{
return master_vol;
}
void generator::SetSoundVolume(float newVal)
{
sound_vol = newVal;
}
float generator::GetSoundVolume(void)
{
return sound_vol;
}

View File

@ -27,6 +27,72 @@
#define __GENERATOR_H__
namespace generator {
void PlaySample(void);
void GenerateAudio(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
void GenerateBasicPickUpCoin(void);
void GenerateBasicLaserShoot(void);
void GenerateBasicExplosion(void);
void GenerateBasicPowerUp(void);
void GenerateBasicHitHurt(void);
void GenerateBasicJump(void);
void GenerateBasicBlipSelect(void);
void GenerateBasicRandom(void);
void GenerateBasicMutate(void);
void SetWaveType(int32_t newVal);
int32_t GetWaveType(void);
void SetBaseFreq(float newVal);
float GetBaseFreq(void);
void SetFreqLimit(float newVal);
float GetFreqLimit(void);
void SetFreqRamp(float newVal);
float GetFreqRamp(void);
void SetFreqDRamp(float newVal);
float GetFreqDRamp(void);
void SetDuty(float newVal);
float GetDuty(void);
void SetDutyRamp(float newVal);
float GetDutyRamp(void);
void SetVibStrength(float newVal);
float GetVibStrength(void);
void SetVibSpeed(float newVal);
float GetVibSpeed(void);
void SetVibDelay(float newVal);
float GetVibDelay(void);
void SetEnvAttack(float newVal);
float GetEnvAttack(void);
void SetEnvSustain(float newVal);
float GetEnvSustain(void);
void SetEnvDecay(float newVal);
float GetEnvDecay(void);
void SetEnvPunch(float newVal);
float GetEnvPunch(void);
void SetFilterOn(bool newVal);
bool GetFilterOn(void);
void SetLPFResonance(float newVal);
float GetLPFResonance(void);
void SetLPFFreq(float newVal);
float GetLPFFreq(void);
void SetLPFRamp(float newVal);
float GetLPFRamp(void);
void SetHPFFreq(float newVal);
float GetHPFFreq(void);
void SetHPFRamp(float newVal);
float GetHPFRamp(void);
void SetPhaseOffset(float newVal);
float GetPhaseOffset(void);
void SetPhaseRamp(float newVal);
float GetPhaseRamp(void);
void SetRepeatSpeed(float newVal);
float GetRepeatSpeed(void);
void SetArpSpeed(float newVal);
float GetArpSpeed(void);
void SetArpMod(float newVal);
float GetArpMod(void);
void SetMasterVolume(float newVal);
float GetMasterVolume(void);
void SetSoundVolume(float newVal);
float GetSoundVolume(void);
};

View File

@ -34,6 +34,8 @@
#include <Gui/MainWindows.h>
#include <unistd.h>
#include <globalMsg.h>
#include <ewol/Audio/audio.h>
#include <appl/generator.h>
MainWindows * basicWindows = NULL;
@ -76,7 +78,11 @@ void APP_Init(void)
}
// create the specific windows
ewol::DisplayWindows(basicWindows);
// set basic random sound
generator::GenerateBasicRandom();
// initialize output audio :
ewol::audio::Init();
ewol::audio::AddCallbackOutput(&generator::GenerateAudio);
// add files
APPL_INFO("show list of files : ");