BlitzMovie Question

Miscellaneous Forums/Content Creation Tools/BlitzMovie Question

Solution to Movie volume controls:
Separate Sound from Movie
Start them individually, or create functions to manage everything for you.

Here's something I made in about five to ten minutes, it could help you.

;XMovie  - Jesse Andersen ( jesse_andersengt@... )

Type Movie
	Field MovieFileName$
	Field Movie
	Field x#, y#, width#, height#
	Field SoundFileName$
	Field Channel
	Field Volume#, Pitch, Pan#
End Type


Function LoadMovie( MovieFileName$, SoundFileName$ = "", x# = 0, y# = 0, width# = 0, height# = 0, Volume# = 1, Pitch = 44000, Pan# = 0 )
	If FileType( MovieFileName$ ) = 1 Then
		Movie.Movie = New Movie
			Movie\MovieFileName$ = MovieFileName$
			Movie\SoundFileName$ = SoundFileName$
			Movie\x# = x#
			Movie\y# = y#
			If width# = 0 Then width# = GraphicsWidth()
			If height# = 0 Then height# = GraphicsHeight
			Movie\width# = width#
			Movie\height# = height
			Movie\Volume# = Volume#
			Movie\Pitch = Pitch
			Movie\Pan = Pan#
			
			Return Handle( Movie )
	EndIf
	Return False
End Function

Function PlayMovie( Id )
	Movie.Movie = Object.Movie( Id )
	If Movie.Movie <> Null Then
		Movie\Movie = OpenMovie( Movie\MovieFileName$ )
		Movie\Channel = PlayMusic( Movie\SoundFileName$ )
		Return True
	EndIf
	Return False
End Function

Function RenderMovie( )
	For Movie.Movie = Each Movie
		DrawMovie Movie\Movie, Movie\x#, Movie\y#, Movie\width#, Movie\height#
	Next
End Function

Function MovieDrawArea( Id, x# = 0, y# = 0, width# = 0, height# = 0 )
	Movie.Movie = Object.Movie( Id )
	If Movie.Movie <> Null Then
		Movie\x# = x#
		Movie\y# = y#
		If width# = 0 Then width# = GraphicsWidth()
		If height# = 0 Then height# = GraphicsHeight
		Movie\width# = width#
		Movie\height# = height#
	EndIf
End Function
		

Function MovieVolume( Id, Volume# = 1 )
	Movie.Movie = Object.Movie( Id )
	If Movie.Movie <> Null Then
		Movie\Volume# = Volume#
		ChannelVolume Movie\Channel, Movie\Volume#
	EndIf
End Function

Function MoviePitch( Id, Pitch = 44000 )
	Movie.Movie = Object.Movie( Id )
	If Movie.Movie <> Null Then
		Movie\Pitch = Pitch
		ChannelPitch Movie\Channel, Movie\Pitch
	EndIf
End Function

Function MoviePan( Id, Pan# = 0 )
	Movie.Movie = Object.Movie( Id )
	If Movie.Movie <> Null Then
		Movie\Pan# = Pan#
		ChannelPan Movie\Channel, Movie\Pan#
	EndIf
End Function

Function IsMoviePlaying( Id )
	Movie.Movie = Object.Movie( Id )
	If Movie.Movie <> Null Then
		Return MoviePlaying( Movie\Movie )
	EndIf
End Function

Function StopMovie( Id )
	Movie.Movie = Object.Movie( Id )
	If Movie.Movie <> Null Then
		If MoviePlaying( Movie\Movie ) Then CloseMovie( Movie\Movie )
		If ChannelPlaying( Movie\Channel ) Then StopChannel( Movie\Channel )
	EndIf
End Function

Function DeleteMovie( Id )
	Movie.Movie = Object.Movie( Id )
	If Movie.Movie <> Null Then
		If MoviePlaying( Movie\Movie ) Then CloseMovie( Movie\Movie )
		If ChannelPlaying( Movie\Channel ) Then StopChannel( Movie\Channel )
		Delete Movie
	EndIf
End Function