stereo audio
This commit is contained in:
parent
7afe723154
commit
ec7ee84470
|
|
@ -149,7 +149,6 @@ class DynamicLight
|
||||||
@plr_light_table
|
@plr_light_table
|
||||||
end
|
end
|
||||||
def plr_light_table=(val)
|
def plr_light_table=(val)
|
||||||
puts "aboba"
|
|
||||||
@plr_light_table[0] = val&.[](0) || 0
|
@plr_light_table[0] = val&.[](0) || 0
|
||||||
@plr_light_table[1] = val&.[](1) || 0
|
@plr_light_table[1] = val&.[](1) || 0
|
||||||
@plr_light_table[2] = val&.[](2) || 1
|
@plr_light_table[2] = val&.[](2) || 1
|
||||||
|
|
@ -166,6 +165,5 @@ class DynamicLight
|
||||||
@plr_light_table[13] = val&.[](13) || 0
|
@plr_light_table[13] = val&.[](13) || 0
|
||||||
@plr_light_table[14] = val&.[](14) || 1
|
@plr_light_table[14] = val&.[](14) || 1
|
||||||
@plr_light_table[15] = val&.[](15) || 1
|
@plr_light_table[15] = val&.[](15) || 1
|
||||||
puts "aboba2"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -26,6 +26,11 @@
|
||||||
#include <AL/alc.h>
|
#include <AL/alc.h>
|
||||||
#include <SDL3/SDL_audio.h>
|
#include <SDL3/SDL_audio.h>
|
||||||
#include "meow.h"
|
#include "meow.h"
|
||||||
|
|
||||||
|
#ifndef AL_DIRECT_CHANNELS_SOFT
|
||||||
|
#define AL_DIRECT_CHANNELS_SOFT 0x1033
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace AL{
|
namespace AL{
|
||||||
|
|
||||||
#define DEF_AL_ID \
|
#define DEF_AL_ID \
|
||||||
|
|
@ -90,6 +95,7 @@ namespace Source{
|
||||||
inline Source::ID gen(){
|
inline Source::ID gen(){
|
||||||
Source::ID id;
|
Source::ID id;
|
||||||
alGenSources(1, &id.al);
|
alGenSources(1, &id.al);
|
||||||
|
alSourcei(id.al, AL_DIRECT_CHANNELS_SOFT, AL_TRUE);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,17 @@ struct SDLSoundSource : ALDataSource{
|
||||||
ALenum alFormat;
|
ALenum alFormat;
|
||||||
ALsizei alFreq;
|
ALsizei alFreq;
|
||||||
|
|
||||||
|
SDL_AudioSpec spec;
|
||||||
|
|
||||||
SDLSoundSource(SDL_IOStream &ops, const char *extension, uint32_t maxBufSize, bool looped)
|
SDLSoundSource(SDL_IOStream &ops, const char *extension, uint32_t maxBufSize, bool looped)
|
||||||
: srcOps(ops),
|
: srcOps(ops),
|
||||||
looped(looped)
|
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){
|
if (!sample){
|
||||||
SDL_CloseIO(&ops);
|
SDL_CloseIO(&ops);
|
||||||
|
|
|
||||||
|
|
@ -174,12 +174,18 @@ void SoundEmitter::stop(){
|
||||||
struct SoundOpenHandler : FileSystem::OpenHandler{
|
struct SoundOpenHandler : FileSystem::OpenHandler{
|
||||||
SoundBuffer *buffer;
|
SoundBuffer *buffer;
|
||||||
|
|
||||||
|
SDL_AudioSpec spec;
|
||||||
|
|
||||||
SoundOpenHandler()
|
SoundOpenHandler()
|
||||||
: buffer(0)
|
: buffer(0)
|
||||||
{}
|
{
|
||||||
|
spec.format = SDL_AUDIO_S16LE;
|
||||||
|
spec.channels = 2;
|
||||||
|
spec.freq = 44100;
|
||||||
|
}
|
||||||
|
|
||||||
bool tryRead(SDL_IOStream* &ops, const char *ext){
|
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){
|
if (!sample){
|
||||||
SDL_CloseIO(ops);
|
SDL_CloseIO(ops);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue