Files
itgmania212121/stepmania/src/arch/Sound/ALSA9Helpers.h
T

47 lines
926 B
C++
Raw Normal View History

2003-10-21 22:51:25 +00:00
#ifndef ALSA9_HELPERS_H
#define ALSA9_HELPERS_H
#define ALSA_PCM_NEW_HW_PARAMS_API
#include <alsa/asoundlib.h>
#include "SDL_types.h"
class Alsa9Buf
{
private:
2003-10-22 02:34:44 +00:00
int channels, samplerate, samplebits;
2003-10-21 22:51:25 +00:00
int buffersize, last_cursor_pos;
snd_pcm_sframes_t total_frames;
snd_pcm_t *pcm;
bool Recover( int r );
bool SetHWParams();
2003-10-21 22:51:25 +00:00
public:
static void GetSoundCardDebugInfo();
2003-10-21 22:51:25 +00:00
enum hw { HW_HARDWARE, HW_SOFTWARE, HW_DONT_CARE };
/* If samplerate is DYNAMIC_SAMPLERATE, then call SetSampleRate before
* you use the sample. */
enum { DYNAMIC_SAMPLERATE = -1 };
2003-10-22 02:34:44 +00:00
Alsa9Buf( hw hardware, int channels, int samplerate );
2003-10-21 22:51:25 +00:00
~Alsa9Buf();
2003-10-22 02:34:44 +00:00
int GetNumFramesToFill( int writeahead );
2003-10-21 22:51:25 +00:00
void Write( const Sint16 *buffer, int frames );
void Reset();
void Play();
void Stop();
void SetVolume(float vol);
void SetSampleRate(int hz);
int GetPosition() const;
int GetPlayPos() const { return last_cursor_pos; }
};
#endif