mirror of
https://github.com/azahar-emu/soundtouch
synced 2025-11-07 07:30:02 +01:00
Added utility function to get elapsed duration i.e. how much so far has been read from the WAV file
This commit is contained in:
parent
6fc0dd1867
commit
b4e22218e6
@ -651,6 +651,14 @@ uint WavInFile::getLengthMS() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Returns how many milliseconds of audio have so far been read from the file
|
||||||
|
uint WavInFile::getElapsedMS() const
|
||||||
|
{
|
||||||
|
return (uint)(1000.0 * (double)dataRead / (double)header.format.byte_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Class WavOutFile
|
// Class WavOutFile
|
||||||
|
|||||||
@ -116,8 +116,11 @@ private:
|
|||||||
/// File pointer.
|
/// File pointer.
|
||||||
FILE *fptr;
|
FILE *fptr;
|
||||||
|
|
||||||
|
/// Position within the audio stream
|
||||||
|
long position;
|
||||||
|
|
||||||
/// Counter of how many bytes of sample data have been read from the file.
|
/// Counter of how many bytes of sample data have been read from the file.
|
||||||
uint dataRead;
|
long dataRead;
|
||||||
|
|
||||||
/// WAV header information
|
/// WAV header information
|
||||||
WavHeader header;
|
WavHeader header;
|
||||||
@ -175,6 +178,11 @@ public:
|
|||||||
/// Get the audio file length in milliseconds
|
/// Get the audio file length in milliseconds
|
||||||
uint getLengthMS() const;
|
uint getLengthMS() const;
|
||||||
|
|
||||||
|
/// Returns how many milliseconds of audio have so far been read from the file
|
||||||
|
///
|
||||||
|
/// \return elapsed duration in milliseconds
|
||||||
|
uint getElapsedMS() const;
|
||||||
|
|
||||||
/// Reads audio samples from the WAV file. This routine works only for 8 bit samples.
|
/// Reads audio samples from the WAV file. This routine works only for 8 bit samples.
|
||||||
/// Reads given number of elements from the file or if end-of-file reached, as many
|
/// Reads given number of elements from the file or if end-of-file reached, as many
|
||||||
/// elements as are left in the file.
|
/// elements as are left in the file.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user