This commit is contained in:
Glenn Maynard
2006-11-26 17:58:59 +00:00
parent 25cfaa6f7c
commit 47768d3758
2 changed files with 14 additions and 14 deletions
+5 -5
View File
@@ -18,21 +18,21 @@ pos_map_queue::pos_map_queue( const pos_map_queue &cpy )
*this = cpy; *this = cpy;
} }
void pos_map_queue::Insert( int64_t frameno, int pos, int got_frames ) void pos_map_queue::Insert( int64_t iFrame, int iPosition, int iGotFrames )
{ {
if( m_Queue.size() ) if( m_Queue.size() )
{ {
/* Optimization: If the last entry lines up with this new entry, just merge them. */ /* Optimization: If the last entry lines up with this new entry, just merge them. */
pos_map_t &last = m_Queue.back(); pos_map_t &last = m_Queue.back();
if( last.m_iFrameNo+last.m_iFrames == frameno && if( last.m_iFrameNo+last.m_iFrames == iFrame &&
last.m_iPosition+last.m_iFrames == pos ) last.m_iPosition+last.m_iFrames == iPosition )
{ {
last.m_iFrames += got_frames; last.m_iFrames += iGotFrames;
return; return;
} }
} }
m_Queue.push_back( pos_map_t(frameno, pos, got_frames) ); m_Queue.push_back( pos_map_t(iFrame, iPosition, iGotFrames) );
Cleanup(); Cleanup();
} }
+9 -9
View File
@@ -8,16 +8,16 @@
struct pos_map_t struct pos_map_t
{ {
/* Frame number from the POV of the sound driver: */ /* Frame number from the POV of the sound driver: */
int64_t frameno; int64_t m_iFrameNo;
/* Actual sound position within the sample: */ /* Actual sound position within the sample: */
int64_t position; int64_t m_iPosition;
/* The number of frames in this block: */ /* The number of frames in this block: */
int64_t frames; int64_t m_iFrames;
pos_map_t() { frameno=0; position=0; frames=0; } pos_map_t() { m_iFrameNo = 0; m_iPosition = 0; m_iFrames = 0; }
pos_map_t( int64_t frame, int pos, int cnt ) { frameno=frame; position=pos; frames=cnt; } pos_map_t( int64_t iFrame, int iPosition, int iFrames ) { m_iFrameNo = iFrame; m_iPosition = iPosition; m_iFrames = iFrames; }
}; };
/* This class maps one range of frames to another. */ /* This class maps one range of frames to another. */
@@ -27,11 +27,11 @@ public:
pos_map_queue(); pos_map_queue();
pos_map_queue( const pos_map_queue &cpy ); pos_map_queue( const pos_map_queue &cpy );
/* Insert a mapping from frameno to position, containing pos got_frames. */ /* Insert a mapping from iFrame to iPosition, containing pos iGotFrames. */
void Insert( int64_t frameno, int position, int got_frames ); void Insert( int64_t iFrame, int iPosition, int iGotFrames );
/* Return the position for the given frameno. */ /* Return the position for the given iFrame. */
int64_t Search( int64_t frameno, bool *approximate ) const; int64_t Search( int64_t iFrame, bool *bApproximate ) const;
/* Erase all mappings. */ /* Erase all mappings. */
void Clear(); void Clear();