Cog/Frameworks/OpenMPT/OpenMPT/soundlib/modsmp_ctrl.h
Christopher Snowhill 731e52c440 Build libOpenMPT from source once again
Bundle libOpenMPT as a dynamic framework, which should be safe once
again, now that there is only one version to bundle. Also, now it is
using the versions of libvorbisfile and libmpg123 that are bundled with
the player, instead of compiling minimp3 and stbvorbis.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-30 22:57:30 -07:00

75 lines
2 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
{
// Replaces sample in 'smp' with given sample and frees the old sample.
void ReplaceSample(ModSample &smp, void *pNewSample, const SmpLength newLength, CSoundFile &sndFile);
// Propagate loop point changes to player
bool UpdateLoopPoints(const ModSample &smp, CSoundFile &sndFile);
// 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