I am using PortAudio, and this is how I’m opening a stream for reading right now.
Pa_OpenDefaultStream(&stream, 1, 0, paFloat32, SAMPLE_RATE, SAMPLES, PaCallback, NULL);
As far as I know, this uses the microphone as input. How can I instead use a file as input? The Pa_OpenStream function strangely doesn’t seem to let me enter a filename?
PortAudio is for device I/O only, such as speakers, microphones, line inputs and similar devices. To do file I/O you need another library designed for that. For example, libsoundfile, libsox or libaudiofile.