Skip to content

Commit

Permalink
refactor DspxAudioClipContext
Browse files Browse the repository at this point in the history
  • Loading branch information
CrSjimo committed Oct 27, 2024
1 parent b0f7b66 commit 0c8ff8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
15 changes: 2 additions & 13 deletions src/dspx/DspxAudioClipContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace talcs {
clipMixer->prependSource(contentSource.get());
}

bool DspxAudioClipContext::setPathLoad(const QString &path, const QVariant &data) {
bool DspxAudioClipContext::setPathLoad(const QString &path, const QVariant &data, const QString &entryClassName) {
Q_D(DspxAudioClipContext);
auto formatManager = d->trackContext->projectContext()->formatManager();
if (!formatManager)
Expand All @@ -129,19 +129,8 @@ namespace talcs {
return true;
}

bool DspxAudioClipContext::setPathOpen(const QString &path, const QString &filter, QVariant &data, QWidget *win) {
bool DspxAudioClipContext::setPathOpen(const QString &path, AbstractAudioFormatIO *io) {
Q_D(DspxAudioClipContext);
auto formatManager = d->trackContext->projectContext()->formatManager();
if (!formatManager)
return false;
AbstractAudioFormatIO *io = nullptr;
for (auto entry : formatManager->entries()) {
if (filter.isEmpty() || entry->filters().contains(filter)) {
io = entry->getFormatOpen(path, data, win);
if (io)
break;
}
}
if (!io)
return false;
d->handleIO(io);
Expand Down
5 changes: 3 additions & 2 deletions src/dspx/DspxAudioClipContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace talcs {

class PositionableMixerAudioSource;
class BufferingAudioSource;
class AbstractAudioFormatIO;

class DspxTrackContext;

Expand Down Expand Up @@ -56,8 +57,8 @@ namespace talcs {
void setClipLen(int tick);
int clipLen() const;

bool setPathLoad(const QString &path, const QVariant &data = {});
bool setPathOpen(const QString &path, const QString &selectedFilter, QVariant &data, QWidget *win);
bool setPathLoad(const QString &path, const QVariant &data = {}, const QString &entryClassName = {});
bool setPathOpen(const QString &path, AbstractAudioFormatIO *io);
QString path() const;

void updatePosition();
Expand Down

0 comments on commit 0c8ff8c

Please sign in to comment.