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

44 lines
876 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:
int channels, samplerate, samplebits, writeahead;
int buffersize, last_cursor_pos;
snd_pcm_sframes_t total_frames;
snd_pcm_t *pcm;
bool Recover( int r );
public:
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 };
Alsa9Buf( hw hardware, int channels, int samplerate, int writeahead );
~Alsa9Buf();
int GetNumFramesToFill();
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