Closed winterheart closed 6 months ago
Awesome
Very cool, thoughts @sezero ?
Very cool, thoughts @sezero ?
I don't know. One thing that comes to my mind is why make OpenAL the default?? Don't like that one for sure. (OpenAL output was added with the sole purpose of supporting macOS the easy way. It isn't available everywhere by default.) As for the rest, needs review and testing.
Well, I locally did wget https://github.com/Mindwerks/wildmidi/pull/223.patch && git am 223.patch
and then did mkdir b && cd b && cmake -DCMAKE_BUILD_TYPE=Release -DWANT_STATIC=1 ..
:
-- The C compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Build Type: Release
-- Performing Test HAVE_VISIBILITY_DEFAULT
-- Performing Test HAVE_VISIBILITY_DEFAULT - Success
-- Performing Test HAVE_VISIBILITY_HIDDEN
-- Performing Test HAVE_VISIBILITY_HIDDEN - Success
-- Performing Test HAVE___BUILTIN_EXPECT
-- Performing Test HAVE___BUILTIN_EXPECT - Success
-- Performing Test HAVE_C_INLINE
-- Performing Test HAVE_C_INLINE - Success
-- Performing Test HAVE_C___INLINE__
-- Performing Test HAVE_C___INLINE__ - Success
-- Performing Test HAVE_C___INLINE
-- Performing Test HAVE_C___INLINE - Success
-- Performing Test HAVE_NO_UNDEFINED
-- Performing Test HAVE_NO_UNDEFINED - Success
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- M_LIBRARY: /usr/lib/libm.so
-- Configuring done
-- Generating done
The resulting config.h has this:
/* Define our audio drivers */
/* #undef HAVE_LINUX_SOUNDCARD_H */
/* #undef HAVE_SYS_SOUNDCARD_H */
/* #undef HAVE_MACHINE_SOUNDCARD_H */
/* #undef HAVE_SOUNDCARD_H */
#define AUDIODRV_NONE 1
#define AUDIODRV_WAVE 1
#define AUDIODRV_ALSA 0
#define AUDIODRV_OSS 0
#define AUDIODRV_OPENAL 0
#define AUDIODRV_AHI 0
#define AUDIODRV_WIN32_MM 0
#define AUDIODRV_OS2DART 0
#define AUDIODRV_DOSSB 0
Obviously not acceptable as is.
Haven't done any further testing, nor have I compared the moved code to the original ones.
@sezero main idea is give to user choice what he like to enable. If user desired to enable OpenAL, ALSA and OSS, new functionality gives him that opportunity. If he decided to disable all - he'll get what he want to: only very basic functionality with one 'true' output which will work on all platforms - wave.
Build system changed for that, so you can enable or disable any variation of outputs that theoretically support target platform.
So, for Linux system build options will be cmake -DCMAKE_BUILD_TYPE=Release -DWANT_STATIC=1 -DWANT_ALSA=ON -DWANT_OSS=ON -DWANT_OPENAL=ON ..
(if you want all of them - and this is sane configuration, you can choose any supported playback with -P <playback_output>
option).
OpenAL chosen as default output with one reason - it runs practically everywhere. If you have OpenAL support on target, you'll don't have to think about platform-specific output and build environment. So this ease to port player/library into new platform. Like I sad, if you have POSIX system with available OpenAL on it, you'll be OK, nothing to do for porting wildmidi player. But still old behavior still available - disable OpenAL and enable one of native output, and you'll receive same functionality as from current master. Player autodetect next available output and will use it for playback.
ping?
@winterheart if you're still around, would be nice to rebase this.
I think the main point of contention was the 'default'. We can still have that discussion if you want.
Keep in mind that openal is deprecated on macos and will eventually be removed. So we'll defo need a replacement, though that is likely not for this PR.
I rebased this myself now (and fixed a few things myself too.) Hopefully not missed anything..
Keep in mind that openal is deprecated on macos and will eventually be removed. So we'll defo need a replacement,
I think we can port coreaudio module of xmp project for it: https://github.com/libxmp/xmp-cli/blob/master/src/sound_coreaudio.c
Keep in mind that openal is deprecated on macos and will eventually be removed. So we'll defo need a replacement,
I think we can port coreaudio module of xmp project for it: https://github.com/libxmp/xmp-cli/blob/master/src/sound_coreaudio.c
Dropped OpenAL support and added CoreAudio support as of 2838805b
Note that cmake still needs -DWANT_COREAUDIO=ON
switch to enable the backend.
Please test.
Why dropping OpenAL? In macOS it's deprecated only on SDK level, but still can be used via brew. And why dropping OpenAL on Linux/BSD?
Why dropping OpenAL? In macOS it's deprecated only on SDK level, but still can be used via brew. And why dropping OpenAL on Linux/BSD?
Native support for them should be superior, e.g. having ALSA on Linux drops any necessity for openal on Linux. FreeBSD is covered by OSS. For OpenBSD we can easily add sndio, etc. Any extra dependency is a hassle, IMO (but that's just me.)
@psi29a: What do you think? Should we keep openal?
openal is still used; openmw is still debating adding midi support and looked at wildmidi as well. As the project makes use of openal-soft; it would be a pity to drop stupport.
I only wanted to make a sane default; so for example auto
which would test and select in a priority list. Obviously not for this PR; but that was my idea.
OK, will rearrange things and will keep openal -- don't know how to handle its priority though..
OK, will rearrange things and will keep openal -- don't know how to handle its priority though..
OK, rearranged things and kept openal. Then moved openal output support after the native backends in the list.
Comments?
I have none; this looks great. Glad to see this project keeping the dream alive. :)
I have none; this looks great. Glad to see this project keeping the dream alive. :)
I have yet to clean things up:
I think I'm mostly done with this. @psi29a, @winterheart: Take a look (and test if possible) one last time.
I still want to add a native backend for netbsd, but that can be done after this gets in.
Yeah, native backends needed for:
We can put that on our issue tracker
Yeah, native backends needed for:
macos
That's already done: coreaudio is added in this P/R
netbsd
Working on it, can possibly do it today
more...
For e.g. ?
Oh wow, reads notes
That means we can make use of github actions to make macos builds as well... perhaps in another PR?
We can have a rule to make release builds when tagged.
That means we can make use of github actions to make macos builds as well... perhaps in another PR?
Current github actions generates artifacts, thanks to @winterheart Don't know specifically about macos, though
We can have a rule to make release builds when tagged.
For another PR.
Merging this now.
@psi29a, @winterheart: With alsa or oss configured, --device=default
or --device=/dev/dsp
works, but -d default
or -d /dev/dsp
does not: Fails with ./wildmidi: invalid option -- 'd'
It used to work before (e.g. in 0.4.5) -- what am I doing wrong? (It's probably something obvious, but I can't see it for now..)
@psi29a, @winterheart: With alsa or oss configured,
--device=default
or--device=/dev/dsp
works, but-d default
or-d /dev/dsp
does not: Fails with./wildmidi: invalid option -- 'd'
It used to work before (e.g. in 0.4.5) -- what am I doing wrong? (It's probably something obvious, but I can't see it for now..)
Created this as a new ticket https://github.com/Mindwerks/wildmidi/issues/250 so that it doesn't get lost. Please respond / discuss at there.
Ah, was going to validate on my mac, but alright. If I come up with anything, will create an issue for it. Cheers everyone!
Ah, was going to validate on my mac, but alright. If I come up with anything, will create an issue for it.
Yes please
Just added a native netbsd backend to master
Ah, was going to validate on my mac, but alright. If I come up with anything, will create an issue for it.
Yes please
And also check the newly added sndio (on openbsd) and netbsd backends if you are able.
Huge refactor for wildmidi player intended to enable more than one playback outputs. Now player supports -P option which controls actual output (default value depends on platform capabilities, but OpenAL output is preferred when available). Each output can be enabled or disabled on configuration and compile time. Currently there 9 outputs:
Player now can be easily extended for additional outputs and ported to another platforms, since there modular "framework" has been implemented.
open_*_output
functions now accept path as output where to save file or send stream to sound device and can be defined by-o <out>
option. This parameter currently required by wave, alsa, oss outputs.Additional fixes to build system
Besides changes related to player, there also some fixes in CMake build system. Now CMake can properly generate project for multiconfiguration systems like VS MSBuild. If such system is detected, you can build any of supported build types with
cmake --build <dir> --config <build_type>
.Additionally Github Actions now stores build artifacts available on Actions page (like here https://github.com/winterheart/wildmidi/actions/runs/376312898).