1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00
audacity/src/Dither.h
Emily Mabrey 2f316d5bc4
Rename project in many places; Replace Most Project Logos; Refactor About Tenacity... Dialog (#276)
Add `locale/en.po` file.
Add English to `locale/LINGUAS` list.
Partially duplicate `msgid`s to `msgstr`s in English locale enable eventual key `msgid` changes
Replace former project name with Tenacity in English locale.
Replace former project website with Tenacity compatible usages in English locale.
Modify `AboutDialog.h` by renaming variables.
Modify `AboutDialog.cpp` by replacing usage of pre-fork name in Strings.
Modify AddBuildInfoRow methods to be static in About dialog.
Make License text const in About dialog.
Make pre-fork credits different in About dialog.
Begin adding Tenacity specific credits
Macros starting with `__` are reserved, so I removed the `__` on the About Dialog guard macro.
Remove `AboutDialog::` from usage of `Role` in `AboutDialog.h`
Refactor overly long generator method into separate methods in `AboutDialog.(h|cpp)`
Begin adding Tenacity developer information
Cleanup layout of `AboutDialog.h` and `AboutDialog.cpp`
Add `safedelete` macro to compliment odd `safenew` macro
Add `enum` to `ShuttleGui.cpp` to make it more clear what `Prop` method is doing.
Remove a ton of pointless and/or redunant `#ifdef` usage
Remove pointless singleton in AboutDialog
Make AboutDialog modal on MacOS
Fix reference type use of `auto` in `AudacityApp` b/c it makes unintentional copy.
Update XPM and PNG images using Tenacity assets
Update ICO images using Tenacity assets.
Fix Windows resource script that improperly used `winuser.h` import.
Add `*.aps` to gitignore to prevent IDE RC pre-load file from being committed.
Add default values for pre-processor constants in `tenacity.rc`.
Make changes needed for `Tenacity.exe` binary
Add 8x8 PNG to Windows ICO files
Replace project name in various CMake and CPack file.
Replace project name in various directory structures.
Replace project name in various OS-specific build files.
Replace project name in various documentation files.
Update the PO and POT files using the script.
Fix places where a `.desktop` file was used on Linux.
Replace title of project windows.
Make splash screen click through to `tenacityaudio.org`.
Remove ® from `AboutDialog.cpp`
Modify copyright message in `AboutDialog.cpp`

Signed-off-by: Emily Mabrey <emilymabrey93@gmail.com>
2021-07-20 19:46:29 -04:00

66 lines
1.7 KiB
C++

/**********************************************************************
Tenacity
Steve Harris
Markus Meyer
**********************************************************************/
#ifndef __AUDACITY_DITHER_H__
#define __AUDACITY_DITHER_H__
#include "tenacity/Types.h" // for samplePtr
template< typename Enum > class EnumSetting;
/// These ditherers are currently available:
enum DitherType : unsigned {
none = 0, rectangle = 1, triangle = 2, shaped = 3 };
class Dither
{
public:
static DitherType FastDitherChoice();
static DitherType BestDitherChoice();
static AUDACITY_DLL_API EnumSetting< DitherType > FastSetting, BestSetting;
/// Default constructor
Dither();
/// Reset state of the dither.
void Reset();
/// Apply the actual dithering. Expects the source sample in the
/// 'source' variable, the destination sample in the 'dest' variable,
/// and hints to the formats of the samples. Even if the sample formats
/// are the same, samples are clipped, if necessary.
void Apply(DitherType ditherType,
constSamplePtr source, sampleFormat sourceFormat,
samplePtr dest, sampleFormat destFormat,
unsigned int len,
unsigned int sourceStride = 1,
unsigned int destStride = 1);
private:
// Dither methods
float NoDither(float sample);
float RectangleDither(float sample);
float TriangleDither(float sample);
float ShapedDither(float sample);
// Dither constants
static const int BUF_SIZE; /* = 8 */
static const int BUF_MASK; /* = 7 */
static const float SHAPED_BS[];
// Dither state
int mPhase;
float mTriangleState;
float mBuffer[8 /* = BUF_SIZE */];
};
#endif /* __AUDACITY_DITHER_H__ */