请教,有个编程问题(200)

  • 主题发起人 主题发起人 不弯的月
  • 开始时间 开始时间

不弯的月

Unregistered / Unconfirmed
GUEST, unregistred user!
各位论坛的友友们,你们好,想请教各位一个问题,是关于编程的问题如下:以下是一段关于声音控制的一段代码,现要做如下改进:编程软件可以随机控制多个扬声器一起发声,随机控制线路增加灵活性(就是页面上参数的灵活性)Option ExplicitDim m_timers As LongDim m_curTimers As LongDim m_curIndex As Integer '记录当前打开的继电器Dim m_n As Long '记录循环次数Private Sub Check1_Click(Index As Integer) OutDataEnd SubSub OutData() Dim SendByte As Integer Dim Bit_Wert As Integer SendByte = 0 Dim x As Integer For x = 1 To 8 If Check1(x).Value = 1 then
SendByte = SendByte + Mark(x - 1) End If Next Debug.Print SendByte Out DataRegister, SendByte 'Data lines (data bus)End SubPrivate Sub CmdStart_Click() If CmdStart.Caption = "开始" then
Timer1.Interval = Val(TxtOpenTime.Text) If Timer1.Interval = 0 then
MsgBox "打开时间不能为0" Exit Sub End If m_timers = Val(txtCloseTime.Text) * 1000 / Timer1.Interval Timer1.Enabled = True m_curTimers = 0 CmdStart.Caption = "停止" TxtOpenTime.Enabled = False txtCloseTime.Enabled = False TxtTimes.Enabled = False m_n = 0 else
Out DataRegister, 0 CmdStart.Caption = "开始" TxtOpenTime.Enabled = True txtCloseTime.Enabled = True TxtTimes.Enabled = True Timer1.Enabled = False End IfEnd SubPrivate Sub Form_Load() Mark(0) = &H1 Mark(1) = &H2 Mark(2) = &H4 Mark(3) = &H8 Mark(4) = &H10 Mark(5) = &H20 Mark(6) = &H40 Mark(7) = &H80 TxtOpenTime.Text = "40" txtCloseTime.Text = "5" TxtTimes.Text = "100" TxtInfo.Text = "" Dim i As Integer For i = 1 To 8 Check1(i).Caption = "线路" + Trim(i) Next Timer1.Enabled = False Option1(0).Value = True 'Option1_Click 0End SubFunction RndOpen() As Integer Dim i As Integer RndOpen = Rnd() * 7 RndOpen = Rnd() * 7End FunctionPrivate Sub Option1_Click(Index As Integer) Frame1(Index).Enabled = True Frame1(1 - Index).Enabled = FalseEnd SubPrivate Sub Timer1_Timer() If m_curTimers = 0 then
Dim rndIndex As Integer rndIndex = RndOpen While rndIndex = m_curIndex rndIndex = RndOpen Wend m_curIndex = rndIndex Out DataRegister, Mark(m_curIndex) m_curTimers = m_curTimers + 1 TxtInfo.Text = TxtInfo.Text + vbCrLf + "打开线路" + Str(m_curIndex + 1) else
If m_curTimers = 1 then
TxtInfo.Text = TxtInfo.Text + vbCrLf + "关闭线路" + Str(m_curIndex + 1) TxtInfo.SelLength = 0 TxtInfo.SelStart = Len(TxtInfo.Text) End If Out DataRegister, 0 m_curTimers = m_curTimers + 1 End If If m_curTimers = m_timers then
m_n = m_n + 1 m_curTimers = 0 End If If m_n >= Val(TxtTimes.Text) then
CmdStart_Click End If End Sub现在这个代码,放在那个应用软件包里只能控制单个扬声器发声,要对其做些改进,使其可以随机控制多个扬声器一起发声,随机控制线路增加灵活性(就是页面上参数的灵活性)整个问题就是这样,希望各位看到的高手帮个忙,谢谢了
 
[?]不是很明白啊~~等待高人
 
恩,其实我也不怎么明白的,诚心的请教各位高手了帮个忙
 
自己顶下,希望看到这个帖子的高手帮帮忙
 
怎么vb的也来凑热闹?
 
晕,我发错了
 
编辑过了
 
有没有高手帮帮忙啊~
 
“软件工程”板块里提这个问题,就要先从系统角度来整理需求:假设有一个5.1声道的放音系统,连接总共6路扬声器,其中有一路是重低音,重低音始终发声,因此,真正参与切换的可能只有5路。基于这样一个系统,请指出你帖子中想要描述的设计需求来。
 

Similar threads

后退
顶部