View Single Post
Old 04-11-2020, 01:48 AM   #31
geek1011
Wizard
geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.
 
Posts: 2,808
Karma: 7423683
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
I've extracted it from the latest update package. Also, gst-launch is present.

Code:
$ find update_kindle_all_new_paperwhite_v2_5.12.4 | grep -e gst-launch -e mixer
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/share/alsa/smixer.conf
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/bin/gst-launch-0.10
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/bin/alsamixer
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/bin/amixer
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/bin/gst-launch
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/gstreamer-0.10/libgstmixersink.so
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/gstreamer-0.10/libgstmixersink.so.1.0
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/gstreamer-0.10/libgstmixersink.so.1
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/libmixerCommon.so.1
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/libmixerCommon.so.1.0
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/alsa-lib/smixer
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/alsa-lib/smixer/smixer-ac97.so
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/alsa-lib/smixer/smixer-hda.so
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/alsa-lib/smixer/smixer-sbase.so
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/libmixerAPI.so.1
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/libmixerCommon.so
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/libmixerAPI.so.1.0
update_kindle_all_new_paperwhite_v2_5.12.4/fwo_rootfs/usr/lib/libmixerAPI.so
The interface seems simple enough to use directly with dlsym. The lib seems to support both C++ (mixer::*) and C (Mixer*).

The easiest way to use it would probably to write an output adapter for miniaudio (a single-file C audio lib) or to use it through gstreamer (with gst-launch or directly).

Some random notes:
- It's thread-safe.
- The C interface is just a wrapper for the C++ one.
- /var/run/mixer
- */mstream

Try something like:
cat raw_audio_s16le_4800.bin | /usr/bin/gst-launch filesrc location=/dev/stdin ! rawaudioparse use-sink-caps=false format=pcm pcm-format=s16le sample-rate=48000 ! audioconvert ! audioresample ! mixersink
where raw_audio_s16le_4800.bin is raw audio from something like:
ffmpeg -i audio.file -f s16le -acodec pcm_s16le -ac 2 -ar 48000 raw_audio_s16le_4800.bin

Or, compile this, and run something like:
./audioconverter audio.file /dev/stdout | /usr/bin/gst-launch filesrc location=/dev/stdin ! wavparse ! audioconvert ! audioresample ! mixersink

libaudioclient (used by libasrEarcon) seems to have a higher-lever wrapper around libmixerAPI which supports playing WAV files. It should be simple enough to adapt it to play anything. /usr/bin/ivonattsd makes use of this.

Some more notes on libmixerAPI usage:
- MixerOpenPlay returns 1 (failure) or 0 (success).
- You need to use MixerGetSampleSizeBits to get the current bit depth (i.e. 16-bit).
- To play samples, do MixerGetBufPlay, memcpy the samples, then MixerReleaseBufPlay.
- MixerWaitTillAudioProcessed waits until the buffer has been emptied (i.e. to play audio, loop between MixerWaitTillAudioProcessed/MixerGetBufPlay/memcpy/MixerReleaseBufPlay/decode until there isn't any more audio left to play).
- MixerClose takes the address of the mixer and destroys it.
- If you use libaudioclient instead, it's as simple as audio_initializeStream/audio_playWaveSamples/audio_waitForCompletion/audio_destroyStream).

Last edited by geek1011; 04-11-2020 at 03:56 PM.
geek1011 is offline   Reply With Quote