rhdunn / pcaudiolib

Portable C Audio Library
GNU General Public License v3.0
10 stars 2 forks source link

Fail gracefully if XAudio2_8.dll is not present. #9

Open rhdunn opened 7 years ago

rhdunn commented 7 years ago

Use LoadLibrary/GetProcAddress instead of linking to xaudio2.lib in create_xaudio2_object to support returning NULL if the XAudio2 DLL is not present.

See https://github.com/rhdunn/espeak/issues/98.

References:

  1. https://msdn.microsoft.com/en-us/library/windows/desktop/ee415802(v=vs.85).aspx -- XAudio2 versions
  2. https://blogs.msdn.microsoft.com/chuckw/2012/04/02/xaudio2-and-windows-8/
mse2 commented 6 years ago

Another option is to use the waveOUT API which is available on older Windows versions too. https://gitlab.com/mseide-msegui/pcaudiolib/blob/mse/src/waveout.c https://gitlab.com/mseide-msegui/pcaudiolib/blob/mse/src/audio.c It will be activated by the NO_XAUDIO2 define. Binaries are here: https://sourceforge.net/projects/mseuniverse/files/eSpeakNG/ rename "libespeak-ngwo.dll" to "libespeak-ng.dll" if you want to use it with "espeak-ng.exe".