コード例 #1
0
ファイル: bink_decoder.cpp プロジェクト: mauimauer/scummvm
void BinkDecoder::audioPacket(AudioTrack &audio) {
	if (!_audioStream)
		return;

	int outSize = audio.frameLen * audio.channels;
	while (audio.bits->pos() < audio.bits->size()) {
		int16 *out = (int16 *)malloc(outSize * 2);
		memset(out, 0, outSize * 2);

		audioBlock(audio, out);

		byte flags = Audio::FLAG_16BITS;
		if (audio.outChannels == 2)
			flags |= Audio::FLAG_STEREO;

#ifdef SCUMM_LITTLE_ENDIAN
		flags |= Audio::FLAG_LITTLE_ENDIAN;
#endif

		_audioStream->queueBuffer((byte *)out, audio.blockSize * 2, DisposeAfterUse::YES, flags);

		if (audio.bits->pos() & 0x1F) // next data block starts at a 32-byte boundary
			audio.bits->skip(32 - (audio.bits->pos() & 0x1F));
	}
}
コード例 #2
0
ファイル: bink.cpp プロジェクト: mcajend/xoreos
void Bink::audioPacket(AudioTrack &audio) {
    if (_disableAudio)
        return;

    int outSize = audio.frameLen * audio.channels;
    while (!_disableAudio && (audio.bits->pos() < audio.bits->size())) {
        int16 *out = new int16[outSize];
        memset(out, 0, outSize * 2);

        audioBlock(audio, out);

        if (_disableAudio) {
            delete[] out;
            return;
        }

        queueSound((const byte *) out, audio.blockSize * 2);

        if (audio.bits->pos() & 0x1F) // next data block starts at a 32-byte boundary
            audio.bits->skip(32 - (audio.bits->pos() & 0x1F));
    }
}