Implemented environmental audio loading in maps. Added stb_vorbis header/cpp file for ogg format support. Converted track parts and sound effect to be ogg instead.
parent
cb86417a38
commit
725a858fab
@ -0,0 +1,99 @@ |
|||||||
|
#pragma region License |
||||||
|
/*
|
||||||
|
License (OLC-3) |
||||||
|
~~~~~~~~~~~~~~~ |
||||||
|
|
||||||
|
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com> |
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, |
||||||
|
are permitted provided that the following conditions are met: |
||||||
|
|
||||||
|
1. Redistributions or derivations of source code must retain the above copyright |
||||||
|
notice, this list of conditions and the following disclaimer. |
||||||
|
|
||||||
|
2. Redistributions or derivative works in binary form must reproduce the above |
||||||
|
copyright notice. This list of conditions and the following disclaimer must be |
||||||
|
reproduced in the documentation and/or other materials provided with the distribution. |
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors may |
||||||
|
be used to endorse or promote products derived from this software without specific |
||||||
|
prior written permission. |
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
||||||
|
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
||||||
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||||
|
SUCH DAMAGE. |
||||||
|
|
||||||
|
Portions of this software are copyright © 2023 The FreeType |
||||||
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information. |
||||||
|
All rights reserved. |
||||||
|
*/ |
||||||
|
#pragma endregion |
||||||
|
|
||||||
|
#include "EnvironmentalAudio.h" |
||||||
|
#include "Audio.h" |
||||||
|
#include "AdventuresInLestoria.h" |
||||||
|
|
||||||
|
INCLUDE_game |
||||||
|
INCLUDE_DATA |
||||||
|
|
||||||
|
float EnvironmentalAudio::ACTIVATION_RANGE; |
||||||
|
std::map<EnvironmentalAudioSoundName,EnvironmentalAudioData>EnvironmentalAudio::SOUND_DATA; |
||||||
|
|
||||||
|
void EnvironmentalAudio::Initialize(){ |
||||||
|
ACTIVATION_RANGE="Audio.Environmental Audio Activation Range"_F; |
||||||
|
for(auto&[key,size]:DATA["Environmental Audio"]){ |
||||||
|
SOUND_DATA[key].file=DATA["Environmental Audio"][key]["File"].GetString(); |
||||||
|
if(!std::filesystem::exists(operator""_SFX(SOUND_DATA[key].file.c_str(),SOUND_DATA[key].file.length())))ERR(std::format("WARNING! Could not load Environmental Audio {} due to missing file {} in {}",key,SOUND_DATA[key].file,"sfx_directory"_S)); |
||||||
|
SOUND_DATA[key].volume=DATA["Environmental Audio"][key]["Volume"].GetReal()/100.f; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
EnvironmentalAudio::EnvironmentalAudio() |
||||||
|
:audioName(""),pos({}){} |
||||||
|
EnvironmentalAudio::EnvironmentalAudio(const std::string_view audioName,const vf2d pos) |
||||||
|
:audioName(audioName),pos(pos){} |
||||||
|
void EnvironmentalAudio::SetPos(const vf2d&pos){ |
||||||
|
this->pos=pos; |
||||||
|
} |
||||||
|
void EnvironmentalAudio::SetAudioName(const std::string_view audioName){ |
||||||
|
this->audioName=audioName; |
||||||
|
} |
||||||
|
void EnvironmentalAudio::Activate(){ |
||||||
|
if(activated)return; |
||||||
|
soundInstance=Audio::LoadAndPlay(operator""_SFX(SOUND_DATA[audioName].file.c_str(),SOUND_DATA[audioName].file.length()),true); |
||||||
|
activated=true; |
||||||
|
} |
||||||
|
void EnvironmentalAudio::Deactivate(){ |
||||||
|
if(!activated)return; |
||||||
|
if(soundInstance!=std::numeric_limits<size_t>::max()){ |
||||||
|
Audio::Engine().UnloadSound(soundInstance); |
||||||
|
} |
||||||
|
soundInstance=std::numeric_limits<size_t>::max(); |
||||||
|
activated=false; |
||||||
|
} |
||||||
|
void EnvironmentalAudio::UpdateEnvironmentalAudio(){ |
||||||
|
for(const EnvironmentalAudio&aud:game->GetCurrentMap().environmentalAudioData){ |
||||||
|
EnvironmentalAudio&audio=const_cast<EnvironmentalAudio&>(aud); |
||||||
|
audio.Update(); |
||||||
|
} |
||||||
|
} |
||||||
|
void EnvironmentalAudio::Update(){ |
||||||
|
float distanceFromPlayer=geom2d::line<float>(game->GetPlayer()->GetPos(),pos).length(); |
||||||
|
if(distanceFromPlayer<ACTIVATION_RANGE)Activate(); |
||||||
|
if(distanceFromPlayer>ACTIVATION_RANGE){ |
||||||
|
Deactivate(); |
||||||
|
return; //Do not need to continue processing if the sound is not even going to be heard.
|
||||||
|
} |
||||||
|
float distRatio=1-distanceFromPlayer/ACTIVATION_RANGE; //0-1 where 1 is full volume.
|
||||||
|
float xDistRatio=(pos.x-game->GetPlayer()->GetX())/ACTIVATION_RANGE; //0-1 where 1 is full volume.
|
||||||
|
|
||||||
|
Audio::Engine().SetVolume(soundInstance,distRatio); |
||||||
|
Audio::Engine().SetPan(soundInstance,xDistRatio); |
||||||
|
} |
@ -0,0 +1,67 @@ |
|||||||
|
#pragma region License |
||||||
|
/*
|
||||||
|
License (OLC-3) |
||||||
|
~~~~~~~~~~~~~~~ |
||||||
|
|
||||||
|
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com> |
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, |
||||||
|
are permitted provided that the following conditions are met: |
||||||
|
|
||||||
|
1. Redistributions or derivations of source code must retain the above copyright |
||||||
|
notice, this list of conditions and the following disclaimer. |
||||||
|
|
||||||
|
2. Redistributions or derivative works in binary form must reproduce the above |
||||||
|
copyright notice. This list of conditions and the following disclaimer must be |
||||||
|
reproduced in the documentation and/or other materials provided with the distribution. |
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors may |
||||||
|
be used to endorse or promote products derived from this software without specific |
||||||
|
prior written permission. |
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
||||||
|
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
||||||
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||||
|
SUCH DAMAGE. |
||||||
|
|
||||||
|
Portions of this software are copyright © 2023 The FreeType |
||||||
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information. |
||||||
|
All rights reserved. |
||||||
|
*/ |
||||||
|
#pragma endregion |
||||||
|
#pragma once |
||||||
|
#include "olcPixelGameEngine.h" |
||||||
|
|
||||||
|
using EnvironmentalAudioSoundName=std::string; |
||||||
|
using FileName=std::string; |
||||||
|
|
||||||
|
struct EnvironmentalAudioData{ |
||||||
|
FileName file; |
||||||
|
float volume; //0.0f-1.0f
|
||||||
|
}; |
||||||
|
|
||||||
|
class EnvironmentalAudio{ |
||||||
|
friend class AiL; |
||||||
|
vf2d pos; |
||||||
|
std::string audioName; |
||||||
|
static float ACTIVATION_RANGE; |
||||||
|
bool activated=false; |
||||||
|
size_t soundInstance=std::numeric_limits<size_t>::max(); |
||||||
|
static std::map<EnvironmentalAudioSoundName,EnvironmentalAudioData>SOUND_DATA; |
||||||
|
public: |
||||||
|
static void Initialize(); |
||||||
|
EnvironmentalAudio(); |
||||||
|
EnvironmentalAudio(const std::string_view audioName,const vf2d pos); |
||||||
|
void SetPos(const vf2d&pos); |
||||||
|
void SetAudioName(const std::string_view audioName); |
||||||
|
void Activate(); |
||||||
|
void Deactivate(); |
||||||
|
static void UpdateEnvironmentalAudio(); |
||||||
|
void Update(); |
||||||
|
}; |
@ -0,0 +1,48 @@ |
|||||||
|
#pragma region License |
||||||
|
/*
|
||||||
|
License (OLC-3) |
||||||
|
~~~~~~~~~~~~~~~ |
||||||
|
|
||||||
|
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com> |
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, |
||||||
|
are permitted provided that the following conditions are met: |
||||||
|
|
||||||
|
1. Redistributions or derivations of source code must retain the above copyright |
||||||
|
notice, this list of conditions and the following disclaimer. |
||||||
|
|
||||||
|
2. Redistributions or derivative works in binary form must reproduce the above |
||||||
|
copyright notice. This list of conditions and the following disclaimer must be |
||||||
|
reproduced in the documentation and/or other materials provided with the distribution. |
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors may |
||||||
|
be used to endorse or promote products derived from this software without specific |
||||||
|
prior written permission. |
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
||||||
|
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
||||||
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||||
|
SUCH DAMAGE. |
||||||
|
|
||||||
|
Portions of this software are copyright © 2023 The FreeType |
||||||
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information. |
||||||
|
All rights reserved. |
||||||
|
*/ |
||||||
|
#pragma endregion |
||||||
|
#pragma once |
||||||
|
|
||||||
|
enum MapName{ |
||||||
|
CAMPAIGN_1_1, |
||||||
|
CAMPAIGN_1_2, |
||||||
|
CAMPAIGN_1_3, |
||||||
|
CAMPAIGN_1_4, |
||||||
|
CAMPAIGN_1_5, |
||||||
|
BOSS_1, |
||||||
|
WORLD_MAP |
||||||
|
}; |
@ -0,0 +1,4 @@ |
|||||||
|
Audio |
||||||
|
{ |
||||||
|
Environmental Audio Activation Range = 300 |
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
BGM |
||||||
|
{ |
||||||
|
Default Fade Time = 1.0 |
||||||
|
|
||||||
|
#Song title followed by filenames for individual parts |
||||||
|
foresty1_1 |
||||||
|
{ |
||||||
|
Track Name = Foresty |
||||||
|
|
||||||
|
channel[0]=foresty1_1_bass.ogg |
||||||
|
channel[1]=foresty1_1_crash.ogg |
||||||
|
channel[2]=foresty1_1_drums.ogg |
||||||
|
channel[3]=foresty1_1_flute.ogg |
||||||
|
channel[4]=foresty1_1_piano 1.ogg |
||||||
|
channel[5]=foresty1_1_piano 2.ogg |
||||||
|
channel[6]=foresty1_1_pizzicato.ogg |
||||||
|
channel[7]=foresty1_1_staccato.ogg |
||||||
|
channel[8]=foresty1_1_strings.ogg |
||||||
|
channel[9]=foresty1_1_xtra perc.ogg |
||||||
|
|
||||||
|
Default Volume = 70%,70%,70%,70%,70%,70%,70%,70%,70%,70% |
||||||
|
|
||||||
|
# Transition time between one phase to the next. |
||||||
|
Fade Time = 2.0 |
||||||
|
|
||||||
|
Events |
||||||
|
{ |
||||||
|
LowHealth = 100%,100%,100%,20%,20%,20%,100%,100%,20%,100% |
||||||
|
InCombat = 100%,100%,100%,100%,100%,100%,100%,100%,100%,100% |
||||||
|
Underwater = 10%,10%,10%,60%,80%,80%,10%,10%,70%,10% |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
Environmental Audio |
||||||
|
{ |
||||||
|
Waterfall |
||||||
|
{ |
||||||
|
File = sfx100v2_loop_water_01.ogg |
||||||
|
Volume = 100% |
||||||
|
} |
||||||
|
} |
@ -1,51 +0,0 @@ |
|||||||
BGM |
|
||||||
{ |
|
||||||
Default Fade Time = 1.0 |
|
||||||
|
|
||||||
#Song title followed by filenames for individual parts |
|
||||||
foresty1_1 |
|
||||||
{ |
|
||||||
Track Name = Foresty |
|
||||||
|
|
||||||
# High |
|
||||||
channel[0]=foresty1_1_1.mp3 |
|
||||||
# Low |
|
||||||
channel[1]=foresty1_1_2.mp3 |
|
||||||
|
|
||||||
# Underwater High |
|
||||||
channel[2]=foresty1_1_alt1.mp3 |
|
||||||
# Underwater Low |
|
||||||
channel[3]=foresty1_1_alt2.mp3 |
|
||||||
|
|
||||||
Default Volume = 70%,50%,0%,0% |
|
||||||
|
|
||||||
# Transition time between one phase to the next. |
|
||||||
Fade Time = 2.0 |
|
||||||
|
|
||||||
Events |
|
||||||
{ |
|
||||||
LowHealth = 50%,100%,20%,20% |
|
||||||
InCombat = 90%,100%,0%,0% |
|
||||||
Underwater = 0%,0%,100%,100% |
|
||||||
} |
|
||||||
} |
|
||||||
foresty0 |
|
||||||
{ |
|
||||||
Track Name = Foresty Preview |
|
||||||
|
|
||||||
channel[0]=foresty0.mp3 |
|
||||||
channel[1]=foresty0_alt.mp3 |
|
||||||
|
|
||||||
Default Volume = 70%,0% |
|
||||||
|
|
||||||
# Transition time between one phase to the next. |
|
||||||
Fade Time = 2.0 |
|
||||||
|
|
||||||
Events |
|
||||||
{ |
|
||||||
LowHealth = 50%,20% |
|
||||||
InCombat = 100%,0% |
|
||||||
Underwater = 0%,100% |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@ |
|||||||
ALLTOTAL=$(wc -l $(find *.cpp *.h)|grep "total"|awk '{print $1}') |
ALLTOTAL=$(wc -l $(find *.cpp *.h)|grep "total"|awk '{print $1}') |
||||||
|
|
||||||
TOTAL=$(wc -l $(find *.cpp *.h -not -name "miniaudio.h" -not -name "olc*.h")|grep "total"|awk '{print $1}') |
TOTAL=$(wc -l $(find *.cpp *.h -not -name "stb_vorbis.cpp" -not -name "stb_vorbis.h" -not -name "miniaudio.h" -not -name "olc*.h")|grep "total"|awk '{print $1}') |
||||||
FILECOUNT=$(find *.cpp *.h -not -name "miniaudio.h" -not -name "olc*.h"|wc -l) |
FILECOUNT=$(find *.cpp *.h -not -name "stb_vorbis.cpp" -not -name "stb_vorbis.h" -not -name "miniaudio.h" -not -name "olc*.h"|wc -l) |
||||||
echo "ALL: $[ALLTOTAL]" |
echo "ALL: $[ALLTOTAL]" |
||||||
echo "$[TOTAL-FILECOUNT*37] (License lines Excluded)" |
echo "$[TOTAL-FILECOUNT*37] (License lines Excluded)" |
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,520 @@ |
|||||||
|
// Ogg Vorbis audio decoder - v1.22 - public domain
|
||||||
|
// http://nothings.org/stb_vorbis/
|
||||||
|
//
|
||||||
|
// Original version written by Sean Barrett in 2007.
|
||||||
|
//
|
||||||
|
// Originally sponsored by RAD Game Tools. Seeking implementation
|
||||||
|
// sponsored by Phillip Bennefall, Marc Andersen, Aaron Baker,
|
||||||
|
// Elias Software, Aras Pranckevicius, and Sean Barrett.
|
||||||
|
//
|
||||||
|
// LICENSE
|
||||||
|
//
|
||||||
|
// See end of file for license information.
|
||||||
|
//
|
||||||
|
// Limitations:
|
||||||
|
//
|
||||||
|
// - floor 0 not supported (used in old ogg vorbis files pre-2004)
|
||||||
|
// - lossless sample-truncation at beginning ignored
|
||||||
|
// - cannot concatenate multiple vorbis streams
|
||||||
|
// - sample positions are 32-bit, limiting seekable 192Khz
|
||||||
|
// files to around 6 hours (Ogg supports 64-bit)
|
||||||
|
//
|
||||||
|
// Feature contributors:
|
||||||
|
// Dougall Johnson (sample-exact seeking)
|
||||||
|
//
|
||||||
|
// Bugfix/warning contributors:
|
||||||
|
// Terje Mathisen Niklas Frykholm Andy Hill
|
||||||
|
// Casey Muratori John Bolton Gargaj
|
||||||
|
// Laurent Gomila Marc LeBlanc Ronny Chevalier
|
||||||
|
// Bernhard Wodo Evan Balster github:alxprd
|
||||||
|
// Tom Beaumont Ingo Leitgeb Nicolas Guillemot
|
||||||
|
// Phillip Bennefall Rohit Thiago Goulart
|
||||||
|
// github:manxorist Saga Musix github:infatum
|
||||||
|
// Timur Gagiev Maxwell Koo Peter Waller
|
||||||
|
// github:audinowho Dougall Johnson David Reid
|
||||||
|
// github:Clownacy Pedro J. Estebanez Remi Verschelde
|
||||||
|
// AnthoFoxo github:morlat Gabriel Ravier
|
||||||
|
//
|
||||||
|
// Partial history:
|
||||||
|
// 1.22 - 2021-07-11 - various small fixes
|
||||||
|
// 1.21 - 2021-07-02 - fix bug for files with no comments
|
||||||
|
// 1.20 - 2020-07-11 - several small fixes
|
||||||
|
// 1.19 - 2020-02-05 - warnings
|
||||||
|
// 1.18 - 2020-02-02 - fix seek bugs; parse header comments; misc warnings etc.
|
||||||
|
// 1.17 - 2019-07-08 - fix CVE-2019-13217..CVE-2019-13223 (by ForAllSecure)
|
||||||
|
// 1.16 - 2019-03-04 - fix warnings
|
||||||
|
// 1.15 - 2019-02-07 - explicit failure if Ogg Skeleton data is found
|
||||||
|
// 1.14 - 2018-02-11 - delete bogus dealloca usage
|
||||||
|
// 1.13 - 2018-01-29 - fix truncation of last frame (hopefully)
|
||||||
|
// 1.12 - 2017-11-21 - limit residue begin/end to blocksize/2 to avoid large temp allocs in bad/corrupt files
|
||||||
|
// 1.11 - 2017-07-23 - fix MinGW compilation
|
||||||
|
// 1.10 - 2017-03-03 - more robust seeking; fix negative ilog(); clear error in open_memory
|
||||||
|
// 1.09 - 2016-04-04 - back out 'truncation of last frame' fix from previous version
|
||||||
|
// 1.08 - 2016-04-02 - warnings; setup memory leaks; truncation of last frame
|
||||||
|
// 1.07 - 2015-01-16 - fixes for crashes on invalid files; warning fixes; const
|
||||||
|
// 1.06 - 2015-08-31 - full, correct support for seeking API (Dougall Johnson)
|
||||||
|
// some crash fixes when out of memory or with corrupt files
|
||||||
|
// fix some inappropriately signed shifts
|
||||||
|
// 1.05 - 2015-04-19 - don't define __forceinline if it's redundant
|
||||||
|
// 1.04 - 2014-08-27 - fix missing const-correct case in API
|
||||||
|
// 1.03 - 2014-08-07 - warning fixes
|
||||||
|
// 1.02 - 2014-07-09 - declare qsort comparison as explicitly _cdecl in Windows
|
||||||
|
// 1.01 - 2014-06-18 - fix stb_vorbis_get_samples_float (interleaved was correct)
|
||||||
|
// 1.0 - 2014-05-26 - fix memory leaks; fix warnings; fix bugs in >2-channel;
|
||||||
|
// (API change) report sample rate for decode-full-file funcs
|
||||||
|
//
|
||||||
|
// See end of file for full version history.
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// HEADER BEGINS HERE
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef STB_VORBIS_INCLUDE_STB_VORBIS_H |
||||||
|
#define STB_VORBIS_INCLUDE_STB_VORBIS_H |
||||||
|
|
||||||
|
#if defined(STB_VORBIS_NO_CRT) && !defined(STB_VORBIS_NO_STDIO) |
||||||
|
#define STB_VORBIS_NO_STDIO 1 |
||||||
|
#endif |
||||||
|
|
||||||
|
#ifndef STB_VORBIS_NO_STDIO |
||||||
|
#include <stdio.h> |
||||||
|
#endif |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/////////// THREAD SAFETY
|
||||||
|
|
||||||
|
// Individual stb_vorbis* handles are not thread-safe; you cannot decode from
|
||||||
|
// them from multiple threads at the same time. However, you can have multiple
|
||||||
|
// stb_vorbis* handles and decode from them independently in multiple thrads.
|
||||||
|
|
||||||
|
|
||||||
|
/////////// MEMORY ALLOCATION
|
||||||
|
|
||||||
|
// normally stb_vorbis uses malloc() to allocate memory at startup,
|
||||||
|
// and alloca() to allocate temporary memory during a frame on the
|
||||||
|
// stack. (Memory consumption will depend on the amount of setup
|
||||||
|
// data in the file and how you set the compile flags for speed
|
||||||
|
// vs. size. In my test files the maximal-size usage is ~150KB.)
|
||||||
|
//
|
||||||
|
// You can modify the wrapper functions in the source (setup_malloc,
|
||||||
|
// setup_temp_malloc, temp_malloc) to change this behavior, or you
|
||||||
|
// can use a simpler allocation model: you pass in a buffer from
|
||||||
|
// which stb_vorbis will allocate _all_ its memory (including the
|
||||||
|
// temp memory). "open" may fail with a VORBIS_outofmem if you
|
||||||
|
// do not pass in enough data; there is no way to determine how
|
||||||
|
// much you do need except to succeed (at which point you can
|
||||||
|
// query get_info to find the exact amount required. yes I know
|
||||||
|
// this is lame).
|
||||||
|
//
|
||||||
|
// If you pass in a non-NULL buffer of the type below, allocation
|
||||||
|
// will occur from it as described above. Otherwise just pass NULL
|
||||||
|
// to use malloc()/alloca()
|
||||||
|
|
||||||
|
typedef struct |
||||||
|
{ |
||||||
|
char *alloc_buffer; |
||||||
|
int alloc_buffer_length_in_bytes; |
||||||
|
} stb_vorbis_alloc; |
||||||
|
|
||||||
|
|
||||||
|
/////////// FUNCTIONS USEABLE WITH ALL INPUT MODES
|
||||||
|
|
||||||
|
typedef struct stb_vorbis stb_vorbis; |
||||||
|
|
||||||
|
typedef struct |
||||||
|
{ |
||||||
|
unsigned int sample_rate; |
||||||
|
int channels; |
||||||
|
|
||||||
|
unsigned int setup_memory_required; |
||||||
|
unsigned int setup_temp_memory_required; |
||||||
|
unsigned int temp_memory_required; |
||||||
|
|
||||||
|
int max_frame_size; |
||||||
|
} stb_vorbis_info; |
||||||
|
|
||||||
|
typedef struct |
||||||
|
{ |
||||||
|
char *vendor; |
||||||
|
|
||||||
|
int comment_list_length; |
||||||
|
char **comment_list; |
||||||
|
} stb_vorbis_comment; |
||||||
|
|
||||||
|
// get general information about the file
|
||||||
|
extern stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f); |
||||||
|
|
||||||
|
// get ogg comments
|
||||||
|
extern stb_vorbis_comment stb_vorbis_get_comment(stb_vorbis *f); |
||||||
|
|
||||||
|
// get the last error detected (clears it, too)
|
||||||
|
extern int stb_vorbis_get_error(stb_vorbis *f); |
||||||
|
|
||||||
|
// close an ogg vorbis file and free all memory in use
|
||||||
|
extern void stb_vorbis_close(stb_vorbis *f); |
||||||
|
|
||||||
|
// this function returns the offset (in samples) from the beginning of the
|
||||||
|
// file that will be returned by the next decode, if it is known, or -1
|
||||||
|
// otherwise. after a flush_pushdata() call, this may take a while before
|
||||||
|
// it becomes valid again.
|
||||||
|
// NOT WORKING YET after a seek with PULLDATA API
|
||||||
|
extern int stb_vorbis_get_sample_offset(stb_vorbis *f); |
||||||
|
|
||||||
|
// returns the current seek point within the file, or offset from the beginning
|
||||||
|
// of the memory buffer. In pushdata mode it returns 0.
|
||||||
|
extern unsigned int stb_vorbis_get_file_offset(stb_vorbis *f); |
||||||
|
|
||||||
|
/////////// PUSHDATA API
|
||||||
|
|
||||||
|
#ifndef STB_VORBIS_NO_PUSHDATA_API |
||||||
|
|
||||||
|
// this API allows you to get blocks of data from any source and hand
|
||||||
|
// them to stb_vorbis. you have to buffer them; stb_vorbis will tell
|
||||||
|
// you how much it used, and you have to give it the rest next time;
|
||||||
|
// and stb_vorbis may not have enough data to work with and you will
|
||||||
|
// need to give it the same data again PLUS more. Note that the Vorbis
|
||||||
|
// specification does not bound the size of an individual frame.
|
||||||
|
|
||||||
|
extern stb_vorbis *stb_vorbis_open_pushdata( |
||||||
|
const unsigned char * datablock, int datablock_length_in_bytes, |
||||||
|
int *datablock_memory_consumed_in_bytes, |
||||||
|
int *error, |
||||||
|
const stb_vorbis_alloc *alloc_buffer); |
||||||
|
// create a vorbis decoder by passing in the initial data block containing
|
||||||
|
// the ogg&vorbis headers (you don't need to do parse them, just provide
|
||||||
|
// the first N bytes of the file--you're told if it's not enough, see below)
|
||||||
|
// on success, returns an stb_vorbis *, does not set error, returns the amount of
|
||||||
|
// data parsed/consumed on this call in *datablock_memory_consumed_in_bytes;
|
||||||
|
// on failure, returns NULL on error and sets *error, does not change *datablock_memory_consumed
|
||||||
|
// if returns NULL and *error is VORBIS_need_more_data, then the input block was
|
||||||
|
// incomplete and you need to pass in a larger block from the start of the file
|
||||||
|
|
||||||
|
extern int stb_vorbis_decode_frame_pushdata( |
||||||
|
stb_vorbis *f, |
||||||
|
const unsigned char *datablock, int datablock_length_in_bytes, |
||||||
|
int *channels, // place to write number of float * buffers
|
||||||
|
float ***output, // place to write float ** array of float * buffers
|
||||||
|
int *samples // place to write number of output samples
|
||||||
|
); |
||||||
|
// decode a frame of audio sample data if possible from the passed-in data block
|
||||||
|
//
|
||||||
|
// return value: number of bytes we used from datablock
|
||||||
|
//
|
||||||
|
// possible cases:
|
||||||
|
// 0 bytes used, 0 samples output (need more data)
|
||||||
|
// N bytes used, 0 samples output (resynching the stream, keep going)
|
||||||
|
// N bytes used, M samples output (one frame of data)
|
||||||
|
// note that after opening a file, you will ALWAYS get one N-bytes,0-sample
|
||||||
|
// frame, because Vorbis always "discards" the first frame.
|
||||||
|
//
|
||||||
|
// Note that on resynch, stb_vorbis will rarely consume all of the buffer,
|
||||||
|
// instead only datablock_length_in_bytes-3 or less. This is because it wants
|
||||||
|
// to avoid missing parts of a page header if they cross a datablock boundary,
|
||||||
|
// without writing state-machiney code to record a partial detection.
|
||||||
|
//
|
||||||
|
// The number of channels returned are stored in *channels (which can be
|
||||||
|
// NULL--it is always the same as the number of channels reported by
|
||||||
|
// get_info). *output will contain an array of float* buffers, one per
|
||||||
|
// channel. In other words, (*output)[0][0] contains the first sample from
|
||||||
|
// the first channel, and (*output)[1][0] contains the first sample from
|
||||||
|
// the second channel.
|
||||||
|
//
|
||||||
|
// *output points into stb_vorbis's internal output buffer storage; these
|
||||||
|
// buffers are owned by stb_vorbis and application code should not free
|
||||||
|
// them or modify their contents. They are transient and will be overwritten
|
||||||
|
// once you ask for more data to get decoded, so be sure to grab any data
|
||||||
|
// you need before then.
|
||||||
|
|
||||||
|
extern void stb_vorbis_flush_pushdata(stb_vorbis *f); |
||||||
|
// inform stb_vorbis that your next datablock will not be contiguous with
|
||||||
|
// previous ones (e.g. you've seeked in the data); future attempts to decode
|
||||||
|
// frames will cause stb_vorbis to resynchronize (as noted above), and
|
||||||
|
// once it sees a valid Ogg page (typically 4-8KB, as large as 64KB), it
|
||||||
|
// will begin decoding the _next_ frame.
|
||||||
|
//
|
||||||
|
// if you want to seek using pushdata, you need to seek in your file, then
|
||||||
|
// call stb_vorbis_flush_pushdata(), then start calling decoding, then once
|
||||||
|
// decoding is returning you data, call stb_vorbis_get_sample_offset, and
|
||||||
|
// if you don't like the result, seek your file again and repeat.
|
||||||
|
#endif |
||||||
|
|
||||||
|
|
||||||
|
////////// PULLING INPUT API
|
||||||
|
|
||||||
|
#ifndef STB_VORBIS_NO_PULLDATA_API |
||||||
|
// This API assumes stb_vorbis is allowed to pull data from a source--
|
||||||
|
// either a block of memory containing the _entire_ vorbis stream, or a
|
||||||
|
// FILE * that you or it create, or possibly some other reading mechanism
|
||||||
|
// if you go modify the source to replace the FILE * case with some kind
|
||||||
|
// of callback to your code. (But if you don't support seeking, you may
|
||||||
|
// just want to go ahead and use pushdata.)
|
||||||
|
|
||||||
|
#if !defined(STB_VORBIS_NO_STDIO) && !defined(STB_VORBIS_NO_INTEGER_CONVERSION) |
||||||
|
extern int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_rate, short **output); |
||||||
|
#endif |
||||||
|
#if !defined(STB_VORBIS_NO_INTEGER_CONVERSION) |
||||||
|
extern int stb_vorbis_decode_memory(const unsigned char *mem, int len, int *channels, int *sample_rate, short **output); |
||||||
|
#endif |
||||||
|
// decode an entire file and output the data interleaved into a malloc()ed
|
||||||
|
// buffer stored in *output. The return value is the number of samples
|
||||||
|
// decoded, or -1 if the file could not be opened or was not an ogg vorbis file.
|
||||||
|
// When you're done with it, just free() the pointer returned in *output.
|
||||||
|
|
||||||
|
extern stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, |
||||||
|
int *error, const stb_vorbis_alloc *alloc_buffer); |
||||||
|
// create an ogg vorbis decoder from an ogg vorbis stream in memory (note
|
||||||
|
// this must be the entire stream!). on failure, returns NULL and sets *error
|
||||||
|
|
||||||
|
#ifndef STB_VORBIS_NO_STDIO |
||||||
|
extern stb_vorbis * stb_vorbis_open_filename(const char *filename, |
||||||
|
int *error, const stb_vorbis_alloc *alloc_buffer); |
||||||
|
// create an ogg vorbis decoder from a filename via fopen(). on failure,
|
||||||
|
// returns NULL and sets *error (possibly to VORBIS_file_open_failure).
|
||||||
|
|
||||||
|
extern stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close, |
||||||
|
int *error, const stb_vorbis_alloc *alloc_buffer); |
||||||
|
// create an ogg vorbis decoder from an open FILE *, looking for a stream at
|
||||||
|
// the _current_ seek point (ftell). on failure, returns NULL and sets *error.
|
||||||
|
// note that stb_vorbis must "own" this stream; if you seek it in between
|
||||||
|
// calls to stb_vorbis, it will become confused. Moreover, if you attempt to
|
||||||
|
// perform stb_vorbis_seek_*() operations on this file, it will assume it
|
||||||
|
// owns the _entire_ rest of the file after the start point. Use the next
|
||||||
|
// function, stb_vorbis_open_file_section(), to limit it.
|
||||||
|
|
||||||
|
extern stb_vorbis * stb_vorbis_open_file_section(FILE *f, int close_handle_on_close, |
||||||
|
int *error, const stb_vorbis_alloc *alloc_buffer, unsigned int len); |
||||||
|
// create an ogg vorbis decoder from an open FILE *, looking for a stream at
|
||||||
|
// the _current_ seek point (ftell); the stream will be of length 'len' bytes.
|
||||||
|
// on failure, returns NULL and sets *error. note that stb_vorbis must "own"
|
||||||
|
// this stream; if you seek it in between calls to stb_vorbis, it will become
|
||||||
|
// confused.
|
||||||
|
#endif |
||||||
|
|
||||||
|
extern int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number); |
||||||
|
extern int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number); |
||||||
|
// these functions seek in the Vorbis file to (approximately) 'sample_number'.
|
||||||
|
// after calling seek_frame(), the next call to get_frame_*() will include
|
||||||
|
// the specified sample. after calling stb_vorbis_seek(), the next call to
|
||||||
|
// stb_vorbis_get_samples_* will start with the specified sample. If you
|
||||||
|
// do not need to seek to EXACTLY the target sample when using get_samples_*,
|
||||||
|
// you can also use seek_frame().
|
||||||
|
|
||||||
|
extern int stb_vorbis_seek_start(stb_vorbis *f); |
||||||
|
// this function is equivalent to stb_vorbis_seek(f,0)
|
||||||
|
|
||||||
|
extern unsigned int stb_vorbis_stream_length_in_samples(stb_vorbis *f); |
||||||
|
extern float stb_vorbis_stream_length_in_seconds(stb_vorbis *f); |
||||||
|
// these functions return the total length of the vorbis stream
|
||||||
|
|
||||||
|
extern int stb_vorbis_get_frame_float(stb_vorbis *f, int *channels, float ***output); |
||||||
|
// decode the next frame and return the number of samples. the number of
|
||||||
|
// channels returned are stored in *channels (which can be NULL--it is always
|
||||||
|
// the same as the number of channels reported by get_info). *output will
|
||||||
|
// contain an array of float* buffers, one per channel. These outputs will
|
||||||
|
// be overwritten on the next call to stb_vorbis_get_frame_*.
|
||||||
|
//
|
||||||
|
// You generally should not intermix calls to stb_vorbis_get_frame_*()
|
||||||
|
// and stb_vorbis_get_samples_*(), since the latter calls the former.
|
||||||
|
|
||||||
|
#ifndef STB_VORBIS_NO_INTEGER_CONVERSION |
||||||
|
extern int stb_vorbis_get_frame_short_interleaved(stb_vorbis *f, int num_c, short *buffer, int num_shorts); |
||||||
|
extern int stb_vorbis_get_frame_short (stb_vorbis *f, int num_c, short **buffer, int num_samples); |
||||||
|
#endif |
||||||
|
// decode the next frame and return the number of *samples* per channel.
|
||||||
|
// Note that for interleaved data, you pass in the number of shorts (the
|
||||||
|
// size of your array), but the return value is the number of samples per
|
||||||
|
// channel, not the total number of samples.
|
||||||
|
//
|
||||||
|
// The data is coerced to the number of channels you request according to the
|
||||||
|
// channel coercion rules (see below). You must pass in the size of your
|
||||||
|
// buffer(s) so that stb_vorbis will not overwrite the end of the buffer.
|
||||||
|
// The maximum buffer size needed can be gotten from get_info(); however,
|
||||||
|
// the Vorbis I specification implies an absolute maximum of 4096 samples
|
||||||
|
// per channel.
|
||||||
|
|
||||||
|
// Channel coercion rules:
|
||||||
|
// Let M be the number of channels requested, and N the number of channels present,
|
||||||
|
// and Cn be the nth channel; let stereo L be the sum of all L and center channels,
|
||||||
|
// and stereo R be the sum of all R and center channels (channel assignment from the
|
||||||
|
// vorbis spec).
|
||||||
|
// M N output
|
||||||
|
// 1 k sum(Ck) for all k
|
||||||
|
// 2 * stereo L, stereo R
|
||||||
|
// k l k > l, the first l channels, then 0s
|
||||||
|
// k l k <= l, the first k channels
|
||||||
|
// Note that this is not _good_ surround etc. mixing at all! It's just so
|
||||||
|
// you get something useful.
|
||||||
|
|
||||||
|
extern int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float *buffer, int num_floats); |
||||||
|
extern int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, int num_samples); |
||||||
|
// gets num_samples samples, not necessarily on a frame boundary--this requires
|
||||||
|
// buffering so you have to supply the buffers. DOES NOT APPLY THE COERCION RULES.
|
||||||
|
// Returns the number of samples stored per channel; it may be less than requested
|
||||||
|
// at the end of the file. If there are no more samples in the file, returns 0.
|
||||||
|
|
||||||
|
#ifndef STB_VORBIS_NO_INTEGER_CONVERSION |
||||||
|
extern int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short *buffer, int num_shorts); |
||||||
|
extern int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, int num_samples); |
||||||
|
#endif |
||||||
|
// gets num_samples samples, not necessarily on a frame boundary--this requires
|
||||||
|
// buffering so you have to supply the buffers. Applies the coercion rules above
|
||||||
|
// to produce 'channels' channels. Returns the number of samples stored per channel;
|
||||||
|
// it may be less than requested at the end of the file. If there are no more
|
||||||
|
// samples in the file, returns 0.
|
||||||
|
|
||||||
|
#endif |
||||||
|
|
||||||
|
//////// ERROR CODES
|
||||||
|
|
||||||
|
enum STBVorbisError |
||||||
|
{ |
||||||
|
VORBIS__no_error, |
||||||
|
|
||||||
|
VORBIS_need_more_data=1, // not a real error
|
||||||
|
|
||||||
|
VORBIS_invalid_api_mixing, // can't mix API modes
|
||||||
|
VORBIS_outofmem, // not enough memory
|
||||||
|
VORBIS_feature_not_supported, // uses floor 0
|
||||||
|
VORBIS_too_many_channels, // STB_VORBIS_MAX_CHANNELS is too small
|
||||||
|
VORBIS_file_open_failure, // fopen() failed
|
||||||
|
VORBIS_seek_without_length, // can't seek in unknown-length file
|
||||||
|
|
||||||
|
VORBIS_unexpected_eof=10, // file is truncated?
|
||||||
|
VORBIS_seek_invalid, // seek past EOF
|
||||||
|
|
||||||
|
// decoding errors (corrupt/invalid stream) -- you probably
|
||||||
|
// don't care about the exact details of these
|
||||||
|
|
||||||
|
// vorbis errors:
|
||||||
|
VORBIS_invalid_setup=20, |
||||||
|
VORBIS_invalid_stream, |
||||||
|
|
||||||
|
// ogg errors:
|
||||||
|
VORBIS_missing_capture_pattern=30, |
||||||
|
VORBIS_invalid_stream_structure_version, |
||||||
|
VORBIS_continued_packet_flag_invalid, |
||||||
|
VORBIS_incorrect_stream_serial_number, |
||||||
|
VORBIS_invalid_first_page, |
||||||
|
VORBIS_bad_packet_type, |
||||||
|
VORBIS_cant_find_last_page, |
||||||
|
VORBIS_seek_failed, |
||||||
|
VORBIS_ogg_skeleton_not_supported |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif // STB_VORBIS_INCLUDE_STB_VORBIS_H
|
||||||
|
//
|
||||||
|
// HEADER ENDS HERE
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
/* Version history
|
||||||
|
1.17 - 2019-07-08 - fix CVE-2019-13217, -13218, -13219, -13220, -13221, -13222, -13223 |
||||||
|
found with Mayhem by ForAllSecure |
||||||
|
1.16 - 2019-03-04 - fix warnings |
||||||
|
1.15 - 2019-02-07 - explicit failure if Ogg Skeleton data is found |
||||||
|
1.14 - 2018-02-11 - delete bogus dealloca usage |
||||||
|
1.13 - 2018-01-29 - fix truncation of last frame (hopefully) |
||||||
|
1.12 - 2017-11-21 - limit residue begin/end to blocksize/2 to avoid large temp allocs in bad/corrupt files |
||||||
|
1.11 - 2017-07-23 - fix MinGW compilation |
||||||
|
1.10 - 2017-03-03 - more robust seeking; fix negative ilog(); clear error in open_memory |
||||||
|
1.09 - 2016-04-04 - back out 'avoid discarding last frame' fix from previous version |
||||||
|
1.08 - 2016-04-02 - fixed multiple warnings; fix setup memory leaks; |
||||||
|
avoid discarding last frame of audio data |
||||||
|
1.07 - 2015-01-16 - fixed some warnings, fix mingw, const-correct API |
||||||
|
some more crash fixes when out of memory or with corrupt files |
||||||
|
1.06 - 2015-08-31 - full, correct support for seeking API (Dougall Johnson) |
||||||
|
some crash fixes when out of memory or with corrupt files |
||||||
|
1.05 - 2015-04-19 - don't define __forceinline if it's redundant |
||||||
|
1.04 - 2014-08-27 - fix missing const-correct case in API |
||||||
|
1.03 - 2014-08-07 - Warning fixes |
||||||
|
1.02 - 2014-07-09 - Declare qsort compare function _cdecl on windows |
||||||
|
1.01 - 2014-06-18 - fix stb_vorbis_get_samples_float |
||||||
|
1.0 - 2014-05-26 - fix memory leaks; fix warnings; fix bugs in multichannel |
||||||
|
(API change) report sample rate for decode-full-file funcs |
||||||
|
0.99996 - bracket #include <malloc.h> for macintosh compilation by Laurent Gomila |
||||||
|
0.99995 - use union instead of pointer-cast for fast-float-to-int to avoid alias-optimization problem |
||||||
|
0.99994 - change fast-float-to-int to work in single-precision FPU mode, remove endian-dependence |
||||||
|
0.99993 - remove assert that fired on legal files with empty tables |
||||||
|
0.99992 - rewind-to-start |
||||||
|
0.99991 - bugfix to stb_vorbis_get_samples_short by Bernhard Wodo |
||||||
|
0.9999 - (should have been 0.99990) fix no-CRT support, compiling as C++ |
||||||
|
0.9998 - add a full-decode function with a memory source |
||||||
|
0.9997 - fix a bug in the read-from-FILE case in 0.9996 addition |
||||||
|
0.9996 - query length of vorbis stream in samples/seconds |
||||||
|
0.9995 - bugfix to another optimization that only happened in certain files |
||||||
|
0.9994 - bugfix to one of the optimizations that caused significant (but inaudible?) errors |
||||||
|
0.9993 - performance improvements; runs in 99% to 104% of time of reference implementation |
||||||
|
0.9992 - performance improvement of IMDCT; now performs close to reference implementation |
||||||
|
0.9991 - performance improvement of IMDCT |
||||||
|
0.999 - (should have been 0.9990) performance improvement of IMDCT |
||||||
|
0.998 - no-CRT support from Casey Muratori |
||||||
|
0.997 - bugfixes for bugs found by Terje Mathisen |
||||||
|
0.996 - bugfix: fast-huffman decode initialized incorrectly for sparse codebooks; fixing gives 10% speedup - found by Terje Mathisen |
||||||
|
0.995 - bugfix: fix to 'effective' overrun detection - found by Terje Mathisen |
||||||
|
0.994 - bugfix: garbage decode on final VQ symbol of a non-multiple - found by Terje Mathisen |
||||||
|
0.993 - bugfix: pushdata API required 1 extra byte for empty page (failed to consume final page if empty) - found by Terje Mathisen |
||||||
|
0.992 - fixes for MinGW warning |
||||||
|
0.991 - turn fast-float-conversion on by default |
||||||
|
0.990 - fix push-mode seek recovery if you seek into the headers |
||||||
|
0.98b - fix to bad release of 0.98 |
||||||
|
0.98 - fix push-mode seek recovery; robustify float-to-int and support non-fast mode |
||||||
|
0.97 - builds under c++ (typecasting, don't use 'class' keyword) |
||||||
|
0.96 - somehow MY 0.95 was right, but the web one was wrong, so here's my 0.95 rereleased as 0.96, fixes a typo in the clamping code |
||||||
|
0.95 - clamping code for 16-bit functions |
||||||
|
0.94 - not publically released |
||||||
|
0.93 - fixed all-zero-floor case (was decoding garbage) |
||||||
|
0.92 - fixed a memory leak |
||||||
|
0.91 - conditional compiles to omit parts of the API and the infrastructure to support them: STB_VORBIS_NO_PULLDATA_API, STB_VORBIS_NO_PUSHDATA_API, STB_VORBIS_NO_STDIO, STB_VORBIS_NO_INTEGER_CONVERSION |
||||||
|
0.90 - first public release |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
------------------------------------------------------------------------------ |
||||||
|
This software is available under 2 licenses -- choose whichever you prefer. |
||||||
|
------------------------------------------------------------------------------ |
||||||
|
ALTERNATIVE A - MIT License |
||||||
|
Copyright (c) 2017 Sean Barrett |
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of |
||||||
|
this software and associated documentation files (the "Software"), to deal in |
||||||
|
the Software without restriction, including without limitation the rights to |
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do |
||||||
|
so, subject to the following conditions: |
||||||
|
The above copyright notice and this permission notice shall be included in all |
||||||
|
copies or substantial portions of the Software. |
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
SOFTWARE. |
||||||
|
------------------------------------------------------------------------------ |
||||||
|
ALTERNATIVE B - Public Domain (www.unlicense.org) |
||||||
|
This is free and unencumbered software released into the public domain. |
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this |
||||||
|
software, either in source code form or as a compiled binary, for any purpose, |
||||||
|
commercial or non-commercial, and by any means. |
||||||
|
In jurisdictions that recognize copyright laws, the author or authors of this |
||||||
|
software dedicate any and all copyright interest in the software to the public |
||||||
|
domain. We make this dedication for the benefit of the public at large and to |
||||||
|
the detriment of our heirs and successors. We intend this dedication to be an |
||||||
|
overt act of relinquishment in perpetuity of all present and future rights to |
||||||
|
this software under copyright law. |
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
||||||
|
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||||
|
------------------------------------------------------------------------------ |
||||||
|
*/ |
Loading…
Reference in new issue