mirror of
				https://github.com/onyx-and-iris/voicemeeter.git
				synced 2025-11-03 23:31:45 +00:00 
			
		
		
		
	run o.Listen() in goroutine.
run main thread for 30 seconds
This commit is contained in:
		
							parent
							
								
									a846c59e72
								
							
						
					
					
						commit
						632cd9049f
					
				@ -2,6 +2,7 @@ package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	log "github.com/sirupsen/logrus"
 | 
			
		||||
 | 
			
		||||
@ -16,8 +17,7 @@ type observer struct {
 | 
			
		||||
 | 
			
		||||
// newObserver returns an observer type
 | 
			
		||||
func newObserver(vm *voicemeeter.Remote) *observer {
 | 
			
		||||
	o := &observer{vm, make(chan string)}
 | 
			
		||||
	return o
 | 
			
		||||
	return &observer{vm, make(chan string)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OnUpdate satisfies the observer interface defined in publisher.go
 | 
			
		||||
@ -49,7 +49,7 @@ func init() {
 | 
			
		||||
 | 
			
		||||
func runObserver(vm *voicemeeter.Remote) {
 | 
			
		||||
	o := newObserver(vm)
 | 
			
		||||
	o.Listen()
 | 
			
		||||
	go o.Listen()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// main connects to Voiceemeter, registers observer for updates
 | 
			
		||||
@ -62,6 +62,8 @@ func main() {
 | 
			
		||||
	defer vm.Logout()
 | 
			
		||||
 | 
			
		||||
	runObserver(vm)
 | 
			
		||||
 | 
			
		||||
	time.Sleep(time.Duration(30) * time.Second)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// vmConnect connects to Voicemeeter potato and logs into the API
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user