neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
audio_primitives.hpp File Reference
#include <neogfx/neogfx.hpp>
#include <array>
#include <bit>

Go to the source code of this file.

Classes

struct  neogfx::audio_data_format
 
struct  neogfx::adsr_envelope
 

Namespaces

namespace  neogfx
 

Typedefs

typedef std::uint64_t neogfx::audio_sample_rate
 
typedef std::uint64_t neogfx::audio_sample_index
 
typedef std::uint64_t neogfx::audio_sample_count
 
typedef std::uint64_t neogfx::audio_frame_index
 
typedef std::uint64_t neogfx::audio_frame_count
 
template<typename SampleType , std::size_t Channels>
using neogfx::audio_frame = std::array< SampleType, Channels >
 

Enumerations

enum class  neogfx::note : std::uint32_t {
  neogfx::MIDI0 = 0 , neogfx::MIDI1 = 1 , neogfx::MIDI2 = 2 , neogfx::MIDI3 = 3 ,
  neogfx::MIDI4 = 4 , neogfx::MIDI5 = 5 , neogfx::MIDI6 = 6 , neogfx::MIDI7 = 7 ,
  neogfx::MIDI8 = 8 , neogfx::MIDI9 = 9 , neogfx::MIDI10 = 10 , neogfx::MIDI11 = 11 ,
  neogfx::MIDI12 = 12 , neogfx::MIDI13 = 13 , neogfx::MIDI14 = 14 , neogfx::MIDI15 = 15 ,
  neogfx::MIDI16 = 16 , neogfx::MIDI17 = 17 , neogfx::MIDI18 = 18 , neogfx::MIDI19 = 19 ,
  neogfx::MIDI20 = 20 , neogfx::A0 = 21 , neogfx::Bb0 = 22 , neogfx::B0 = 23 ,
  neogfx::C1 = 24 , neogfx::Db1 = 25 , neogfx::D1 = 26 , neogfx::Eb1 = 27 ,
  neogfx::E1 = 28 , neogfx::F1 = 29 , neogfx::Gb1 = 30 , neogfx::G1 = 31 ,
  neogfx::Ab1 = 32 , neogfx::A1 = 33 , neogfx::Bb1 = 34 , neogfx::B1 = 35 ,
  neogfx::C2 = 36 , neogfx::Db2 = 37 , neogfx::D2 = 38 , neogfx::Eb2 = 39 ,
  neogfx::E2 = 40 , neogfx::F2 = 41 , neogfx::Gb2 = 42 , neogfx::G2 = 43 ,
  neogfx::Ab2 = 44 , neogfx::A2 = 45 , neogfx::Bb2 = 46 , neogfx::B2 = 47 ,
  neogfx::C3 = 48 , neogfx::Db3 = 49 , neogfx::D3 = 50 , neogfx::Eb3 = 51 ,
  neogfx::E3 = 52 , neogfx::F3 = 53 , neogfx::Gb3 = 54 , neogfx::G3 = 55 ,
  neogfx::Ab3 = 56 , neogfx::A3 = 57 , neogfx::Bb3 = 58 , neogfx::B3 = 59 ,
  neogfx::C4 = 60 , neogfx::Db4 = 61 , neogfx::D4 = 62 , neogfx::Eb4 = 63 ,
  neogfx::E4 = 64 , neogfx::F4 = 65 , neogfx::Gb4 = 66 , neogfx::G4 = 67 ,
  neogfx::Ab4 = 68 , neogfx::A4 = 69 , neogfx::Bb4 = 70 , neogfx::B4 = 71 ,
  neogfx::C5 = 72 , neogfx::Db5 = 73 , neogfx::D5 = 74 , neogfx::Eb5 = 75 ,
  neogfx::E5 = 76 , neogfx::F5 = 77 , neogfx::Gb5 = 78 , neogfx::G5 = 79 ,
  neogfx::Ab5 = 80 , neogfx::A5 = 81 , neogfx::Bb5 = 82 , neogfx::B5 = 83 ,
  neogfx::C6 = 84 , neogfx::Db6 = 85 , neogfx::D6 = 86 , neogfx::Eb6 = 87 ,
  neogfx::E6 = 88 , neogfx::F6 = 89 , neogfx::Gb6 = 90 , neogfx::G6 = 91 ,
  neogfx::Ab6 = 92 , neogfx::A6 = 93 , neogfx::Bb6 = 94 , neogfx::B6 = 95 ,
  neogfx::C7 = 96 , neogfx::Db7 = 97 , neogfx::D7 = 98 , neogfx::Eb7 = 99 ,
  neogfx::E7 = 100 , neogfx::F7 = 101 , neogfx::Gb7 = 102 , neogfx::G7 = 103 ,
  neogfx::Ab7 = 104 , neogfx::A7 = 105 , neogfx::Bb7 = 106 , neogfx::B7 = 107 ,
  neogfx::C8 = 108 , neogfx::Db8 = 109 , neogfx::D8 = 110 , neogfx::Eb8 = 111 ,
  neogfx::E8 = 112 , neogfx::F8 = 113 , neogfx::Gb8 = 114 , neogfx::G8 = 115 ,
  neogfx::Ab8 = 116 , neogfx::A8 = 117 , neogfx::Bb8 = 118 , neogfx::B8 = 119 ,
  neogfx::C9 = 120 , neogfx::Db9 = 121 , neogfx::D9 = 122 , neogfx::Eb9 = 123 ,
  neogfx::E9 = 124 , neogfx::F9 = 125 , neogfx::Gb9 = 126 , neogfx::G9 = 127 ,
  neogfx::Ab9 = 128
}
 
enum class  neogfx::instrument : std::uint32_t {
  neogfx::PureTone = 0 , neogfx::AcousticGrandPiano = 1 , neogfx::BrightAcousticPiano = 2 , neogfx::ElectricGrandPiano = 3 ,
  neogfx::HonkytonkPiano = 4 , neogfx::ElectricPiano1 = 5 , neogfx::ElectricPiano2 = 6 , neogfx::Harpsichord = 7 ,
  neogfx::Clavi = 8 , neogfx::Celesta = 9 , neogfx::Glockenspiel = 10 , neogfx::MusicBox = 11 ,
  neogfx::Vibraphone = 12 , neogfx::Marimba = 13 , neogfx::Xylophone = 14 , neogfx::TubularBells = 15 ,
  neogfx::Dulcimer = 16 , neogfx::DrawbarOrgan = 17 , neogfx::PercussiveOrgan = 18 , neogfx::RockOrgan = 19 ,
  neogfx::ChurchOrgan = 20 , neogfx::ReedOrgan = 21 , neogfx::Accordion = 22 , neogfx::Harmonica = 23 ,
  neogfx::TangoAccordion = 24 , neogfx::AcousticGuitarNylon = 25 , neogfx::AcousticGuitarSteel = 26 , neogfx::ElectricGuitarJazz = 27 ,
  neogfx::ElectricGuitarClean = 28 , neogfx::ElectricGuitarMuted = 29 , neogfx::OverdrivenGuitar = 30 , neogfx::DistortionGuitar = 31 ,
  neogfx::Guitarharmonics = 32 , neogfx::AcousticBass = 33 , neogfx::ElectricBassFinger = 34 , neogfx::ElectricBassPick = 35 ,
  neogfx::FretlessBass = 36 , neogfx::SlapBass1 = 37 , neogfx::SlapBass2 = 38 , neogfx::SynthBass1 = 39 ,
  neogfx::SynthBass2 = 40 , neogfx::Violin = 41 , neogfx::Viola = 42 , neogfx::Cello = 43 ,
  neogfx::Contrabass = 44 , neogfx::TremoloStrings = 45 , neogfx::PizzicatoStrings = 46 , neogfx::OrchestralHarp = 47 ,
  neogfx::Timpani = 48 , neogfx::StringEnsemble1 = 49 , neogfx::StringEnsemble2 = 50 , neogfx::SynthStrings1 = 51 ,
  neogfx::SynthStrings2 = 52 , neogfx::ChoirAahs = 53 , neogfx::VoiceOohs = 54 , neogfx::SynthVoice = 55 ,
  neogfx::OrchestraHit = 56 , neogfx::Trumpet = 57 , neogfx::Trombone = 58 , neogfx::Tuba = 59 ,
  neogfx::MutedTrumpet = 60 , neogfx::FrenchHorn = 61 , neogfx::BrassSection = 62 , neogfx::SynthBrass1 = 63 ,
  neogfx::SynthBrass2 = 64 , neogfx::SopranoSax = 65 , neogfx::AltoSax = 66 , neogfx::TenorSax = 67 ,
  neogfx::BaritoneSax = 68 , neogfx::Oboe = 69 , neogfx::EnglishHorn = 70 , neogfx::Bassoon = 71 ,
  neogfx::Clarinet = 72 , neogfx::Piccolo = 73 , neogfx::Flute = 74 , neogfx::Recorder = 75 ,
  neogfx::PanFlute = 76 , neogfx::BlownBottle = 77 , neogfx::Shakuhachi = 78 , neogfx::Whistle = 79 ,
  neogfx::Ocarina = 80 , neogfx::Lead1 = 81 , neogfx::Lead2 = 82 , neogfx::Lead3 = 83 ,
  neogfx::Lead4 = 84 , neogfx::Lead5 = 85 , neogfx::Lead6 = 86 , neogfx::Lead7 = 87 ,
  neogfx::Lead8 = 88 , neogfx::Pad1 = 89 , neogfx::Pad2 = 90 , neogfx::Pad3 = 91 ,
  neogfx::Pad4 = 92 , neogfx::Pad5 = 93 , neogfx::Pad6 = 94 , neogfx::Pad7 = 95 ,
  neogfx::Pad8 = 96 , neogfx::FX1 = 97 , neogfx::FX2 = 98 , neogfx::FX3 = 99 ,
  neogfx::FX4 = 100 , neogfx::FX5 = 101 , neogfx::FX6 = 102 , neogfx::FX7 = 103 ,
  neogfx::FX8 = 104 , neogfx::Sitar = 105 , neogfx::Banjo = 106 , neogfx::Shamisen = 107 ,
  neogfx::Koto = 108 , neogfx::Kalimba = 109 , neogfx::Bagpipe = 110 , neogfx::Fiddle = 111 ,
  neogfx::Shanai = 112 , neogfx::TinkleBell = 113 , neogfx::Agogo = 114 , neogfx::SteelDrums = 115 ,
  neogfx::Woodblock = 116 , neogfx::TaikoDrum = 117 , neogfx::MelodicTom = 118 , neogfx::SynthDrum = 119 ,
  neogfx::ReverseCymbal = 120 , neogfx::GuitarFretNoise = 121 , neogfx::BreathNoise = 122 , neogfx::Seashore = 123 ,
  neogfx::BirdTweet = 124 , neogfx::TelephoneRing = 125 , neogfx::Helicopter = 126 , neogfx::Applause = 127 ,
  neogfx::Gunshot = 128
}
 
enum class  neogfx::percussion_instrument {
  neogfx::AcousticBassDrum = 35 , neogfx::BassDrum1 = 36 , neogfx::SideStick = 37 , neogfx::AcousticSnare = 38 ,
  neogfx::HandClap = 39 , neogfx::ElectricSnare = 40 , neogfx::LowFloorTom = 41 , neogfx::ClosedHiHat = 42 ,
  neogfx::HighFloorTom = 43 , neogfx::PedalHiHat = 44 , neogfx::LowTom = 45 , neogfx::OpenHiHat = 46 ,
  neogfx::LowMidTom = 47 , neogfx::HiMidTom = 48 , neogfx::CrashCymbal1 = 49 , neogfx::HighTom = 50 ,
  neogfx::RideCymbal1 = 51 , neogfx::ChineseCymbal = 52 , neogfx::RideBell = 53 , neogfx::Tambourine = 54 ,
  neogfx::SplashCymbal = 55 , neogfx::Cowbell = 56 , neogfx::CrashCymbal2 = 57 , neogfx::Vibraslap = 58 ,
  neogfx::RideCymbal2 = 59 , neogfx::HiBongo = 60 , neogfx::LowBongo = 61 , neogfx::MuteHiConga = 62 ,
  neogfx::OpenHiConga = 63 , neogfx::LowConga = 64 , neogfx::HighTimbale = 65 , neogfx::LowTimbale = 66 ,
  neogfx::HighAgogo = 67 , neogfx::LowAgogo = 68 , neogfx::Cabasa = 69 , neogfx::Maracas = 70 ,
  neogfx::ShortWhistle = 71 , neogfx::LongWhistle = 72 , neogfx::ShortGuiro = 73 , neogfx::LongGuiro = 74 ,
  neogfx::Claves = 75 , neogfx::HiWoodBlock = 76 , neogfx::LowWoodBlock = 77 , neogfx::MuteCuica = 78 ,
  neogfx::OpenCuica = 79 , neogfx::MuteTriangle = 80 , neogfx::OpenTriangle = 81
}
 
enum class  neogfx::audio_channel : std::uint64_t {
  neogfx::None = 0x0000000000000000ULL , neogfx::Mono = 0x0000000000000001ULL , neogfx::FrontLeft = 0x0000000000000002ULL , neogfx::FrontRight = 0x0000000000000004ULL ,
  neogfx::FrontCenter = 0x0000000000000008ULL , neogfx::Lfe = 0x0000000000000010ULL , neogfx::BackLeft = 0x0000000000000020ULL , neogfx::BackRight = 0x0000000000000040ULL ,
  neogfx::FrontLeftCenter = 0x0000000000000080ULL , neogfx::FrontRightCenter = 0x0000000000000100ULL , neogfx::BackCenter = 0x0000000000000200ULL , neogfx::SideLeft = 0x0000000000000400ULL ,
  neogfx::SideRight = 0x0000000000000800ULL , neogfx::TopCenter = 0x0000000000001000ULL , neogfx::TopFrontLeft = 0x0000000000002000ULL , neogfx::TopFrontCenter = 0x0000000000004000ULL ,
  neogfx::TopFrontRight = 0x0000000000008000ULL , neogfx::TopBackLeft = 0x0000000000010000ULL , neogfx::TopBackCenter = 0x0000000000020000ULL , neogfx::TopBackRight = 0x0000000000040000ULL ,
  neogfx::Aux0 = 0x0000000000080000ULL , neogfx::Aux1 = 0x0000000000100000ULL , neogfx::Aux2 = 0x0000000000200000ULL , neogfx::Aux3 = 0x0000000000400000ULL ,
  neogfx::Aux4 = 0x0000000000800000ULL , neogfx::Aux5 = 0x0000000001000000ULL , neogfx::Aux6 = 0x0000000002000000ULL , neogfx::Aux7 = 0x0000000004000000ULL ,
  neogfx::Aux8 = 0x0000000008000000ULL , neogfx::Aux9 = 0x0000000010000000ULL , neogfx::Aux10 = 0x0000000020000000ULL , neogfx::Aux11 = 0x0000000040000000ULL ,
  neogfx::Aux12 = 0x0000000080000000ULL , neogfx::Aux13 = 0x0000000100000000ULL , neogfx::Aux14 = 0x0000000200000000ULL , neogfx::Aux15 = 0x0000000400000000ULL ,
  neogfx::Aux16 = 0x0000000800000000ULL , neogfx::Aux17 = 0x0000001000000000ULL , neogfx::Aux18 = 0x0000002000000000ULL , neogfx::Aux19 = 0x0000004000000000ULL ,
  neogfx::Aux20 = 0x0000008000000000ULL , neogfx::Aux21 = 0x0000010000000000ULL , neogfx::Aux22 = 0x0000020000000000ULL , neogfx::Aux23 = 0x0000040000000000ULL ,
  neogfx::Aux24 = 0x0000080000000000ULL , neogfx::Aux25 = 0x0000100000000000ULL , neogfx::Aux26 = 0x0000200000000000ULL , neogfx::Aux27 = 0x0000400000000000ULL ,
  neogfx::Aux28 = 0x0000800000000000ULL , neogfx::Aux29 = 0x0001000000000000ULL , neogfx::Aux30 = 0x0002000000000000ULL , neogfx::Aux31 = 0x0004000000000000ULL ,
  neogfx::Left = FrontLeft , neogfx::Right = FrontRight
}
 
enum class  neogfx::audio_stream_format : std::uint32_t { neogfx::Unknown = 0 , neogfx::Pcm = 1 }
 
enum class  neogfx::audio_sample_format : std::uint32_t {
  neogfx::Unknown = 0 , neogfx::U8 = 1 , neogfx::S16 = 2 , neogfx::S24 = 3 ,
  neogfx::S32 = 4 , neogfx::F32 = 5
}
 
enum class  neogfx::audio_standard_sample_rate : std::uint64_t {
  neogfx::Rate48000 = 48000 , neogfx::Rate44100 = 44100 , neogfx::Rate32000 = 32000 , neogfx::Rate24000 = 24000 ,
  neogfx::Rate22050 = 22050 , neogfx::Rate88200 = 88200 , neogfx::Rate96000 = 96000 , neogfx::Rate176400 = 176400 ,
  neogfx::Rate192000 = 192000 , neogfx::Rate16000 = 16000 , neogfx::Rate11025 = 11250 , neogfx::Rate8000 = 8000 ,
  neogfx::Rate352800 = 352800 , neogfx::Rate384000 = 384000
}
 

Functions

std::string neogfx::to_string (note const &aNote)
 
note neogfx::string_to_note (std::string const &aNote)
 
float neogfx::frequency (neogfx::note note)
 
template<neogfx::note Note>
float neogfx::frequency ()
 
std::string neogfx::to_string (neogfx::instrument instrument)
 
std::string neogfx::to_string (neogfx::percussion_instrument instrument)
 
audio_channel neogfx::operator& (audio_channel lhs, audio_channel rhs)
 
audio_channel neogfx::operator| (audio_channel lhs, audio_channel rhs)
 
audio_channel neogfx::operator^ (audio_channel lhs, audio_channel rhs)
 
audio_channel neogfx::operator~ (audio_channel lhs)
 
std::uint64_t neogfx::channel_count (audio_channel channels)