stereo audio

This commit is contained in:
Issac332 2026-07-02 14:49:40 +03:00
parent 7afe723154
commit ec7ee84470
4 changed files with 21 additions and 5 deletions

View file

@ -149,7 +149,6 @@ class DynamicLight
@plr_light_table
end
def plr_light_table=(val)
puts "aboba"
@plr_light_table[0] = val&.[](0) || 0
@plr_light_table[1] = val&.[](1) || 0
@plr_light_table[2] = val&.[](2) || 1
@ -166,6 +165,5 @@ class DynamicLight
@plr_light_table[13] = val&.[](13) || 0
@plr_light_table[14] = val&.[](14) || 1
@plr_light_table[15] = val&.[](15) || 1
puts "aboba2"
end
end

View file

@ -26,6 +26,11 @@
#include <AL/alc.h>
#include <SDL3/SDL_audio.h>
#include "meow.h"
#ifndef AL_DIRECT_CHANNELS_SOFT
#define AL_DIRECT_CHANNELS_SOFT 0x1033
#endif
namespace AL{
#define DEF_AL_ID \
@ -90,6 +95,7 @@ namespace Source{
inline Source::ID gen(){
Source::ID id;
alGenSources(1, &id.al);
alSourcei(id.al, AL_DIRECT_CHANNELS_SOFT, AL_TRUE);
return id;
}

View file

@ -34,11 +34,17 @@ struct SDLSoundSource : ALDataSource{
ALenum alFormat;
ALsizei alFreq;
SDL_AudioSpec spec;
SDLSoundSource(SDL_IOStream &ops, const char *extension, uint32_t maxBufSize, bool looped)
: srcOps(ops),
looped(looped)
{
sample = Sound_NewSample(&srcOps, extension, 0, maxBufSize);
spec.format = SDL_AUDIO_S16LE;
spec.channels = 2;
spec.freq = 44100;
sample = Sound_NewSample(&srcOps, extension, &spec, maxBufSize);
if (!sample){
SDL_CloseIO(&ops);

View file

@ -174,12 +174,18 @@ void SoundEmitter::stop(){
struct SoundOpenHandler : FileSystem::OpenHandler{
SoundBuffer *buffer;
SDL_AudioSpec spec;
SoundOpenHandler()
: buffer(0)
{}
{
spec.format = SDL_AUDIO_S16LE;
spec.channels = 2;
spec.freq = 44100;
}
bool tryRead(SDL_IOStream* &ops, const char *ext){
Sound_Sample *sample = Sound_NewSample(ops, ext, 0, STREAM_BUF_SIZE);
Sound_Sample *sample = Sound_NewSample(ops, ext, &spec, STREAM_BUF_SIZE); // df;lkjdsfl;kjgt;sjhdlhljkk;ljhgds;ljkglk;jdsl;fjgg;lhkjdsgklhjsdhl;jkg
if (!sample){
SDL_CloseIO(ops);