Class: MusaLCEServer::Bitwig::Tracks Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bitwig/tracks.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Collection of tracks for Bitwig.

Tracks are created dynamically based on channel names received from the Bitwig controller extension.

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(logger:) ⇒ Tracks

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new tracks collection.

Parameters:

  • logger (Logger)

    the logger

Since:

  • 0.1.0



17
18
19
20
# File 'lib/bitwig/tracks.rb', line 17

def initialize(logger:)
  @logger = logger
  @tracks = {}
end

Instance Method Details

#[](name) ⇒ Track?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Retrieves a track by name.

Parameters:

  • name (String)

    the track name

Returns:

  • (Track, nil)

    the track or nil if not found

Since:

  • 0.1.0



46
47
48
# File 'lib/bitwig/tracks.rb', line 46

def [](name)
  @tracks[name]
end

#[]=(name, track) ⇒ Track

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sets a track by name.

Parameters:

  • name (String)

    the track name

  • track (Track)

    the track

Returns:

Since:

  • 0.1.0



55
56
57
# File 'lib/bitwig/tracks.rb', line 55

def []=(name, track)
  @tracks[name] = track
end

#create(name) ⇒ Track

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new track with the given name.

Parameters:

  • name (String)

    the track name

Returns:

  • (Track)

    the created track

Since:

  • 0.1.0



26
27
28
# File 'lib/bitwig/tracks.rb', line 26

def create(name)
  @tracks[name] = Track.new(name, logger: @logger)
end

#each {|Track| ... } ⇒ Enumerator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Iterates over all tracks.

Yields:

Returns:

  • (Enumerator)

    if no block given

Since:

  • 0.1.0



34
35
36
37
38
39
40
# File 'lib/bitwig/tracks.rb', line 34

def each(&block)
  if block_given?
    @tracks.values.each(&block)
  else
    @tracks.values.each
  end
end