void GetNewChannelState(const Cell& src, GlissData& gliss, DAC::ChannelDataBuilder& builder) { if (src.HasData()) { builder.SetLevelInPercents(100); } if (const bool* enabled = src.GetEnabled()) { builder.SetEnabled(*enabled); if (!*enabled) { builder.SetPosInSample(0); } } if (const uint_t* note = src.GetNote()) { builder.SetNote(*note); } if (const uint_t* sample = src.GetSample()) { builder.SetSampleNum(*sample); builder.SetPosInSample(0); builder.SetFreqSlideHz(0); gliss.Sliding = 0; } if (const uint_t* volume = src.GetVolume()) { const uint_t level = *volume; builder.SetLevelInPercents(100 * level / 16); } for (CommandsIterator it = src.GetCommands(); it; ++it) { switch (it->Type) { case GLISS: gliss.Glissade = it->Param1; break; default: assert(!"Invalid command"); } } }
void SynthesizeChannelsData(DAC::TrackBuilder& track) { for (uint_t chan = 0; chan != CHANNELS_COUNT; ++chan) { VolumeState& vol = Volumes[chan]; if (vol.Update()) { DAC::ChannelDataBuilder builder = track.GetChannel(chan); builder.SetLevelInPercents(100 * vol.Value / 16); } } }
void GetNewChannelState(const Cell& src, VolumeState& vol, DAC::ChannelDataBuilder& builder) { if (const bool* enabled = src.GetEnabled()) { builder.SetEnabled(*enabled); if (!*enabled) { builder.SetPosInSample(0); } } if (const uint_t* note = src.GetNote()) { builder.SetNote(*note); builder.SetPosInSample(0); } if (const uint_t* sample = src.GetSample()) { builder.SetSampleNum(*sample); builder.SetPosInSample(0); } if (const uint_t* volume = src.GetVolume()) { vol.Value = *volume; builder.SetLevelInPercents(100 * vol.Value / 16); } for (CommandsIterator it = src.GetCommands(); it; ++it) { switch (it->Type) { case VOLUME_SLIDE_PERIOD: vol.SlideCounter = vol.SlidePeriod = it->Param1; break; case VOLUME_SLIDE: vol.SlideDirection = it->Param1; break; default: assert(!"Invalid command"); } } }