mirror of
				https://github.com/onyx-and-iris/voicemeeter.git
				synced 2025-10-31 06:31:44 +00:00 
			
		
		
		
	move kindMap, fix doc strings
fix doc strings move kindMap into kinds.go rename kind_id to kindId
This commit is contained in:
		
							parent
							
								
									3f6a2c90c5
								
							
						
					
					
						commit
						13f7e3d1ad
					
				| @ -40,10 +40,10 @@ var ( | ||||
| 
 | ||||
| // login logs into the API, | ||||
| // then attempts to launch Voicemeeter if it's not running. | ||||
| func login(kind_id string) { | ||||
| func login(kindId string) { | ||||
| 	res, _, _ := vmLogin.Call() | ||||
| 	if res == 1 { | ||||
| 		runVoicemeeter(kind_id) | ||||
| 		runVoicemeeter(kindId) | ||||
| 		time.Sleep(time.Second) | ||||
| 	} else if res != 0 { | ||||
| 		err := fmt.Errorf("VBVMR_Login returned %d", res) | ||||
| @ -68,13 +68,13 @@ func logout() { | ||||
| } | ||||
| 
 | ||||
| // runVoicemeeter attempts to launch a Voicemeeter GUI of a kind. | ||||
| func runVoicemeeter(kind_id string) { | ||||
| func runVoicemeeter(kindId string) { | ||||
| 	vals := map[string]uint64{ | ||||
| 		"basic":  1, | ||||
| 		"banana": 2, | ||||
| 		"potato": 3, | ||||
| 	} | ||||
| 	res, _, _ := vmRunvm.Call(uintptr(vals[kind_id])) | ||||
| 	res, _, _ := vmRunvm.Call(uintptr(vals[kindId])) | ||||
| 	if res != 0 { | ||||
| 		err := fmt.Errorf("VBVMR_RunVoicemeeter returned %d", res) | ||||
| 		fmt.Println(err) | ||||
|  | ||||
| @ -15,22 +15,28 @@ func (c *command) setter(p string, v float32) { | ||||
| 	setParameterFloat(param, v) | ||||
| } | ||||
| 
 | ||||
| // Show shows the Voicemeete GUI if it's hidden | ||||
| func (c *command) Show() { | ||||
| 	c.setter("Show", 1) | ||||
| } | ||||
| 
 | ||||
| // Hide hides the Voicemeete GUI if it's shown | ||||
| func (c *command) Hide() { | ||||
| 	c.setter("Show", 0) | ||||
| } | ||||
| 
 | ||||
| // Shutdown shutdown the Voicemeeter GUI | ||||
| func (c *command) Shutdown() { | ||||
| 	c.setter("Shutdown", 1) | ||||
| } | ||||
| 
 | ||||
| // Restart restarts the Voicemeeter audio engine | ||||
| func (c *command) Restart() { | ||||
| 	c.setter("Restart", 1) | ||||
| } | ||||
| 
 | ||||
| // Lock locks or unlocks the Voiceemeter GUI | ||||
| // it accepts a boolean value | ||||
| func (c *command) Lock(val bool) { | ||||
| 	var value float32 | ||||
| 	if val { | ||||
|  | ||||
| @ -8,12 +8,7 @@ import ( | ||||
| // A kind represents a Voicemeeter kinds layout | ||||
| type kind struct { | ||||
| 	name                                              string | ||||
| 	physIn  int | ||||
| 	virtIn  int | ||||
| 	physOut int | ||||
| 	virtOut int | ||||
| 	vbanIn  int | ||||
| 	vbanOut int | ||||
| 	physIn, virtIn, physOut, virtOut, vbanIn, vbanOut int | ||||
| } | ||||
| 
 | ||||
| func (k *kind) numStrip() int { | ||||
| @ -44,3 +39,11 @@ func newBananaKind() *kind { | ||||
| func newPotatoKind() *kind { | ||||
| 	return &kind{"potato", 5, 3, 5, 3, 8, 8} | ||||
| } | ||||
| 
 | ||||
| var ( | ||||
| 	kindMap = map[string]*kind{ | ||||
| 		"basic":  newBasicKind(), | ||||
| 		"banana": newBananaKind(), | ||||
| 		"potato": newPotatoKind(), | ||||
| 	} | ||||
| ) | ||||
|  | ||||
| @ -43,16 +43,10 @@ func (r *remote) SendText(script string) { | ||||
| 
 | ||||
| // NewRemote returns a remote type of a kind, | ||||
| // this is the interface entry point. | ||||
| func NewRemote(kind_id string) *remote { | ||||
| 	kindMap := map[string]*kind{ | ||||
| 		"basic":  newBasicKind(), | ||||
| 		"banana": newBananaKind(), | ||||
| 		"potato": newPotatoKind(), | ||||
| 	} | ||||
| 
 | ||||
| 	_kind, ok := kindMap[kind_id] | ||||
| func NewRemote(kindId string) *remote { | ||||
| 	_kind, ok := kindMap[kindId] | ||||
| 	if !ok { | ||||
| 		err := fmt.Errorf("unknown Voicemeeter kind '%s'", kind_id) | ||||
| 		err := fmt.Errorf("unknown Voicemeeter kind '%s'", kindId) | ||||
| 		fmt.Println(err) | ||||
| 		os.Exit(1) | ||||
| 	} | ||||
|  | ||||
| @ -51,22 +51,22 @@ func (s *strip) SetMute(val bool) { | ||||
| 	s.setter_bool("Mute", val) | ||||
| } | ||||
| 
 | ||||
| // GetMono returns the value of the Mute parameter | ||||
| // GetMono returns the value of the Mono parameter | ||||
| func (s *strip) GetMono() bool { | ||||
| 	return s.getter_bool("Mono") | ||||
| } | ||||
| 
 | ||||
| // SetMono sets the value of the Mute parameter | ||||
| // SetMono sets the value of the Mono parameter | ||||
| func (s *strip) SetMono(val bool) { | ||||
| 	s.setter_bool("Mono", val) | ||||
| } | ||||
| 
 | ||||
| // GetSolo returns the value of the Mute parameter | ||||
| // GetSolo returns the value of the Solo parameter | ||||
| func (s *strip) GetSolo() bool { | ||||
| 	return s.getter_bool("Solo") | ||||
| } | ||||
| 
 | ||||
| // SetSolo sets the value of the Mute parameter | ||||
| // SetSolo sets the value of the Solo parameter | ||||
| func (s *strip) SetSolo(val bool) { | ||||
| 	s.setter_bool("Solo", val) | ||||
| } | ||||
| @ -81,12 +81,12 @@ func (s *strip) SetLimit(val int) { | ||||
| 	s.setter_int("Limit", val) | ||||
| } | ||||
| 
 | ||||
| // GetLabel returns the value of the MC parameter | ||||
| // GetLabel returns the value of the Label parameter | ||||
| func (s *strip) GetLabel() string { | ||||
| 	return s.getter_string("Label") | ||||
| } | ||||
| 
 | ||||
| // SetLabel sets the value of the MC parameter | ||||
| // SetLabel sets the value of the Label parameter | ||||
| func (s *strip) SetLabel(val string) { | ||||
| 	s.setter_string("Label", val) | ||||
| } | ||||
| @ -110,32 +110,32 @@ func newPhysicalStrip(i int, k *kind) t_strip { | ||||
| 	return t_strip(&ps) | ||||
| } | ||||
| 
 | ||||
| // GetComp returns the value of the Mute parameter | ||||
| // GetComp returns the value of the Comp parameter | ||||
| func (p *physicalStrip) GetComp() bool { | ||||
| 	return p.getter_bool("Comp") | ||||
| } | ||||
| 
 | ||||
| // SetComp sets the value of the Mute parameter | ||||
| // SetComp sets the value of the Comp parameter | ||||
| func (p *physicalStrip) SetComp(val bool) { | ||||
| 	p.setter_bool("Comp", val) | ||||
| } | ||||
| 
 | ||||
| // GetGate returns the value of the Mute parameter | ||||
| // GetGate returns the value of the Gate parameter | ||||
| func (p *physicalStrip) GetGate() bool { | ||||
| 	return p.getter_bool("Gate") | ||||
| } | ||||
| 
 | ||||
| // SetGate sets the value of the Mute parameter | ||||
| // SetGate sets the value of the Gate parameter | ||||
| func (p *physicalStrip) SetGate(val bool) { | ||||
| 	p.setter_bool("Gate", val) | ||||
| } | ||||
| 
 | ||||
| // GetAudibility returns the value of the Mute parameter | ||||
| // GetAudibility returns the value of the Audibility parameter | ||||
| func (p *physicalStrip) GetAudibility() bool { | ||||
| 	return p.getter_bool("Audibility") | ||||
| } | ||||
| 
 | ||||
| // SetAudibility sets the value of the Mute parameter | ||||
| // SetAudibility sets the value of the Audibility parameter | ||||
| func (p *physicalStrip) SetAudibility(val bool) { | ||||
| 	p.setter_bool("Audibility", val) | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user