mirror of
https://github.com/onyx-and-iris/xair-cli.git
synced 2026-02-04 07:27:47 +00:00
read duration as float64
This commit is contained in:
parent
733955c7d2
commit
102e276100
13
cmd/main.go
13
cmd/main.go
@ -128,7 +128,7 @@ This command will fade out the main output to the specified dB level.
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
duration, err := cmd.Flags().GetInt("duration")
|
duration, err := cmd.Flags().GetFloat64("duration")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.PrintErrln("Error getting duration flag:", err)
|
cmd.PrintErrln("Error getting duration flag:", err)
|
||||||
return
|
return
|
||||||
@ -147,7 +147,7 @@ This command will fade out the main output to the specified dB level.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate total steps needed to reach target dB
|
// Calculate total steps needed to reach target dB
|
||||||
totalSteps := int(currentFader - target)
|
totalSteps := float64(currentFader - target)
|
||||||
if totalSteps <= 0 {
|
if totalSteps <= 0 {
|
||||||
cmd.Println("Main output is already faded out")
|
cmd.Println("Main output is already faded out")
|
||||||
return
|
return
|
||||||
@ -188,7 +188,7 @@ This command will fade in the main output to the specified dB level.
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
duration, err := cmd.Flags().GetInt("duration")
|
duration, err := cmd.Flags().GetFloat64("duration")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.PrintErrln("Error getting duration flag:", err)
|
cmd.PrintErrln("Error getting duration flag:", err)
|
||||||
return
|
return
|
||||||
@ -206,7 +206,7 @@ This command will fade in the main output to the specified dB level.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate total steps needed to reach target dB
|
// Calculate total steps needed to reach target dB
|
||||||
totalSteps := int(target - currentFader)
|
totalSteps := float64(target - currentFader)
|
||||||
if totalSteps <= 0 {
|
if totalSteps <= 0 {
|
||||||
cmd.Println("Main output is already at or above target level")
|
cmd.Println("Main output is already at or above target level")
|
||||||
return
|
return
|
||||||
@ -230,11 +230,12 @@ This command will fade in the main output to the specified dB level.
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(mainCmd)
|
rootCmd.AddCommand(mainCmd)
|
||||||
|
|
||||||
mainCmd.AddCommand(mainMuteCmd)
|
mainCmd.AddCommand(mainMuteCmd)
|
||||||
|
|
||||||
mainCmd.AddCommand(mainFaderCmd)
|
mainCmd.AddCommand(mainFaderCmd)
|
||||||
mainCmd.AddCommand(mainFadeOutCmd)
|
mainCmd.AddCommand(mainFadeOutCmd)
|
||||||
mainFadeOutCmd.Flags().IntP("duration", "d", 5, "Duration for fade out in seconds")
|
mainFadeOutCmd.Flags().Float64P("duration", "d", 5, "Duration for fade out in seconds")
|
||||||
mainCmd.AddCommand(mainFadeInCmd)
|
mainCmd.AddCommand(mainFadeInCmd)
|
||||||
mainFadeInCmd.Flags().IntP("duration", "d", 5, "Duration for fade in in seconds")
|
mainFadeInCmd.Flags().Float64P("duration", "d", 5, "Duration for fade in in seconds")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user