Cog/Frameworks/OpenMPT/OpenMPT/soundlib/modsmp_ctrl.h

76 lines
2 KiB
C
Raw Normal View History

2018-02-19 01:25:43 -03:00
/*
2019-01-23 23:16:37 -03:00
* modsmp_ctrl.h
2018-02-19 01:25:43 -03:00
* -------------
2020-09-22 01:54:24 -03:00
* Purpose: Basic sample editing code
2019-01-23 23:16:37 -03:00
* Notes : (currently none)
2018-02-19 01:25:43 -03:00
* 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"
2019-01-23 23:16:37 -03:00
2020-09-22 01:54:24 -03:00
#include "Snd_defs.h"
2018-02-19 01:25:43 -03:00
OPENMPT_NAMESPACE_BEGIN
2020-09-22 01:54:24 -03:00
2018-02-19 01:25:43 -03:00
class CSoundFile;
struct ModSample;
struct ModChannel;
namespace ctrlSmp
{
// Replaces sample in 'smp' with given sample and frees the old sample.
2019-01-23 23:16:37 -03:00
void ReplaceSample(ModSample &smp, void *pNewSample, const SmpLength newLength, CSoundFile &sndFile);
2018-02-19 01:25:43 -03:00
// 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);
2018-02-19 01:25:43 -03:00
// Invert sample data (flip by 180 degrees)
2019-01-23 23:16:37 -03:00
bool InvertSample(ModSample &smp, SmpLength start, SmpLength end, CSoundFile &sndFile);
2018-02-19 01:25:43 -03:00
// 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);
2021-03-14 18:55:49 -03:00
// 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);
2018-02-19 01:25:43 -03:00
// 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,
2019-01-23 23:16:37 -03:00
const SmpLength newLength,
2018-02-19 01:25:43 -03:00
FlagSet<ChannelFlags> setFlags,
FlagSet<ChannelFlags> resetFlags);
} // namespace ctrlChn
OPENMPT_NAMESPACE_END