Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TSOP_INCLUDED
Toshihiro Shimizu 890ddd
#define TSOP_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tsound.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TSOUND_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//===================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI TSopException final : public TException {
Shinya Kitaoka 120a6e
  TString m_message;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TSopException(const TString &s) : m_message(s) {}
Shinya Kitaoka 120a6e
  ~TSopException() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TString getMessage() const override { return m_message; };
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//===================================================================
Toshihiro Shimizu 890ddd
//! \include sop_ex.cpp
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace TSop {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Convert the soundtrack src to the format of the soundtrack dst
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI void convert(TSoundTrackP &dst, const TSoundTrackP &src);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Convert the soundtrack src to the format specified in dstFormat
Toshihiro Shimizu 890ddd
    and return the new soundtrack
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI TSoundTrackP convert(const TSoundTrackP &src,
Shinya Kitaoka 120a6e
                           const TSoundTrackFormat &dstFormat);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Shinya Kitaoka 120a6e
    Resampls the soundtrack src at the specified sampleRate and
Toshihiro Shimizu 890ddd
    returns the obtained soundtrack
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI TSoundTrackP resample(TSoundTrackP src, TINT32 sampleRate);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Shinya Kitaoka 120a6e
    Reverbs the soundtrack src with the specified feature and
Toshihiro Shimizu 890ddd
    returns the obtained soundtrack
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI TSoundTrackP reverb(TSoundTrackP src, double delayTime,
Shinya Kitaoka 120a6e
                          double decayFactor, double extendTime);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Shinya Kitaoka 120a6e
    Gates the soundtrack src with the specified feature and
Toshihiro Shimizu 890ddd
    returns the obtained soundtrack
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI TSoundTrackP gate(TSoundTrackP src, double threshold, double holdTime,
Shinya Kitaoka 120a6e
                        double releaseTime);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Does the echo effect to the soundtrack src with the specified feature
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI void echo(TSoundTrackP &dst, const TSoundTrackP &src, double delayTime,
Shinya Kitaoka 120a6e
                double decayFactor, double extendTime);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Shinya Kitaoka 120a6e
    Streches the soundtrack src with the specified feature and
Toshihiro Shimizu 890ddd
    returns the obtained soundtrack
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI TSoundTrackP timeStrech(TSoundTrackP src, double ratio);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Do the mixing between the two soundtrack a1 and a2 must be inside [0.0,1.0]
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI TSoundTrackP mix(const TSoundTrackP &st1, const TSoundTrackP &st2,
Shinya Kitaoka 120a6e
                       double a1, double a2);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Inserts l blank samples starting from the sample s0 of the soundtrack.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI TSoundTrackP insertBlank(TSoundTrackP src, TINT32 s0, TINT32 l);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
/*!
Toshihiro Shimizu 890ddd
    Inserts a blank portion of duration l into the soundtrack, starting from t0.
Toshihiro Shimizu 890ddd
    t0 and l are expressed in seconds.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI TSoundTrackP insertBlank(TSoundTrackP src, double t0, double l);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Removes from the soundtrack the samples in the range [s0, s1].
Toshihiro Shimizu 890ddd
    Returns a soundtrack that contains just the samples that have been removed
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI TSoundTrackP remove(TSoundTrackP src, TINT32 s0, TINT32 s1,
Shinya Kitaoka 120a6e
                          TSoundTrackP &paste);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Shinya Kitaoka 120a6e
    Remove the portion of soundtrack in the range [t0, t1].
Toshihiro Shimizu 890ddd
    t0 and t1 are expressed in seconds.
Toshihiro Shimizu 890ddd
    Returns a soundtrack that contains just the portion that has been removed.
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI TSoundTrackP remove(TSoundTrackP src, double t0, double t1,
Shinya Kitaoka 120a6e
                          TSoundTrackP &paste);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Returns a soundtrack that has just the riseFactor of sample of src.
Toshihiro Shimizu 890ddd
    The samples of the output soundTrack come from the "zero" sample to
Toshihiro Shimizu 890ddd
    the value of the first sample of src
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI TSoundTrackP fadeIn(const TSoundTrackP src, double riseFactor);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Returns a soundtrack that has just the decayFactor of sample of src.
Toshihiro Shimizu 890ddd
    The samples of the output soundTrack come from the value of the last sample
Shinya Kitaoka 120a6e
    of src to the "zero" sample
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
DVAPI TSoundTrackP fadeOut(const TSoundTrackP src, double decayFactor);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Returns a soundtrack that has just the crossFactor of sample of src2.
Toshihiro Shimizu 890ddd
    The samples of the output soundTrack come from the value of the last sample
Shinya Kitaoka 120a6e
    of src1 to the value of the first sample of src2
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI TSoundTrackP crossFade(const TSoundTrackP src1, const TSoundTrackP src2,
Shinya Kitaoka 120a6e
                             double crossFactor);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
    Returns a soundtrack that has the sampleCount of src2.
Toshihiro Shimizu 890ddd
    But the first crossFactor of samples come from the value of the last sample
Shinya Kitaoka 120a6e
    of src1 to the value of the crossFactor-th sample of src2
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
DVAPI TSoundTrackP crossFade(double crossFactor, const TSoundTrackP src1,
Shinya Kitaoka 120a6e
                             const TSoundTrackP src2);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif