Difference between revisions of ".wav class"

From Jeskola Buzz Wiki
Jump to: navigation, search
(Methods)
(Methods)
Line 15: Line 15:
  
 
== Methods ==
 
== Methods ==
* Open(filename)
+
==== Open(filename) ====
: Opens the file and reads meta data (samplerate etc.) into the class, so that various parameters can be known up front.
+
Opens the file and reads meta data (samplerate etc.) into the class, so that various parameters can be known up front.
* ReadData(chunksize, convert_to_float)
+
==== ReadData(chunksize, convert_to_float) ====
* Close
+
Reads in chunk size of data (streaming)
: Streams in a block of data from the file
+
==== Close =====
* Save(output file bitdepth)
+
Streams in a block of data from the file
* WriteData(data)
+
==== Save(output file bitdepth) ====
* UpdateAndClose()
+
Opens up output file, allocated space for headers
: Udpate header information (such as file length) and closes file
+
==== WriteData(data) ====
 +
Write out a chunk of data
 +
==== UpdateAndClose() ====
 +
Udpates header information (such as file length) and closes file
  
 
== Internal data field ==
 
== Internal data field ==

Revision as of 10:04, 29 June 2010

Design proposition of a lean and mean .wav file handler class

General design goals

  • Should not be bloated and support obscure unused features like ADPCM and such. Just PCM.
  • Should be object oriented (C++), so that handling several files is a breeze
  • Should handle both mono and stereo
  • Should handle up to 192 KHz samplerate
  • Should handle the following input formats: 8-bit int, 16-bit int, 24-bit int, 32-bit float
  • Should handle the following output formats: 16-bit int, 24-bit int (optionally 8-bit int and 32-bit float)
  • Remember to use unsigned int for file sizes. No reason to limit ourselves at 2GB when 4GB is the actual limit.

Undecided

  • Should it support files larger than 4 GB? How does this even work?
  • What should happen to unknown chunks such as markers, weird beat info. It would be super nice to be able to maintain these, but this would take memory.
  • Maybe it should handle IFF AIFF files (as they are 95% identical to .wav it should be fairly simple)

Methods

Open(filename)

Opens the file and reads meta data (samplerate etc.) into the class, so that various parameters can be known up front.

ReadData(chunksize, convert_to_float)

Reads in chunk size of data (streaming)

Close =

Streams in a block of data from the file

Save(output file bitdepth)

Opens up output file, allocated space for headers

WriteData(data)

Write out a chunk of data

UpdateAndClose()

Udpates header information (such as file length) and closes file

Internal data field

  • Length (in samples)
  • Samplerate
  • Channels
  • Bits per sample