class Crocket::SyncDevice
- Crocket::SyncDevice
- Reference
- Object
Defined in:
crocket/sync_device.crConstant Summary
-
DEFAULT_PORT =
Rocket::SYNC_DEFAULT_PORT
Constructors
-
.new(base : String)
Creates a new instance of
Crocket::SyncDevice
.
Class Method Summary
- .define_is_playing_callback(&callback : -> Bool)
- .define_pause_callback(&callback : Bool -> )
- .define_set_row_callback(&callback : Int32 -> )
Instance Method Summary
-
#[](name : String)
Alias for
#get_track
. - #base
-
#finalize
Properly destroys the allocated sync device.
-
#get_track(name : String)
Returns a track.
-
#save_tracks : Bool
Saves the tracks to disk.
-
#tcp_connect(hostname : String, port : UInt16 = DEFAULT_PORT) : Bool
Connects to the Rocket editor listening on hostname at port via TCP.
-
#to_unsafe : Pointer(Crocket::Rocket::SyncDevice)
#to_unsafe
returns the raw C pointer to this Rocketsync_device
struct. -
#update(row : Int32) : Bool
Tells Rocket that we've moved to another row
-
#update(row : Float) : Bool
Tells Rocket that we've moved to another row
Constructor Detail
Class Method Detail
Instance Method Detail
def tcp_connect(hostname : String, port : UInt16 = DEFAULT_PORT) : Bool
#
Connects to the Rocket editor listening on hostname at port via TCP.
def to_unsafe : Pointer(Crocket::Rocket::SyncDevice)
#
#to_unsafe
returns the raw C pointer to this Rocket sync_device
struct.
Useful for when you need to call the library functions directly.
For example:
device = Crocket::SyncDevice.new("sync")
callbacks = Crocket::Rocket::SyncCb.new(
pause: ->(d : Void*, flag : Int32) {},
# ...
)
# ...
loop do
row = get_current_row(some_audio_context)
Crocket::Rocket.sync_update(device, row.floor, pointerof(callbacks), nil)
end
def update(row : Float) : Bool
#
Tells Rocket that we've moved to another row
Lazy shortcut for
device.update(row.floor.to_i)