Skip to content

Commit

Permalink
fixed audio clip editor
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Aug 2, 2023
1 parent 68b2f03 commit aa646a5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
8 changes: 6 additions & 2 deletions src/audio/editor/audio_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ struct AssetBrowserPlugin final : AssetBrowser::Plugin, AssetCompiler::IPlugin {
}

~EditorWindow() {
stopAudio();
m_resource->decRefCount();
}

void save() {
//Span<const u8> data((const u8*)m_buffer.getData(), m_buffer.length());
//m_app.getAssetBrowser().saveResource(*m_resource, data);
AssetCompiler& compiler = m_app.getAssetCompiler();
const StaticString<512> src("looped = ", m_meta.looped ? "true" : "false"
, "\nvolume = ", m_meta.volume
);
compiler.updateMeta(m_resource->getPath(), src);
m_dirty = false;
}

Expand Down
7 changes: 0 additions & 7 deletions src/editor/asset_browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ AssetBrowser::ResourceView& AssetBrowser::Plugin::createView(const Path& path, S
struct View : ResourceView {
const struct Path& getPath() override { return resource->getPath(); }
struct ResourceType getType() override { return resource->getType(); }
bool isEmpty() override { return resource->isEmpty(); }
bool isReady() override { return resource->isReady(); }
bool isFailure() override { return resource->isFailure(); }
u64 size() override { return resource->size(); }
void destroy() override { LUMIX_DELETE(*allocator, this); }
Resource* getResource() override { return resource; }

Expand Down Expand Up @@ -257,9 +253,6 @@ struct AssetBrowserImpl : AssetBrowser {
if (m_selected_resources.empty()) return;

for (ResourceView* res : m_selected_resources) {
for (auto* plugin : m_plugins) {
plugin->onResourceUnloaded(*res);
}
res->destroy();
}

Expand Down
6 changes: 0 additions & 6 deletions src/editor/asset_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ struct LUMIX_EDITOR_API AssetBrowser : StudioApp::GUIPlugin {
virtual ~ResourceView() {}
virtual const struct Path& getPath() = 0;
virtual struct ResourceType getType() = 0;
virtual bool isEmpty() = 0;
virtual bool isReady() = 0;
virtual bool isFailure() = 0;
virtual u64 size() = 0;
virtual void destroy() = 0;
virtual struct Resource* getResource() = 0;
};
Expand All @@ -31,14 +27,12 @@ struct LUMIX_EDITOR_API AssetBrowser : StudioApp::GUIPlugin {
virtual void createResource(OutputMemoryStream& content) {}
virtual const char* getDefaultExtension() const { return ""; }

virtual void onResourceUnloaded(ResourceView& resource) {}
virtual const char* getName() const = 0;
virtual ResourceType getResourceType() const = 0;
virtual bool createTile(const char* in_path, const char* out_path, ResourceType type);
virtual void update() {}
virtual ResourceView& createView(const Path& path, StudioApp& app);
virtual void onResourceDoubleClicked(const Path& path) {}

};

static UniquePtr<AssetBrowser> create(struct StudioApp& app);
Expand Down
4 changes: 0 additions & 4 deletions src/editor/editor_asset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ AssetBrowser::ResourceView& EditorAssetPlugin::createView(const Path& path, Stud

const struct Path& getPath() override { return m_path; }
struct ResourceType getType() override { return m_type; }
bool isEmpty() override { return false; }
bool isReady() override { return true; }
bool isFailure() override { return false; }
u64 size() override { return 0; }
void destroy() override { LUMIX_DELETE(m_allocator, this); }
Resource* getResource() override { ASSERT(false); return nullptr; }

Expand Down

0 comments on commit aa646a5

Please sign in to comment.