Solved:
------
use_playlist = ref false
server.register(namespace="vars", "use_playlist", fun (s) -> begin
use_playlist := (s == "true") string_of(!use_playlist) end)
src = switch([
({ !use_playlist }, playlist_source),
({ true }, normal_source)
])
------
On Sat, Jul 9, 2016 at 3:06 PM, Robert McAuley <[email protected]> wrote:
> Hey everyone, I'm trying to use a switch to play a song set by an
> interactive variable with:
>
> - The first source is an MP3 filename provided by an interactive variable
> - When the first source is playing it should be track_sensitive=False
>
> Here's what I have but I clearly have no idea what I'm doing because I am
> getting errors I simply don't understand. All sorts of type errors and
> scope errors.
>
> ------------
>
> r4_hold = interactive.bool("hold", false)
> r4_hold_mp3 = interactive.string("hold_mp3",
> "C:/Users/rmcauley/Documents/Sounds/Pendual
> Loop.flac")
> r4_track_sensitive = true
>
> # this works OK
> def r4_request() =
> r4_track_sensitive = true
> result =
> get_process_output('C:/Users/rmcauley/Documents/GitHub/rainwave/rw_get_next.py
> --sid ' ^ r4_sid)
> request.create(result)
> end
>
> def r4_get_hold() =
> r4_hold()
> end
>
> def r4_get_hold_mp3() =
> r4_track_sensitive = false
> single(r4_hold_mp3())
> end
>
> def r4_get_track_sensitive() =
> r4_track_sensitive
> end
>
> r4_source = request.dynamic(r4_request, length=6.0, conservative=false)
>
> r4_auto = switch([
> ({ r4_get_hold }, r4_get_hold_mp3),
> ({ true }, r4_source)
> ], track_sensitive=r4_get_track_sensitive)
>
> r4_offline = single(r4_offline_file)
>
> r4_auto = fallback([r4_auto, r4_offline], track_sensitive=false)
>
> ---------
>
> The first error is:
>
> ------
>
> At ././_rainwave.liq.util, line 58, char 2-22:
> this value has type
> (((...)->bool)*_)
> but it should be a subtype of (the type of the value at
> ././_rainwave.liq.util, line 57, char 2-35)
> (((...)->()->_)*_)
>
> ------
>
> The more I try to resolve this the deeper and deeper into other "should be
> of subtype ____" issues I run into, and the more I just don't understand.
>
> Any help?
>
> - Rob
>
------------------------------------------------------------------------------
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users