add soft cut duration flag

This commit is contained in:
filifa 2024-09-07 20:43:46 -05:00
parent ebb4d7102b
commit d13abec803
2 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import (
)
var transition bool
var softCutDuration float64
/*
* checkStdin checks if any data has been passed in through stdin and returns
@ -156,7 +157,7 @@ func milkbucket(cmd *cobra.Command, args []string) {
}
defer sdl.Quit()
m, err := newMilkDropWindow(800, 600, args)
m, err := newMilkDropWindow(800, 600, args, softCutDuration)
if err != nil {
cobra.CheckErr(err)
}
@ -203,4 +204,5 @@ func init() {
// Cobra also supports local flags, which will only run
// when this action is called directly.
rootCmd.Flags().BoolVarP(&transition, "transition", "t", false, "smoothly transition between presets")
rootCmd.Flags().Float64VarP(&softCutDuration, "soft-cut-duration", "s", 3, "time in seconds for a soft transition between two presets (use with --transition)")
}

View File

@ -88,7 +88,7 @@ func (m *milkDropWindow) prevPreset(smooth bool) {
* newMilkDropWindow returns a new milkDropWindow with the given width and
* height, and sets presets available to the window.
*/
func newMilkDropWindow(width, height int32, presets []string) (*milkDropWindow, error) {
func newMilkDropWindow(width, height int32, presets []string, softCutDuration float64) (*milkDropWindow, error) {
var m milkDropWindow
var err error
@ -111,6 +111,8 @@ func newMilkDropWindow(width, height int32, presets []string) (*milkDropWindow,
C.projectm_set_window_size(m.handle, C.ulong(width), C.ulong(height))
C.projectm_set_soft_cut_duration(m.handle, C.double(softCutDuration))
return &m, nil
}