Показать сообщение отдельно
Старый 22.11.2008, 15:35   #1
snikers
Нуждающийся
 
Аватар для snikers
 
Регистрация: 23.08.2008
Сообщений: 55
Написано 4 полезных сообщений
(для 4 пользователей)
Получить значение по индексу

Ищо одну проблемко

Type TMusicBox
	Field list:TList
	
	Function Create:TMusicBox()
		Local mb:TMusicBox = New TMusicBox
		If (mb.list = Null) Then mb.list = CreateList()
		Return mb
	End Function
	
	Method Add(filename$)
		Local mt:TMusicTrack = TMusicTrack.Create(filename)
		list.AddLast(mt)
		mt = Null
	End Method
	
	Method Play(num%)
		If (num > 0 And num <= list.Count())
			For Local m:TMusicTrack = EachIn list
				If Not(m.IsPlaying()) m.Play()
			Next
		End If
	End Method
	
	Method PlayRandom()
		'Local r% = Rand(0, list.Count())
		'If (list.Contains(r))
		'	list.ValueAtIndex(r).Play()
		'End If
	End Method
End Type
есть список, в нем TMusicTrack'ы, есть метод Play(num%) который должен играть num из списка, подскажите как такое сделать И еще обясните для чего нужен TLink?

Type TMusicTrack
	Field audiofile%, channel%
	Field pitch%, volume#, pan#
	
	Function Create:TMusicTrack(filename$)
		Local mt:TMusicTrack = New TMusicTrack
		mt.audiofile = bbLoadSound(filename)
		mt.volume = 1
		mt.pitch = 44000
		mt.pan = 0
		Return mt
	End Function
	
	Method Delete()
		If (audiofile) Then bbFreeSound(audiofile)
	End Method
	
	Method Play()
		channel = bbPlaySound(audiofile)
	End Method
	
	Method Stop()
		If (channel <> 0)
			bbStopChannel(channel)
		End If
	End Method
	
	Method Pause()
		If (channel <> 0)
			bbPauseChannel(channel)
		End If
	End Method
	
	Method Resume()
		If (channel <> 0)
			bbResumeChannel(channel)
		End If
	End Method
	
	Method SetVolume(value#)
		If (channel <> 0)
			If (value > 0 And value < 1) Then volume = value
			bbChannelVolume(channel, volume)
		End If
	End Method
	
	Method GetVolume#()
		Return volume
	End Method
	
	Method SetPitch(value%)
		If (channel <> 0)
			If (value > 8000 And value < 44000) Then pitch = value
			bbChannelPitch(channel, pitch)
		End If
	End Method
	
	Method GetPitch%()
		Return pitch
	End Method
	
	Method SetPan(value#)
		If (channel <> 0)
			If (value >= - 1 And value <= 1) Then pan = value
			bbChannelPan(channel, pan)
		End If
	End Method
	
	Method GetPan#()
		Return pan
	End Method
	
	Method IsPlaying%()
		If (channel <> 0)
			Return bbChannelPlaying(channel)
		End If
	End Method
End Type
__________________
мои игры


требуется художник, за подробностями в асю - 428078069
(Offline)
 
Ответить с цитированием