mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- Backend update from GZDoom.
This commit is contained in:
parent
972df67d92
commit
5a580c145e
6 changed files with 11 additions and 16 deletions
|
@ -117,10 +117,11 @@ int MusicEnabled() // int return is for scripting
|
|||
static std::unique_ptr<SoundStream> musicStream;
|
||||
static TArray<SoundStream*> customStreams;
|
||||
|
||||
SoundStream *S_CreateCustomStream(size_t size, int samplerate, int numchannels, StreamCallback cb, void *userdata)
|
||||
SoundStream *S_CreateCustomStream(size_t size, int samplerate, int numchannels, MusicCustomStreamType sampletype, StreamCallback cb, void *userdata)
|
||||
{
|
||||
int flags = 0;
|
||||
if (numchannels < 2) flags |= SoundStream::Mono;
|
||||
if (sampletype == MusicSamplesFloat) flags |= SoundStream::Float;
|
||||
auto stream = GSnd->CreateStream(cb, int(size), flags, samplerate, userdata);
|
||||
if (stream)
|
||||
{
|
||||
|
|
|
@ -11,9 +11,13 @@ class FileReader;
|
|||
class SoundStream;
|
||||
|
||||
|
||||
enum MusicCustomStreamType : bool {
|
||||
MusicSamples16bit,
|
||||
MusicSamplesFloat
|
||||
};
|
||||
int MusicEnabled();
|
||||
typedef bool(*StreamCallback)(SoundStream* stream, void* buff, int len, void* userdata);
|
||||
SoundStream *S_CreateCustomStream(size_t size, int samplerate, int numchannels, StreamCallback cb, void *userdata);
|
||||
SoundStream *S_CreateCustomStream(size_t size, int samplerate, int numchannels, MusicCustomStreamType sampletype, StreamCallback cb, void *userdata);
|
||||
void S_StopCustomStream(SoundStream* stream);
|
||||
void S_PauseAllCustomStreams(bool on);
|
||||
|
||||
|
|
|
@ -618,7 +618,7 @@ public:
|
|||
if (adata.inf.bitsPerSample == 8) copy8bitSamples(read);
|
||||
else copy16bitSamples(read);
|
||||
if (!stream && read) // the sound may not start in the first frame, but the stream cannot start without any sound data present.
|
||||
stream = S_CreateCustomStream(6000, adata.inf.sampleRate, adata.inf.nChannels, StreamCallbackFunc, this);
|
||||
stream = S_CreateCustomStream(6000, adata.inf.sampleRate, adata.inf.nChannels, MusicSamples16bit, StreamCallbackFunc, this);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
|
|||
if (!bAudioStarted)
|
||||
{
|
||||
// start audio playback
|
||||
stream = S_CreateCustomStream(6000, audio.nSampleRate, audio.nChannels, StreamCallbackFunc, this);
|
||||
stream = S_CreateCustomStream(6000, audio.nSampleRate, audio.nChannels, MusicSamples16bit, StreamCallbackFunc, this);
|
||||
bAudioStarted = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ void VulkanSwapChain::CreateViews()
|
|||
|
||||
bool VulkanSwapChain::IsHdrModeActive() const
|
||||
{
|
||||
return swapChainFormat.colorSpace == VK_COLOR_SPACE_HDR10_ST2084_EXT || swapChainFormat.colorSpace == VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT;
|
||||
return swapChainFormat.colorSpace == VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT;
|
||||
}
|
||||
|
||||
void VulkanSwapChain::SelectFormat()
|
||||
|
@ -276,16 +276,6 @@ void VulkanSwapChain::SelectFormat()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// For older drivers that reported the wrong colorspace
|
||||
for (const auto &format : surfaceFormats)
|
||||
{
|
||||
if (format.format == VK_FORMAT_R16G16B16A16_SFLOAT && format.colorSpace == VK_COLOR_SPACE_HDR10_ST2084_EXT)
|
||||
{
|
||||
swapChainFormat = format;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &format : surfaceFormats)
|
||||
|
|
|
@ -205,7 +205,7 @@ public:
|
|||
audio.nWrite = 5; // play 5 blocks (i.e. half a second) of silence to get ahead of the stream. For this video it isn't necessary to sync it perfectly.
|
||||
|
||||
// start audio playback
|
||||
stream = S_CreateCustomStream(kSampleSize * 2, kSampleRate, 1, StreamCallbackFunc, this); // size must be doubled here or dropouts can be heard.
|
||||
stream = S_CreateCustomStream(kSampleSize * 2, kSampleRate, 1, MusicSamples16bit, StreamCallbackFunc, this); // size must be doubled here or dropouts can be heard.
|
||||
animtex.SetSize(AnimTexture::Paletted, 200, 320);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue