示例#1
0
void writeSWFSoundInstanceToMethod(SWFBlock block,
																	 SWFByteOutputMethod method, void *data)
{
	SWFSoundInstance sound;
	byte flags;
	int i;

	// block may be null if we're calling from button.c:

	if ( block == NULL )
	{
		method(0, data);
		method(0, data);
		method(0, data);
		return;
	}

	sound = (SWFSoundInstance)block;
	flags = sound->flags;

	if ( sound->sound )
		methodWriteUInt16(CHARACTERID(sound->sound), method, data);
	else
		methodWriteUInt16(0, method, data);	 /* 0 means NULL character */

	method(flags, data);

	if ( flags & SWF_SOUNDINFO_HASINPOINT )
		methodWriteUInt32(sound->inPoint, method, data);

	if ( flags & SWF_SOUNDINFO_HASOUTPOINT )
		methodWriteUInt32(sound->outPoint, method, data);

	if ( flags & SWF_SOUNDINFO_HASLOOPS )
		methodWriteUInt16(sound->numLoops, method, data);

	if ( flags & SWF_SOUNDINFO_HASENVELOPE )
	{
		method(sound->numEnvPoints, data);

		for ( i=0; i<sound->numEnvPoints; ++i )
		{
			methodWriteUInt32((sound->envPoints[i]).mark44, method, data);
			methodWriteUInt16((sound->envPoints[i]).level0, method, data);
			methodWriteUInt16((sound->envPoints[i]).level1, method, data);
		}
	}
}
示例#2
0
文件: soundstream.c 项目: cran/R2SWF
void
writeSWFSoundWithSoundStreamToMethod(SWFSoundStream stream,
                            SWFByteOutputMethod method, void *data)
{
	int source = stream->streamSource;
	struct SWFSoundStreamBlock_s streamblock;

	/* need to get the sample count && and rewind */
	SWFSoundStream_getLength(stream, &streamblock);
	SWFSoundStream_rewind(stream);

	methodWriteUInt32(streamblock.numSamples, method, data);
	methodWriteUInt16(stream->initialDelay, method, data);
	if(source == STREAM_MP3)
		write_mp3(&streamblock, method, data);
	else if(source == STREAM_FLV)
		write_flv(&streamblock, method, data);
}
示例#3
0
文件: block.c 项目: cran/R2SWF
int
writeSWFBlockToMethod(SWFBlock block, SWFByteOutputMethod method, void *data)
{
	SWFBlocktype type = block->type;
	unsigned int length;

	switch(block->type)
	{
	case SWF_UNUSEDBLOCK:
	case SWF_MINGFONT:
		return 0;
	default:
		break;
	}

	if ( !block->completed )
		completeSWFBlock(block);

	length = block->length;

	/* write header */

	if(type == SWF_PREBUILTCLIP)
		type = SWF_DEFINESPRITE;
	if ( type == SWF_PREBUILT )
		;
	else if ( length > 62 ||
			 type == SWF_DEFINELOSSLESS ||
			 type == SWF_DEFINELOSSLESS2 )
	{
		/* yep, a definebitslossless block has to be long form, even if it's
			 under 63 bytes.. */
		method((unsigned char)(((type&0x03)<<6) + 0x3f), data);
		method((unsigned char)((type>>2) & 0xff), data);
		methodWriteUInt32(length, method, data);
		length += 6;
	}