I had always assumed this file to be necessary to any application using audio, or at least those using positional audio. However, the following code runs perfectly happily when linked statically to SFML and provided only with libsndfile-1.dll, not openal32.dl.
When is openal32.dll necessary?
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
int main()
{
sf::RenderWindow Window(sf::VideoMode(800, 600, 32), "SFML Sample Application");
sf::Image Image;
Image.LoadFromFile("image.png");
sf::Sprite Sprite(Image);
Sprite.Resize(800.0f, 600.0f);
sf::SoundBuffer Buffer;
Buffer.LoadFromFile("sound.wav");
sf::Sound Sound(Buffer, true);
Sound.SetPosition(5.0f, 1.0f, 10.0f);
Sound.Play();
sf::Listener::SetPosition(0.0f, 0.0f, 0.0f);
while (Window.IsOpened())
{
sf::Event Event;
while (Window.PollEvent(Event))
{
switch (Event.Type)
{
case sf::Event::Closed:
Window.Close();
break;
default:
break;
}
}
Window.Clear();
Window.Draw(Sprite);
Window.Display();
}
return 0;
}