convert sound types
This commit is contained in:
@@ -318,7 +318,7 @@ bool Alsa9Buf::WaitUntilFramesCanBeFilled( int timeout_ms )
|
||||
return err == 1;
|
||||
}
|
||||
|
||||
void Alsa9Buf::Write( const Sint16 *buffer, int frames )
|
||||
void Alsa9Buf::Write( const int16_t *buffer, int frames )
|
||||
{
|
||||
/* We should be able to write it all. If we don't, treat it as an error. */
|
||||
int wrote = dsnd_pcm_mmap_writei( pcm, (const char *) buffer, frames );
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
|
||||
int GetNumFramesToFill();
|
||||
bool WaitUntilFramesCanBeFilled( int timeout_ms );
|
||||
void Write( const Sint16 *buffer, int frames );
|
||||
void Write( const int16_t *buffer, int frames );
|
||||
unsigned FindSampleRate( unsigned rate );
|
||||
|
||||
void Play();
|
||||
|
||||
@@ -11,7 +11,7 @@ const int channels = 2;
|
||||
const int samplerate = 44100;
|
||||
|
||||
const int samples_per_frame = channels;
|
||||
const int bytes_per_frame = sizeof(Sint16) * samples_per_frame;
|
||||
const int bytes_per_frame = sizeof(int16_t) * samples_per_frame;
|
||||
|
||||
const unsigned max_writeahead = 1024*8;
|
||||
const int num_chunks = 8;
|
||||
@@ -92,9 +92,9 @@ bool RageSound_ALSA9::stream::GetData( bool &bEOF )
|
||||
if( frames_to_fill < chunksize )
|
||||
return false;
|
||||
|
||||
static Sint16 *buf = NULL;
|
||||
static int16_t *buf = NULL;
|
||||
if ( !buf )
|
||||
buf = new Sint16[max_writeahead*samples_per_frame];
|
||||
buf = new int16_t[max_writeahead*samples_per_frame];
|
||||
char *cbuf = (char*) buf;
|
||||
|
||||
const int64_t play_pos = pcm->GetPlayPos();
|
||||
@@ -130,7 +130,7 @@ bool RageSound_ALSA9::stream::GetData( bool &bEOF )
|
||||
bytes_read += got;
|
||||
bytes_left -= got;
|
||||
|
||||
RageSoundManager::AttenuateBuf( buf, got/sizeof(Sint16), snd->GetVolume() );
|
||||
RageSoundManager::AttenuateBuf( buf, got/sizeof(int16_t), snd->GetVolume() );
|
||||
|
||||
if( bytes_left > 0 )
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ static const int channels = 2;
|
||||
int samplerate = 44100;
|
||||
|
||||
static const int samples_per_frame = channels;
|
||||
static const int bytes_per_frame = sizeof(Sint16) * samples_per_frame;
|
||||
static const int bytes_per_frame = sizeof(int16_t) * samples_per_frame;
|
||||
|
||||
/* Linux 2.6 has a fine-grained scheduler. We can almost always use a smaller buffer
|
||||
* size than in 2.4. XXX: Some cards can handle smaller buffer sizes than others. */
|
||||
@@ -57,9 +57,9 @@ bool RageSound_ALSA9_Software::GetData()
|
||||
if( frames_to_fill <= 0 )
|
||||
return false;
|
||||
|
||||
static Sint16 *buf = NULL;
|
||||
static int16_t *buf = NULL;
|
||||
if (!buf)
|
||||
buf = new Sint16[max_writeahead*samples_per_frame];
|
||||
buf = new int16_t[max_writeahead*samples_per_frame];
|
||||
|
||||
const int64_t play_pos = pcm->GetPlayPos();
|
||||
const int64_t cur_play_pos = pcm->GetPosition();
|
||||
|
||||
@@ -109,7 +109,7 @@ void RageSound_Generic_Software::Mix( int16_t *buf, int frames, int64_t frameno,
|
||||
|
||||
/* Note that, until we call advance_read_pointer, we can safely write to p[0]. */
|
||||
const int frames_to_read = min( frames_left, p[0]->frames_in_buffer );
|
||||
mix.write( (Sint16*)p[0]->p, frames_to_read * channels, s.volume, got_frames*channels );
|
||||
mix.write( p[0]->p, frames_to_read * channels, s.volume, got_frames*channels );
|
||||
|
||||
SOUNDMAN->CommitPlayingPosition( s.sound_id, frameno+got_frames, p[0]->position, frames_to_read );
|
||||
|
||||
@@ -133,7 +133,7 @@ void RageSound_Generic_Software::Mix( int16_t *buf, int frames, int64_t frameno,
|
||||
}
|
||||
|
||||
memset( buf, 0, frames*bytes_per_frame );
|
||||
mix.read( (Sint16*)buf );
|
||||
mix.read( buf );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user