last_cursor_pos -> write_cursor_pos

This commit is contained in:
Glenn Maynard
2004-09-10 02:57:47 +00:00
parent 2324859389
commit cca6dcbad1
2 changed files with 6 additions and 8 deletions
+4 -6
View File
@@ -178,7 +178,7 @@ DSoundBuf::DSoundBuf( DSound &ds, DSoundBuf::hw hardware,
writeahead = writeahead_ * bytes_per_frame();
volume = -1; /* unset */
buffer_locked = false;
last_cursor_pos = write_cursor = buffer_bytes_filled = 0;
write_cursor_pos = write_cursor = buffer_bytes_filled = 0;
LastPosition = 0;
playing = false;
@@ -620,10 +620,8 @@ bool DSoundBuf::get_output_buf( char **buffer, unsigned *bufsiz, int chunksize )
write_cursor -= buffersize;
buffer_bytes_filled += num_bytes_empty;
write_cursor_pos += num_bytes_empty / bytes_per_frame();
/* Increment last_cursor_pos to point at where the data we're about to
* ask for will actually be played. */
last_cursor_pos += num_bytes_empty / bytes_per_frame();
buffer_locked = true;
return true;
@@ -651,7 +649,7 @@ int64_t DSoundBuf::GetPosition() const
if( frames_behind < 0 )
frames_behind += buffersize_frames(); /* unwrap */
int64_t ret = last_cursor_pos - frames_behind;
int64_t ret = write_cursor_pos - frames_behind;
/* Failsafe: never return a value smaller than we've already returned.
* This can happen once in a while in underrun conditions. */
@@ -677,7 +675,7 @@ void DSoundBuf::Stop()
buf->Stop();
buf->SetCurrentPosition(0);
last_cursor_pos = write_cursor = buffer_bytes_filled = 0;
write_cursor_pos = write_cursor = buffer_bytes_filled = 0;
LastPosition = 0;
/* When stopped and rewound, the play and write cursors should both be 0. */
+2 -2
View File
@@ -47,7 +47,7 @@ public:
~DSoundBuf();
int64_t GetPosition() const;
int64_t GetOutputPosition() const { return last_cursor_pos; }
int64_t GetOutputPosition() const { return write_cursor_pos; }
private:
int buffersize_frames() const { return buffersize / bytes_per_frame(); }
@@ -63,7 +63,7 @@ private:
int buffersize;
int write_cursor, buffer_bytes_filled; /* bytes */
int64_t last_cursor_pos; /* frames */
int64_t write_cursor_pos; /* frames */
mutable int64_t LastPosition;
bool playing;