Cog/Frameworks/OpenMPT/OpenMPT/soundlib/modsmp_ctrl.h
Christopher Snowhill bc8538cdd4 Updated libOpenMPT to version 0.8.0
And reordered all the source files in the projects according to name
sort. And removed all the deleted files, including some which were
forgotten in previous updates, but left as 0 byte files. Finally,
updated the project to use C23 / C++23 language standards.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-06-06 00:54:33 -07:00

69 lines
1.7 KiB
C++

/*
* modsmp_ctrl.h
* -------------
* Purpose: Basic sample editing code
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "openmpt/all/BuildSettings.hpp"
#include "Snd_defs.h"
OPENMPT_NAMESPACE_BEGIN
class CSoundFile;
struct ModSample;
struct ModChannel;
namespace ctrlSmp
{
// Reverse sample data
bool ReverseSample(ModSample &smp, SmpLength start, SmpLength end, CSoundFile &sndFile);
// Invert sample data (flip by 180 degrees)
bool InvertSample(ModSample &smp, SmpLength start, SmpLength end, CSoundFile &sndFile);
// Crossfade sample data to create smooth loops
bool XFadeSample(ModSample &smp, SmpLength fadeLength, int fadeLaw, bool afterloopFade, bool useSustainLoop, CSoundFile &sndFile);
enum StereoToMonoMode
{
mixChannels,
onlyLeft,
onlyRight,
splitSample,
};
// Convert a sample with any number of channels to mono
bool ConvertToMono(ModSample &smp, CSoundFile &sndFile, StereoToMonoMode conversionMode);
// Converts a stereo sample into two mono samples. Source sample will not be deleted.
// Either of the two target samples may be identical to the source sample.
bool SplitStereo(const ModSample &source, ModSample &left, ModSample &right, CSoundFile &sndFile);
// Convert a mono sample to stereo
bool ConvertToStereo(ModSample &smp, CSoundFile &sndFile);
} // Namespace ctrlSmp
namespace ctrlChn
{
// Replaces sample from sound channels by given sample.
void ReplaceSample( CSoundFile &sndFile,
const ModSample &sample,
const void * const pNewSample,
const SmpLength newLength,
FlagSet<ChannelFlags> setFlags,
FlagSet<ChannelFlags> resetFlags);
} // namespace ctrlChn
OPENMPT_NAMESPACE_END