Skip to content

Commit

Permalink
Remove VolumeLUT; SoundMacro mixing appears to be linear
Browse files Browse the repository at this point in the history
  • Loading branch information
jackoalan committed Jan 11, 2017
1 parent 2836e73 commit ecd990e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 65,557 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ set(SOURCES
lib/SongConverter.cpp
lib/SongState.cpp
lib/Voice.cpp
lib/VolumeLUT.c
lib/Submix.cpp
lib/Studio.cpp
lib/EffectReverb.cpp
Expand Down
4 changes: 1 addition & 3 deletions lib/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,10 @@ std::shared_ptr<Sequencer> Engine::seqPlay(int groupId, int songId, const unsign
return {};
}

extern "C" const float VolumeLUT[];

/** Set total volume of engine */
void Engine::setVolume(float vol)
{
m_backend.setVolume(VolumeLUT[int(clamp(0.f, vol, 1.f) * 65536)] * 1.46245869f);
m_backend.setVolume(vol);
}

/** Find voice from VoiceId */
Expand Down
4 changes: 1 addition & 3 deletions lib/Voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace amuse
{
extern "C" const float VolumeLUT[];

void Voice::_destroy()
{
Expand Down Expand Up @@ -193,8 +192,7 @@ std::list<std::shared_ptr<Voice>>::iterator Voice::_destroyVoice(std::list<std::
template <typename T>
static T ApplyVolume(float vol, T samp)
{
/* -10dB to 0dB mapped to full volume range */
return samp * VolumeLUT[int(vol * 65536)];
return samp * 0.5f * vol;
}

void Voice::_procSamplePre(int16_t& samp)
Expand Down

0 comments on commit ecd990e

Please sign in to comment.