<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<div class="EC_gmail_quote"><div>> also, if you are willing to do it, I would like to kindly ask you to implement playing not only the current dubbing stored as uncompressed 8-bit 22kHz samples, but also dubbing stored in <br>> some new Ogg-compressed format, and making the game support both and auto-detect which one is used.  if that is done, then we could release new game archive, much shorter than <br>> the old one, with the same functionality.<br><br>Sorry to intervene here, I just wanted to say that this functionality should be very easy to do in ScummVM. We got classes which can handle MP3/OGG/FLAC encoded files, and the change needed is minimal (1-2 lines change). So theoretically, you could have some other extension for compressed sounds, and if the compressed file is found, play it with the appropriate class for compressed sound files.<br></div><br>An example code would be something like this (this is just something I quickly whipped up in a hurry, it needs refining):<br><br>Audio::AudioStream *audioStream = 0;<br>Audio::SoundHandle _sfxHandle;<br><br>if (playUncompressedAudio) {<br>  Common::File *audioFile = new Common::File("audio.xxx");  // TODO: proper audio file here<br>  int sampleOffset = 0; // TODO: set this properly<br>  int sampleSize = 0;   // TODO: set this properly<br>  byte *buffer = new byte[sampleSize];<br>  audioFile->seek(sampleOffset, SEEK_SET);<br>  audioFile->read(buffer, sampleSize);<br>  delete audioFile;  // this closes the file<br>  audioStream = Audio::makeLinearInputStream(buffer, sampleSize, 22050, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, 0, 0);<br>} else {<br>#ifdef USE_VORBIS<br>  Common::File *audioFile = new Common::File("audio.yyy");  // TODO: proper audio file here<br>  int sampleOffset = 0; // TODO: set this properly<br>
  int sampleSize = 0;   // TODO: set this properly<br>
  Common::SeekableSubReadStream *audioStream = new
Common::SeekableSubReadStream(audioFile, sampleOffset, sampleOffset +
sampleSize, true);<br>  audioStream = Audio::makeVorbisStream(musicStream, true, 0, 0, 1);<br>  // No need to delete the file here - it's done by makeVorbisStream once the sound is finished playing<br>#endif<br>}<br><br>_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, audioStream);<br><br><br>Note that with the code above, uncompressed sound is first loaded in a buffer, which is then freed by makeLinearInputStream when it finishes<br>playing (because of FLAG_AUTOFREE). The compressed sound is played directly from disk. If you wish to load it in memory, you can read it in a buffer<br>and load it in a MemoryReadStream. This discrepancy with compressed and uncompressed sound will hopefully be addressed with patch #2834001.<br>You can play MP3 and FLAC audio by swapping makeVorbisStream with makeMP3Stream and makeFlacStream - just make sure that these calls are<br>enclosed in the appropriate ifdef blocks (#ifdef USE_MAD and #ifdef USE_FLAC).<br><br>Regards<br>Filippos<br></div><br /><hr />Get your vacation photos on your phone! <a href='http://windowsliveformobile.com/en-us/photos/default.aspx?&OCID=0809TL-HM' target='_new'>Click here.</a></body>
</html>