SWF-Builder

 view release on metacpan or  search on metacpan

lib/SWF/Builder/Character/Sound.pm  view on Meta::CPAN

    $self->_init_character;
    $self;
}

sub _pack {

#stub

}

sub start_streaming {
    my ($self, %param) = @_;

    my $parent = $param{MovieClip} || $param{MC} || $self->{_parent} or croak "Can't get the movieclip to play on";
    if ($parent eq '_root') {
	$parent = $self->{_root};
    } elsif (ref($parent) eq 'SWF::Builder') {
	$parent = $parent->{_root};
    }

    croak "A streaming sound has already set in the movie clip" if $parent->{_streamsoundf};
    $parent->{_streamsoundf} = 1;
    my $frame = $param{Frame} || 1;

    my $ss = $self->_init_streaming($self->{_root}{_file}->FrameRate);
    push @{$parent->{_frame_list}[0]}, $ss->header_tag;

#    $ss->__dump;

    while (defined(my $btag = $ss->next_block_tag)) {
	push @{$parent->{_frame_list}[$frame-1]}, $btag if $btag;
	$frame++;
    }
}

lib/SWF/Builder/Character/Sound.pm  view on Meta::CPAN

Volume level can take a number from 0 to 32768, or a reference to the array of
volume levels of left and right channels.

=back

=item $sound->stop( [ MovieClip => $mc, Frame => $frame ] )

stops playing the sound. 
It can take 'MovieClip' and 'Frame' options as same as the 'play' method.

=item $sound->start_streaming( [ MovieClip => $mc, Frame => $frame ] )

starts the streaming sound, which synchronizes with the movie timeline.
It can take 'MovieClip' and 'Frame' options as same as the 'play' method.

=item $sound->Latency( $msec )

sets the sound latency in milliseconds.

=back

=head1 COPYRIGHT

lib/SWF/Builder/Character/Sound/MP3.pm  view on Meta::CPAN

	$tag->SoundSampleCount($count);
	$tag->SoundID($self->{ID});
	$tag->pack($stream);
    };
    if ($@) {
	croak substr($@, 1) if $@ =~ /^\*/;
	die;
    }
}

sub _init_streaming {
    my ($self, $framerate) = @_;
    my $filename = $self->{_filename};
    my $htag = SWF::Element::Tag::SoundStreamHead2->new;

    open my $f, '<', $filename or croak "Can't find '$filename'";
    binmode $f;
    my ($data, $version, $channel, $count, $seek) = $self->_set_initial_seek($f);
    $htag->StreamSoundCompression(2);
    $htag->StreamSoundRate($version+1);
    $htag->StreamSoundSize(1);



( run in 0.320 second using v1.01-cache-2.11-cpan-4d50c553e7e )