initial driver entry point

This commit is contained in:
Jack Andersen 2016-05-08 21:22:58 -10:00
parent 6e692c7a89
commit 2b7dc66c2a
14 changed files with 182 additions and 61 deletions

View File

@ -57,3 +57,8 @@ add_library(amuse
${SOURCES}
${HEADERS}
${EXTRAS})
if(TARGET boo)
add_executable(amusetool driver/main.cpp)
target_link_libraries(amusetool amuse boo ${BOO_SYS_LIBS} logvisor)
endif()

29
driver/main.cpp Normal file
View File

@ -0,0 +1,29 @@
#include "amuse/amuse.hpp"
#include "amuse/BooBackend.hpp"
#include "boo/audiodev/IAudioVoiceEngine.hpp"
#include <thread>
int main(int argc, char* argv[])
{
std::unique_ptr<boo::IAudioVoiceEngine> voxEngine = boo::NewAudioVoiceEngine();
amuse::BooBackendVoiceAllocator booBackend(*voxEngine);
amuse::Engine engine(booBackend);
amuse::Voice* vox = engine.fxStart(1, 1.f, 0.f);
for (int f=0 ; f<500 ; ++f)
{
engine.pumpEngine();
std::this_thread::sleep_for(std::chrono::milliseconds(15));
}
vox->keyOff();
for (int f=0 ; f<120 ; ++f)
{
engine.pumpEngine();
std::this_thread::sleep_for(std::chrono::milliseconds(15));
}
return 0;
}

View File

@ -7,7 +7,8 @@ namespace amuse
{
/** Reverb effect with configurable reflection filtering and channel-crosstalk */
class EffectReverbHi : public EffectBase
template <typename T>
class EffectReverbHi : public EffectBase<T>
{
float m_coloration; /**< [0.0, 1.0] influences filter coefficients to define surface characteristics of a room */
float m_mix; /**< [0.0, 1.0] dry/wet mix factor of reverb effect */

View File

@ -7,7 +7,8 @@ namespace amuse
{
/** Reverb effect with configurable reflection filtering */
class EffectReverbStd : public EffectBase
template <typename T>
class EffectReverbStd : public EffectBase<T>
{
float m_coloration; /**< [0.0, 1.0] influences filter coefficients to define surface characteristics of a room */
float m_mix; /**< [0.0, 1.0] dry/wet mix factor of reverb effect */

View File

@ -187,8 +187,8 @@ class SoundMacroState
float m_lfoPeriods[2]; /**< time-periods for LFO1 and LFO2 */
/** Used to store LFO-reference parameters for compatible state systems */
struct LFOSel
/** Used to build a multi-component formula for overriding controllers */
struct Evaluator
{
enum class Combine : uint8_t
{
@ -202,7 +202,7 @@ class SoundMacroState
Var
};
/** Represents one term of the LFO formula assembled via *_SELECT commands */
/** Represents one term of the formula assembled via *_SELECT commands */
struct Component
{
uint8_t m_midiCtrl;
@ -215,32 +215,32 @@ class SoundMacroState
};
std::vector<Component> m_comps; /**< Components built up by the macro */
/** Combine additional component(s) to LFO calcuation */
/** Combine additional component(s) to formula */
void addComponent(uint8_t midiCtrl, float scale,
Combine combine, VarType varType);
/** Calculate current scaled LFO value */
/** Calculate value */
float evaluate(Voice& vox, const SoundMacroState& st);
/** Determine if this LFOSel is valid to use */
/** Determine if able to use */
operator bool() const {return m_comps.size() != 0;}
};
LFOSel m_volumeSel;
LFOSel m_panSel;
LFOSel m_pitchWheelSel;
LFOSel m_modWheelSel;
LFOSel m_pedalSel;
LFOSel m_portamentoSel;
LFOSel m_reverbSel;
LFOSel m_preAuxASel;
LFOSel m_preAuxBSel;
LFOSel m_auxAFxSel;
LFOSel m_auxBFxSel;
LFOSel m_postAuxB;
LFOSel m_spanSel;
LFOSel m_dopplerSel;
LFOSel m_tremoloSel;
Evaluator m_volumeSel;
Evaluator m_panSel;
Evaluator m_pitchWheelSel;
Evaluator m_modWheelSel;
Evaluator m_pedalSel;
Evaluator m_portamentoSel;
Evaluator m_reverbSel;
Evaluator m_preAuxASel;
Evaluator m_preAuxBSel;
Evaluator m_auxAFxSel;
Evaluator m_auxBFxSel;
Evaluator m_postAuxB;
Evaluator m_spanSel;
Evaluator m_dopplerSel;
Evaluator m_tremoloSel;
int32_t m_variables[256]; /**< 32-bit variables set with relevant commands */

View File

@ -1,10 +1,22 @@
#ifndef __AMUSE_AMUSE_HPP__
#define __AMUSE_AMUSE_HPP__
namespace amuse
{
}
#include "AudioGroup.hpp"
#include "AudioGroupData.hpp"
#include "AudioGroupPool.hpp"
#include "AudioGroupProject.hpp"
#include "AudioGroupSampleDirectory.hpp"
#include "EffectChorus.hpp"
#include "EffectDelay.hpp"
#include "EffectReverbStd.hpp"
#include "EffectReverbHi.hpp"
#include "Emitter.hpp"
#include "Engine.hpp"
#include "Envelope.hpp"
#include "Listener.hpp"
#include "Sequencer.hpp"
#include "SoundMacroState.hpp"
#include "Submix.hpp"
#include "Voice.hpp"
#endif // __AMUSE_AMUSE_HPP__

View File

@ -0,0 +1,10 @@
#include "amuse/AudioGroupProject.hpp"
namespace amuse
{
AudioGroupProject::AudioGroupProject(const unsigned char* data)
{
}
}

View File

@ -25,4 +25,8 @@ void AudioGroupSampleDirectory::ADPCMParms::swapBig()
m_coefs[i] = SBig(m_coefs[i]);
}
AudioGroupSampleDirectory::AudioGroupSampleDirectory(const unsigned char* data)
{
}
}

View File

@ -343,7 +343,7 @@ void EffectChorus<T>::applyEffect(T* audio, size_t frameCount, const ChannelMap&
}
}
audio = outBuf;
audio += bs * chanMap.m_channelCount;
remFrames -= bs;
size_t chanPitch = m_blockSamples * AMUSE_CHORUS_NUM_BLOCKS;

View File

@ -46,6 +46,9 @@ void EffectDelay<T>::_update()
template <typename T>
void EffectDelay<T>::applyEffect(T* audio, size_t frameCount, const ChannelMap& chanMap)
{
if (m_dirty)
_update();
for (size_t f=0 ; f<frameCount ;)
{
for (int c=0 ; c<chanMap.m_channelCount ; ++c)

View File

@ -9,4 +9,28 @@ Emitter::Emitter(Engine& engine, const AudioGroup& group, Voice& vox)
{
}
void Emitter::setPos(const Vector3f& pos)
{
}
void Emitter::setDir(const Vector3f& dir)
{
}
void Emitter::setMaxDist(float maxDist)
{
}
void Emitter::setMaxVol(float maxVol)
{
}
void Emitter::setMinVol(float minVol)
{
}
void Emitter::setFalloff(float falloff)
{
}
}

View File

@ -21,13 +21,13 @@ void SoundMacroState::Command::swapBig()
words[1] = SBig(words[1]);
}
void SoundMacroState::LFOSel::addComponent(uint8_t midiCtrl, float scale,
void SoundMacroState::Evaluator::addComponent(uint8_t midiCtrl, float scale,
Combine combine, VarType varType)
{
m_comps.push_back({midiCtrl, scale, combine, varType});
}
float SoundMacroState::LFOSel::evaluate(Voice& vox, const SoundMacroState& st)
float SoundMacroState::Evaluator::evaluate(Voice& vox, const SoundMacroState& st)
{
float value = 0.f;
@ -978,8 +978,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_volumeSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -988,8 +988,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_panSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -998,8 +998,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_pitchWheelSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1008,8 +1008,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_modWheelSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1018,8 +1018,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_pedalSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1028,8 +1028,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_portamentoSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1038,8 +1038,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_reverbSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1048,8 +1048,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_spanSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1058,8 +1058,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_dopplerSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1068,8 +1068,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_tremoloSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1078,8 +1078,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_preAuxASel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1088,8 +1088,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_preAuxBSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1098,8 +1098,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_postAuxB.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1108,8 +1108,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_auxAFxSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;
@ -1118,8 +1118,8 @@ bool SoundMacroState::advance(Voice& vox, float dt)
{
uint8_t ctrl = cmd.m_data[0];
int16_t perc = *reinterpret_cast<int16_t*>(&cmd.m_data[1]);
LFOSel::Combine combine = LFOSel::Combine(cmd.m_data[3]);
LFOSel::VarType vtype = LFOSel::VarType(cmd.m_data[4]);
Evaluator::Combine combine = Evaluator::Combine(cmd.m_data[3]);
Evaluator::VarType vtype = Evaluator::VarType(cmd.m_data[4]);
uint8_t fine = cmd.m_data[5];
m_auxBFxSel.addComponent(ctrl, (perc + fine / 100.f) / 100.f, combine, vtype);
break;

View File

@ -17,4 +17,20 @@ Submix::Submix(Engine& engine, Submix* smx)
m_submix->m_activeSubmixes.insert(this);
}
bool Submix::canApplyEffect() const
{
}
void Submix::applyEffect(int16_t* audio, const ChannelMap& chanMap, double sampleRate) const
{
}
void Submix::applyEffect(int32_t* audio, const ChannelMap& chanMap, double sampleRate) const
{
}
void Submix::applyEffect(float* audio, const ChannelMap& chanMap, double sampleRate) const
{
}
}

View File

@ -38,4 +38,20 @@ bool Voice::loadSoundMacro(ObjectId macroId, int macroStep, bool pushPc)
{
}
void Voice::keyOff()
{
}
void Voice::message(int32_t val)
{
}
void Voice::setVolume(float vol)
{
}
void Voice::setPanning(float pan)
{
}
}