Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio Not Working - MiniAudio NULL #58

Open
diogogomesaraujo opened this issue Jan 8, 2025 · 3 comments
Open

Audio Not Working - MiniAudio NULL #58

diogogomesaraujo opened this issue Jan 8, 2025 · 3 comments

Comments

@diogogomesaraujo
Copy link

I am trying to implement music playing in my game, the music is being loaded but miniaudio defaults to null and nothing plays INFO: AUDIO: Device initialized successfully
INFO: > Backend: miniaudio / Null
INFO: > Format: 32-bit IEEE Floating Point -> 32-bit IEEE Floating Point
INFO: > Channels: 2 -> 2
INFO: > Sample rate: 48000 -> 48000
INFO: > Periods size: 1440

@tjammer
Copy link
Owner

tjammer commented Jan 9, 2025

All of this is handled by raylib under the hood. I fear there is no real way to influence this. That said, you are not the only one experiencing this, there are issues in the repos of raylib and miniaudio itself as well, see raysan5/raylib#4376.

Do the examples work for you?

@diogogomesaraujo
Copy link
Author

The tutorial for the audio_music_stream.ml from your tutorials gives me this in the stdout:

INFO: AUDIO: Device initialized successfully
INFO: > Backend: miniaudio / Null
INFO: > Format: 32-bit IEEE Floating Point -> 32-bit IEEE Floating Point
INFO: > Channels: 2 -> 2
INFO: > Sample rate: 48000 -> 48000
INFO: > Periods size: 1440

I tried running the Raylib C examples and it compiles with this makefile just fine:

CC = clang

CFLAGS = -std=c99 -Wall -I/opt/homebrew/include

LDFLAGS = -L/opt/homebrew/lib -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lm

SRCS = audio.c

OBJS = $(SRCS:.c=.o)

TARGET = audio

all: $(TARGET)

$(TARGET): $(OBJS)
$(CC) $(OBJS) -o $(TARGET) $(LDFLAGS)

%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

clean:
rm -f $(OBJS) $(TARGET)

INFO: AUDIO: Device initialized successfully
INFO: > Backend: miniaudio | Core Audio
INFO: > Format: 32-bit IEEE Floating Point -> 32-bit IEEE Floating Point
INFO: > Channels: 2 -> 2
INFO: > Sample rate: 48000 -> 48000
INFO: > Periods size: 1440

I am assuming it is because of the flags i passed but I don't know how to do that in OCaml version.

@tjammer
Copy link
Owner

tjammer commented Jan 11, 2025

That's interesting. We link almost the same set of libraries for the raylib build, as can be seen in configure.ml. The only difference is we additionally link CoreAudio, which you don't in your example. Ironically, that's the backend which gets picked up.

If you compiled the raylib C examples from upstream (which I assume) then there's the other difference that upstream raylib is well past 5.5 on master, while the OCaml bindings are still at 5.0. Although there were no major changes to the miniaudio dependency between those versions.

Could you try removing the CoreAudio link flag from configure.ml and build the bindings from source, then try the example again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants