Skip to content

Commit

Permalink
Display Channels by tracks in main UI
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed Jul 30, 2024
1 parent 2746093 commit f836e6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/core/channels/channelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ChannelManager::ChannelManager(model::Model& model, MidiMapper<KernelMidi>& m, A

Channel& ChannelManager::getChannel(ID channelId)
{
return m_model.get().columns.getChannel(channelId);
return m_model.get().tracks.getChannel(channelId);
}

/* -------------------------------------------------------------------------- */
Expand Down
23 changes: 12 additions & 11 deletions src/glue/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ void printLoadError_(int res)

/* -------------------------------------------------------------------------- */

Data makeData_(ID channelId, const v::Model::Column& column)
Data makeData_(ID channelId, const m::model::Track& modelTrack)
{
const int position = column.getChannelIndex(channelId);
const int columnIndex = column.index;
return Data(g_engine->getChannelsApi().get(channelId), columnIndex, position);
const std::size_t channelIndex = modelTrack.getChannelIndex(channelId);
const std::size_t columnIndex = modelTrack.getIndex();
return Data(g_engine->getChannelsApi().get(channelId), columnIndex, channelIndex);
}

/* -------------------------------------------------------------------------- */

Column makeColumn_(const v::Model::Column& modelColumn)
Column makeColumn_(const m::model::Track& modelTrack)
{
Column column{modelColumn.index, modelColumn.width, {}};
Column column{static_cast<int>(modelTrack.getIndex()), modelTrack.width, {}};

for (const ID channelId : modelColumn.channels)
column.channels.push_back(makeData_(channelId, modelColumn));
for (const m::Channel& channel : modelTrack.getChannels().getAll())
column.channels.push_back(makeData_(channel.id, modelTrack));

return column;
}
Expand Down Expand Up @@ -153,14 +153,15 @@ bool Data::isArmed() const { return g_engine->getChannelsApi().get(id).

Data getData(ID channelId)
{
return makeData_(channelId, g_ui->model.columns.getColumnByChannelId(channelId));
return makeData_(channelId, g_engine->getChannelsApi().getTracks().getByChannel(channelId));
}

std::vector<Column> getColumns()
{
std::vector<Column> out;
for (const v::Model::Column& modelColumn : g_ui->model.columns.getAll()) // Model::columns is the source of truth
out.push_back(makeColumn_(modelColumn));
for (const m::model::Track& modelTrack : g_engine->getChannelsApi().getTracks().getAll())
if (!modelTrack.isInternal())
out.push_back(makeColumn_(modelTrack));
return out;
}

Expand Down

0 comments on commit f836e6a

Please sign in to comment.