class Crocket::SyncDevice

Defined in:

crocket/sync_device.cr

Constant Summary

DEFAULT_PORT = Rocket::SYNC_DEFAULT_PORT

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(base : String) #

Creates a new instance of Crocket::SyncDevice.


[View source]

Class Method Detail

def self.define_is_playing_callback(&callback : -> Bool) #

[View source]
def self.define_pause_callback(&callback : Bool -> ) #

[View source]
def self.define_set_row_callback(&callback : Int32 -> ) #

[View source]

Instance Method Detail

def [](name : String) #

Alias for #get_track.


[View source]
def base #

[View source]
def finalize #

Properly destroys the allocated sync device.


[View source]
def get_track(name : String) #

Returns a track.


[View source]
def save_tracks : Bool #

Saves the tracks to disk.


[View source]
def tcp_connect(hostname : String, port : UInt16 = DEFAULT_PORT) : Bool #

Connects to the Rocket editor listening on hostname at port via TCP.


[View source]
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

[View source]
def update(row : Int32) : Bool #

Tells Rocket that we've moved to another row


[View source]
def update(row : Float) : Bool #

Tells Rocket that we've moved to another row

Lazy shortcut for

  device.update(row.floor.to_i)

[View source]