Example #1
0
func write() {
	//
	n, a := cdker.NTracks(), cdker.ActTrack()
	//  cdker.Mutex.Lock()
	bx.Wd(12) // TODO
	bx.Colours(col.HintF, col.HintB)
	bx.Write(cdker.String(), l1, cr)
	var f col.Colour
	for t := uint8(0); t < n; t++ {
		if t == a {
			f = trackTimeF
		} else {
			f = cF
		}
		wr1(uint(t)+1, l0+uint(t), 0, f, cB)
	}
	for c := cdker.Controller(0); c < cdker.NCtrl; c++ {
		ctrlBar[c].Fill(uint(cdker.Volume(c)))
		ctrlBar[c].Write()
	}
	timeBar[0].Def(cdker.Length[a].NSeconds())
	timeBar[0].Fill(cdker.TrackTime.NSeconds())
	timeBar[0].Write()
	timeBar[1].Fill(cdker.Time.NSeconds())
	timeBar[1].Write()
	bx.Wd(2)
	bx.Colours(trackTimeF, cB)
	bx.Write(nat.StringFmt(uint(a)+1, 2, false), l1, cr+wr-2)
	wrt(cdker.TrackTime, clk.Mm_ss, trackTimeF, cB, lt[0]+1, cr)
	wrt(cdker.Length[a], clk.Mm_ss, lengthF, cB, lt[0]+1, cr+wr-5)
	wrt(cdker.Time, clk.Mm_ss, trackTimeF, cB, lt[1]+1, cr)
	//  cdker.Mutex.Unlock()
}
Example #2
0
func trackUnderMouse() (uint8, bool) {
	//
	if scr.UnderMouse(l0, 0, cs+5, uint(cdker.NTracks())) {
		l, _ := scr.MousePos()
		return uint8(l) - l0, true
	}
	return 0, false
}
Example #3
0
func writeMask() {
	//
	n := cdker.NTracks()
	n1 := n + 1
	for t := uint8(0); t < n1; t++ {
		if t < n {
			wr1(uint(t)+1, l0+uint(t), 0, cF, cB)
			wrt(cdker.StartTime[t], clk.Mm_ss, timeF, cB, l0+uint(t), cs)
			wrt(cdker.Length[t], clk.Mm_ss, lengthF, cB, l0+uint(t), ct)
		}
	}
	timeBar[1].Def(cdker.TotalTime.NSeconds())
	wrt(cdker.TotalTime, clk.Mm_ss, timeF, cB, lt[1]+1, cr+wr-5)
	done = true
}
Example #4
0
func main() {
	//
	/*
	   h:= [...]string {
	     "     <              Rücktaste <--                      ",
	     " <<    >>           Pfeiltaste auf-/abwärts            ",
	     "|<<    >>|          Pos1-Taste/Endetaste               ",
	     "    2 .. 12         F2 .. F12-Taste                    ",
	     "   13 .. 24         Umschalt- + F1 .. F12-Taste        ",
	     "               oder Mausklick auf entsprechende Zeile  ",
	     " Zufallsstück       Rollen-Taste                       ",
	     "                                                       ",
	     "  <  1 sek >        Bildtaste auf-/abwärts             ",
	     " << 10 sek >>       Umschalt- + Bildtaste auf-/abwärts ",
	     "<<<  1 min >>>      Alt- + Bildtaste auf-/abwärts      ",
	     "                                                       ",
	     "  Lautstärke        Pfeiltaste Links/Rechts und        ",
	     "                    Umschalt- + Pfeiltaste Links/Rechts",
	     "               oder mit Maus auf entsprechende Anzeige ",
	     "   Balance          Alt- + Pfeiltaste Links/Rechts     ",
	     "               oder mit Maus auf entsprechende Anzeige ",
	     "                                                       ",
	     " Pause/weiter       Pause-Taste                        ",
	     " Ende/CD raus       Abbruch-/Entfernungstaste          " }
	   Help:= make ([]string, len(h))
	   for i:= 0; i < len(h); i++ { str.Set (&Help[i], h[i]) }
	*/
	errh.WriteHeadline(program, version, author, col.LightWhite, col.DarkBlue)
	f := model.Soundfile()
	if f == nil {
		model.Term1()
		errh.Error("kein Zugriff auf CD", 0)
		ker.Terminate()
		return
	}
	view.WriteMask()
	var (
		help, stop bool
	)
	quit := make(chan bool)
	go func() {
		for !stop {
			ker.Sleep(1)
			if !help {
				view.Write()
			}
		}
		quit <- true
	}()
	model.PlayTrack(0)
loop:
	for {
		c, t := kbd.Command()
		help = false
		scr.MouseCursor(true)
		switch c {
		case kbd.Esc:
			if t == 0 {
				model.Term()
			} else {
				model.Term1()
			}
			stop = true
			break loop
		case kbd.Enter:
			if t == 0 {
				model.PlayTrack1(true)
			} else {
				model.PlayTrack(model.NTracks() - 1)
			}
		case kbd.Back:
			switch t {
			case 0:
				model.PlayTrack0()
			case 1:
				model.PlayTrack1(false)
			default:
				model.PlayTrack(0)
			}
		case kbd.Left, kbd.Right:
			switch t {
			case 0:
				model.Ctrl1(model.All, c == kbd.Right)
			case 1:
				_ = uint(model.Volume(model.All))
				for j := 0; j < 8; j++ {
					model.Ctrl1(model.All, c == kbd.Right)
				}
			default:
				model.Ctrl1(model.Balance, c == kbd.Left)
			}
		case kbd.Pos1:
			model.PlayTrack(0)
		case kbd.End:
			model.PlayTrack(model.NTracks() - 1)
		case kbd.Up, kbd.Down:
			switch t {
			case 0, 1:
				model.PlayTrack1(c == kbd.Down)
			case 2:
				model.PosTime1(c == kbd.Down, 1)
			case 3:
				model.PosTime1(c == kbd.Down, 10)
			default:
				model.PosTime1(c == kbd.Down, 60)
			}
		case kbd.Tab:
			model.PlayTrack1(t == 0)
		case kbd.Del:
			model.Term1()
			return
		case kbd.Help, kbd.LookFor, kbd.Act, kbd.Cfg,
			kbd.Mark, kbd.Demark, kbd.Deposit, kbd.Paste,
			kbd.Black, kbd.Red, kbd.Green, kbd.Blue:
			if t == 0 {
				if c == kbd.Help {
					//          help = true
					//          errh.WriteHelp (Help)
				} else {
					model.PlayTrack(uint8(c - kbd.Help))
				}
			} else {
				model.PlayTrack(10 + uint8(c-kbd.Help))
			}
		case kbd.Roll:
			model.PlayTrack(uint8(rand.Natural(uint(model.NTracks()))))
		case kbd.Pause:
			model.Switch()
		case kbd.Here, kbd.Pull:
			var ctrl model.Controller
			if track, b := view.TrackUnderMouse(); b {
				if c == kbd.Here {
					model.PlayTrack(track)
				}
			} else if ls, c := view.ControlUnderMouse(&ctrl); c {
				model.Ctrl(ctrl, uint8(ls))
			} else if b, sek, c := view.TimeUnderMouse(); c {
				model.PosTime(b, sek)
			}
		case kbd.Navigate:
			/*
			   var mov, rot space.Gridcoordinate
			   &mov, &rot = mouse3d.Read()
			   model.Ctrl1 (model.All, mov [space.Top] < 0)
			   model.Ctrl1 (model.All, rot [space.Right] < 0)
			   model.Ctrl1 (model.Balance, rot [space.Front] < 0)
			*/
		}
	}
	<-quit
	_ = f.Close()
	ker.Terminate()
}