/*
 * FredyGames: replacement for the old PortAudio V18 header used by Jason Rohrer's minorGems games
 * (Cultivation, Primrose, Transcend). Only the calls the games make are declared; they are
 * implemented over SDL2 audio in pa_sdl.cpp. Public domain, like the games.
 */
#ifndef FREDYGAMES_PORTAUDIO_H
#define FREDYGAMES_PORTAUDIO_H

#ifdef __cplusplus
extern "C" {
#endif

typedef int PaError;
enum { paNoError = 0, paHostError = -10000 };

typedef int PaDeviceID;
#define paNoDevice (-1)

typedef double PaTimestamp;
typedef unsigned long PaSampleFormat;
#define paFloat32 ((PaSampleFormat)(1 << 0))
#define paClipOff ((unsigned long)(1 << 0))

typedef void PortAudioStream;

typedef int (PortAudioCallback)(void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer,
                                PaTimestamp outTime, void *userData);

PaError Pa_Initialize(void);
PaError Pa_Terminate(void);
const char *Pa_GetErrorText(PaError err);
PaDeviceID Pa_GetDefaultOutputDeviceID(void);
PaError Pa_OpenStream(PortAudioStream **stream, PaDeviceID inputDevice, int numInputChannels,
                      PaSampleFormat inputSampleFormat, void *inputDriverInfo, PaDeviceID outputDevice,
                      int numOutputChannels, PaSampleFormat outputSampleFormat, void *outputDriverInfo,
                      double sampleRate, unsigned long framesPerBuffer, unsigned long numberOfBuffers,
                      unsigned long streamFlags, PortAudioCallback *callback, void *userData);
PaError Pa_StartStream(PortAudioStream *stream);
PaError Pa_StopStream(PortAudioStream *stream);
PaError Pa_CloseStream(PortAudioStream *stream);

#ifdef __cplusplus
}
#endif

#endif
