mirror of
https://github.com/AxioDL/amuse.git
synced 2025-12-08 13:14:58 +00:00
Working Studio implementation
This commit is contained in:
@@ -6,42 +6,153 @@
|
||||
namespace amuse
|
||||
{
|
||||
|
||||
static const wchar_t *const GMNames[128] =
|
||||
{
|
||||
L"Acoustic Grand Piano", L"Bright Acoustic Piano", L"Electric Grand Piano", L"Honky-tonk Piano", L"Rhodes Piano", L"Chorused Piano",
|
||||
L"Harpsichord", L"Clavinet", L"Celesta", L"Glockenspiel", L"Music Box", L"Vibraphone", L"Marimba", L"Xylophone", L"Tubular Bells", L"Dulcimer",
|
||||
L"Drawbar Organ", L"Percussive Organ", L"Rock Organ", L"Church Organ", L"Reed Organ", L"Accordion", L"Harmonica", L"Tango Accordion",
|
||||
L"Acoustic Guitar (nylon)", L"Acoustic Guitar (steel)", L"Electric Guitar (jazz)", L"Electric Guitar (clean)", L"Electric Guitar (muted)",
|
||||
L"Overdriven Guitar", L"Distortion Guitar", L"Guitar Harmonics", L"Acoustic Bass", L"Electric Bass (finger)", L"Electric Bass (pick)",
|
||||
L"Fretless Bass", L"Slap Bass 1", L"Slap Bass 2", L"Synth Bass 1", L"Synth Bass 2", L"Violin", L"Viola", L"Cello", L"Contrabass",
|
||||
L"Tremelo Strings", L"Pizzicato Strings", L"Orchestral Harp", L"Timpani", L"String Ensemble 1", L"String Ensemble 2", L"SynthStrings 1",
|
||||
L"SynthStrings 2", L"Choir Aahs", L"Voice Oohs", L"Synth Voice", L"Orchestra Hit", L"Trumpet", L"Trombone", L"Tuba", L"Muted Trumpet",
|
||||
L"French Horn", L"Brass Section", L"Synth Brass 1", L"Synth Brass 2", L"Soprano Sax", L"Alto Sax", L"Tenor Sax", L"Baritone Sax",
|
||||
L"Oboe", L"English Horn", L"Bassoon", L"Clarinet", L"Piccolo", L"Flute", L"Recorder", L"Pan Flute", L"Bottle Blow", L"Shakuhachi", L"Whistle",
|
||||
L"Ocarina", L"Lead 1 (square)", L"Lead 2 (sawtooth)", L"Lead 3 (calliope lead)", L"Lead 4 (chiff lead)", L"Lead 5 (charang)",
|
||||
L"Lead 6 (voice)", L"Lead 7 (fifths)", L"Lead 8 (bass + lead)", L"Pad 1 (new age)", L"Pad 2 (warm)", L"Pad 3 (polysynth)", L"Pad 4 (choir)",
|
||||
L"Pad 5 (bowed)", L"Pad 6 (metallic)", L"Pad 7 (halo)", L"Pad 8 (sweep)", L"FX 1 (rain)", L"FX 2 (soundtrack)", L"FX 3 (crystal)",
|
||||
L"FX 4 (atmosphere)", L"FX 5 (brightness)", L"FX 6 (goblins)", L"FX 7 (echoes)", L"FX 8 (sci-fi)", L"Sitar", L"Banjo", L"Shamisen", L"Koto",
|
||||
L"Kalimba", L"Bagpipe", L"Fiddle", L"Shanai", L"Tinkle Bell", L"Agogo", L"Steel Drums", L"Woodblock", L"Taiko Drum", L"Melodic Tom",
|
||||
L"Synth Drum", L"Reverse Cymbal", L"Guitar Fret Noise", L"Breath Noise", L"Seashore", L"Bird Tweet", L"Telephone Ring", L"Helicopter",
|
||||
L"Applause", L"Gunshot"
|
||||
};
|
||||
static const wchar_t* const GMNames[128] = {L"Acoustic Grand Piano",
|
||||
L"Bright Acoustic Piano",
|
||||
L"Electric Grand Piano",
|
||||
L"Honky-tonk Piano",
|
||||
L"Rhodes Piano",
|
||||
L"Chorused Piano",
|
||||
L"Harpsichord",
|
||||
L"Clavinet",
|
||||
L"Celesta",
|
||||
L"Glockenspiel",
|
||||
L"Music Box",
|
||||
L"Vibraphone",
|
||||
L"Marimba",
|
||||
L"Xylophone",
|
||||
L"Tubular Bells",
|
||||
L"Dulcimer",
|
||||
L"Drawbar Organ",
|
||||
L"Percussive Organ",
|
||||
L"Rock Organ",
|
||||
L"Church Organ",
|
||||
L"Reed Organ",
|
||||
L"Accordion",
|
||||
L"Harmonica",
|
||||
L"Tango Accordion",
|
||||
L"Acoustic Guitar (nylon)",
|
||||
L"Acoustic Guitar (steel)",
|
||||
L"Electric Guitar (jazz)",
|
||||
L"Electric Guitar (clean)",
|
||||
L"Electric Guitar (muted)",
|
||||
L"Overdriven Guitar",
|
||||
L"Distortion Guitar",
|
||||
L"Guitar Harmonics",
|
||||
L"Acoustic Bass",
|
||||
L"Electric Bass (finger)",
|
||||
L"Electric Bass (pick)",
|
||||
L"Fretless Bass",
|
||||
L"Slap Bass 1",
|
||||
L"Slap Bass 2",
|
||||
L"Synth Bass 1",
|
||||
L"Synth Bass 2",
|
||||
L"Violin",
|
||||
L"Viola",
|
||||
L"Cello",
|
||||
L"Contrabass",
|
||||
L"Tremelo Strings",
|
||||
L"Pizzicato Strings",
|
||||
L"Orchestral Harp",
|
||||
L"Timpani",
|
||||
L"String Ensemble 1",
|
||||
L"String Ensemble 2",
|
||||
L"SynthStrings 1",
|
||||
L"SynthStrings 2",
|
||||
L"Choir Aahs",
|
||||
L"Voice Oohs",
|
||||
L"Synth Voice",
|
||||
L"Orchestra Hit",
|
||||
L"Trumpet",
|
||||
L"Trombone",
|
||||
L"Tuba",
|
||||
L"Muted Trumpet",
|
||||
L"French Horn",
|
||||
L"Brass Section",
|
||||
L"Synth Brass 1",
|
||||
L"Synth Brass 2",
|
||||
L"Soprano Sax",
|
||||
L"Alto Sax",
|
||||
L"Tenor Sax",
|
||||
L"Baritone Sax",
|
||||
L"Oboe",
|
||||
L"English Horn",
|
||||
L"Bassoon",
|
||||
L"Clarinet",
|
||||
L"Piccolo",
|
||||
L"Flute",
|
||||
L"Recorder",
|
||||
L"Pan Flute",
|
||||
L"Bottle Blow",
|
||||
L"Shakuhachi",
|
||||
L"Whistle",
|
||||
L"Ocarina",
|
||||
L"Lead 1 (square)",
|
||||
L"Lead 2 (sawtooth)",
|
||||
L"Lead 3 (calliope lead)",
|
||||
L"Lead 4 (chiff lead)",
|
||||
L"Lead 5 (charang)",
|
||||
L"Lead 6 (voice)",
|
||||
L"Lead 7 (fifths)",
|
||||
L"Lead 8 (bass + lead)",
|
||||
L"Pad 1 (new age)",
|
||||
L"Pad 2 (warm)",
|
||||
L"Pad 3 (polysynth)",
|
||||
L"Pad 4 (choir)",
|
||||
L"Pad 5 (bowed)",
|
||||
L"Pad 6 (metallic)",
|
||||
L"Pad 7 (halo)",
|
||||
L"Pad 8 (sweep)",
|
||||
L"FX 1 (rain)",
|
||||
L"FX 2 (soundtrack)",
|
||||
L"FX 3 (crystal)",
|
||||
L"FX 4 (atmosphere)",
|
||||
L"FX 5 (brightness)",
|
||||
L"FX 6 (goblins)",
|
||||
L"FX 7 (echoes)",
|
||||
L"FX 8 (sci-fi)",
|
||||
L"Sitar",
|
||||
L"Banjo",
|
||||
L"Shamisen",
|
||||
L"Koto",
|
||||
L"Kalimba",
|
||||
L"Bagpipe",
|
||||
L"Fiddle",
|
||||
L"Shanai",
|
||||
L"Tinkle Bell",
|
||||
L"Agogo",
|
||||
L"Steel Drums",
|
||||
L"Woodblock",
|
||||
L"Taiko Drum",
|
||||
L"Melodic Tom",
|
||||
L"Synth Drum",
|
||||
L"Reverse Cymbal",
|
||||
L"Guitar Fret Noise",
|
||||
L"Breath Noise",
|
||||
L"Seashore",
|
||||
L"Bird Tweet",
|
||||
L"Telephone Ring",
|
||||
L"Helicopter",
|
||||
L"Applause",
|
||||
L"Gunshot"};
|
||||
|
||||
static const wchar_t *const GMPercNames[128] =
|
||||
{
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, L"Acoustic Bass Drum", L"Bass Drum 1", L"Side Stick",
|
||||
L"Acoustic Snare", L"Hand Clap", L"Electric Snare", L"Low Floor Tom", L"Closed Hi-Hat",
|
||||
L"High Floor Tom", L"Pedal Hi-Hat", L"Low Tom", L"Open Hi-Hat", L"Low-Mid Tom", L"Hi-Mid Tom",
|
||||
L"Crash Cymbal 1", L"High Tom", L"Ride Cymbal 1", L"Chinese Cymbal", L"Ride Bell", L"Tambourine",
|
||||
L"Splash Cymbal", L"Cowbell", L"Crash Cymbal 2", L"Vibraslap", L"Ride Cymbal 2", L"Hi Bongo",
|
||||
L"Low Bongo", L"Mute Hi Conga", L"Open Hi Conga", L"Low Conga", L"High Timbale", L"Low Timbale",
|
||||
L"High Agogo", L"Low Agogo", L"Cabasa", L"Maracas", L"Short Whistle", L"Long Whistle", L"Short Guiro",
|
||||
L"Long Guiro", L"Claves", L"Hi Wood Block", L"Low Wood Block", L"Mute Cuica", L"Open Cuica",
|
||||
L"Mute Triangle", L"Open Triangle"
|
||||
};
|
||||
static const wchar_t* const GMPercNames[128] = {
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, L"Acoustic Bass Drum",
|
||||
L"Bass Drum 1", L"Side Stick", L"Acoustic Snare", L"Hand Clap", L"Electric Snare",
|
||||
L"Low Floor Tom", L"Closed Hi-Hat", L"High Floor Tom", L"Pedal Hi-Hat", L"Low Tom",
|
||||
L"Open Hi-Hat", L"Low-Mid Tom", L"Hi-Mid Tom", L"Crash Cymbal 1", L"High Tom",
|
||||
L"Ride Cymbal 1", L"Chinese Cymbal", L"Ride Bell", L"Tambourine", L"Splash Cymbal",
|
||||
L"Cowbell", L"Crash Cymbal 2", L"Vibraslap", L"Ride Cymbal 2", L"Hi Bongo",
|
||||
L"Low Bongo", L"Mute Hi Conga", L"Open Hi Conga", L"Low Conga", L"High Timbale",
|
||||
L"Low Timbale", L"High Agogo", L"Low Agogo", L"Cabasa", L"Maracas",
|
||||
L"Short Whistle", L"Long Whistle", L"Short Guiro", L"Long Guiro", L"Claves",
|
||||
L"Hi Wood Block", L"Low Wood Block", L"Mute Cuica", L"Open Cuica", L"Mute Triangle",
|
||||
L"Open Triangle"};
|
||||
|
||||
bool AudioGroupDataCollection::loadProj()
|
||||
{
|
||||
@@ -109,7 +220,6 @@ bool AudioGroupDataCollection::loadMeta()
|
||||
AudioGroupDataCollection::AudioGroupDataCollection(const std::wstring& path, const std::wstring& name)
|
||||
: m_path(path), m_name(name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool AudioGroupDataCollection::_attemptLoad()
|
||||
@@ -134,28 +244,22 @@ bool AudioGroupDataCollection::_indexData()
|
||||
{
|
||||
switch (m_metaData->fmt)
|
||||
{
|
||||
case amuse::DataFormat::GCN:
|
||||
default:
|
||||
m_loadedData.emplace(m_projData.data(), m_projData.size(),
|
||||
m_poolData.data(), m_poolData.size(),
|
||||
m_sdirData.data(), m_sdirData.size(),
|
||||
m_sampData.data(), m_sampData.size(),
|
||||
amuse::GCNDataTag{});
|
||||
break;
|
||||
case amuse::DataFormat::N64:
|
||||
m_loadedData.emplace(m_projData.data(), m_projData.size(),
|
||||
m_poolData.data(), m_poolData.size(),
|
||||
m_sdirData.data(), m_sdirData.size(),
|
||||
m_sampData.data(), m_sampData.size(),
|
||||
m_metaData->absOffs, amuse::N64DataTag{});
|
||||
break;
|
||||
case amuse::DataFormat::PC:
|
||||
m_loadedData.emplace(m_projData.data(), m_projData.size(),
|
||||
m_poolData.data(), m_poolData.size(),
|
||||
m_sdirData.data(), m_sdirData.size(),
|
||||
m_sampData.data(), m_sampData.size(),
|
||||
m_metaData->absOffs, amuse::PCDataTag{});
|
||||
break;
|
||||
case amuse::DataFormat::GCN:
|
||||
default:
|
||||
m_loadedData.emplace(m_projData.data(), m_projData.size(), m_poolData.data(), m_poolData.size(),
|
||||
m_sdirData.data(), m_sdirData.size(), m_sampData.data(), m_sampData.size(),
|
||||
amuse::GCNDataTag{});
|
||||
break;
|
||||
case amuse::DataFormat::N64:
|
||||
m_loadedData.emplace(m_projData.data(), m_projData.size(), m_poolData.data(), m_poolData.size(),
|
||||
m_sdirData.data(), m_sdirData.size(), m_sampData.data(), m_sampData.size(),
|
||||
m_metaData->absOffs, amuse::N64DataTag{});
|
||||
break;
|
||||
case amuse::DataFormat::PC:
|
||||
m_loadedData.emplace(m_projData.data(), m_projData.size(), m_poolData.data(), m_poolData.size(),
|
||||
m_sdirData.data(), m_sdirData.size(), m_sampData.data(), m_sampData.size(),
|
||||
m_metaData->absOffs, amuse::PCDataTag{});
|
||||
break;
|
||||
}
|
||||
|
||||
return m_loadedData.operator bool();
|
||||
@@ -189,18 +293,15 @@ void AudioGroupDataCollection::addToEngine(amuse::Engine& engine)
|
||||
}
|
||||
}
|
||||
|
||||
void AudioGroupDataCollection::removeFromEngine(amuse::Engine& engine) const
|
||||
{
|
||||
engine.removeAudioGroup(*m_loadedData);
|
||||
}
|
||||
void AudioGroupDataCollection::removeFromEngine(amuse::Engine& engine) const { engine.removeAudioGroup(*m_loadedData); }
|
||||
|
||||
AudioGroupCollection::AudioGroupCollection(const std::wstring& path, const std::wstring& name)
|
||||
: m_path(path), m_name(name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AudioGroupCollection::addCollection(std::vector<std::pair<std::wstring, amuse::IntrusiveAudioGroupData>>&& collection)
|
||||
void AudioGroupCollection::addCollection(
|
||||
std::vector<std::pair<std::wstring, amuse::IntrusiveAudioGroupData>>&& collection)
|
||||
{
|
||||
for (std::pair<std::wstring, amuse::IntrusiveAudioGroupData>& pair : collection)
|
||||
{
|
||||
@@ -210,9 +311,9 @@ void AudioGroupCollection::addCollection(std::vector<std::pair<std::wstring, amu
|
||||
auto search = m_groups.find(pair.first);
|
||||
if (search == m_groups.end())
|
||||
{
|
||||
search = m_groups.emplace(pair.first,
|
||||
std::make_unique<AudioGroupDataCollection>(collectionPath,
|
||||
pair.first)).first;
|
||||
search =
|
||||
m_groups.emplace(pair.first, std::make_unique<AudioGroupDataCollection>(collectionPath, pair.first))
|
||||
.first;
|
||||
}
|
||||
|
||||
AudioGroupDataCollection& dataCollection = *search->second;
|
||||
@@ -253,9 +354,9 @@ void AudioGroupCollection::update(AudioGroupFilePresenter& presenter)
|
||||
if (search == m_groups.end())
|
||||
{
|
||||
search =
|
||||
m_groups.emplace(nameStr,
|
||||
std::make_unique<AudioGroupDataCollection>(m_path + L'\\' + nameStr,
|
||||
nameStr)).first;
|
||||
m_groups
|
||||
.emplace(nameStr, std::make_unique<AudioGroupDataCollection>(m_path + L'\\' + nameStr, nameStr))
|
||||
.first;
|
||||
search->second->_attemptLoad();
|
||||
}
|
||||
}
|
||||
@@ -284,8 +385,10 @@ void AudioGroupFilePresenter::update()
|
||||
auto search = theMap.find(nameStr);
|
||||
if (search == theMap.end())
|
||||
{
|
||||
search = theMap.emplace(nameStr,
|
||||
std::make_unique<AudioGroupCollection>(m_backend.getUserDir() + L'\\' + nameStr, nameStr)).first;
|
||||
search = theMap
|
||||
.emplace(nameStr, std::make_unique<AudioGroupCollection>(
|
||||
m_backend.getUserDir() + L'\\' + nameStr, nameStr))
|
||||
.first;
|
||||
search->second->update(*this);
|
||||
}
|
||||
}
|
||||
@@ -294,11 +397,12 @@ void AudioGroupFilePresenter::update()
|
||||
FindClose(dir);
|
||||
}
|
||||
|
||||
void AudioGroupFilePresenter::addCollection(const std::wstring& name,
|
||||
std::vector<std::pair<std::wstring, amuse::IntrusiveAudioGroupData>>&& collection)
|
||||
void AudioGroupFilePresenter::addCollection(
|
||||
const std::wstring& name, std::vector<std::pair<std::wstring, amuse::IntrusiveAudioGroupData>>&& collection)
|
||||
{
|
||||
std::wstring path = m_backend.getUserDir() + L'\\' + name;
|
||||
AudioGroupCollection& insert = *m_audioGroupCollections.emplace(name, std::make_unique<AudioGroupCollection>(path, name)).first->second;
|
||||
AudioGroupCollection& insert =
|
||||
*m_audioGroupCollections.emplace(name, std::make_unique<AudioGroupCollection>(path, name)).first->second;
|
||||
CreateDirectory(insert.m_path.c_str(), nullptr);
|
||||
insert.addCollection(std::move(collection));
|
||||
|
||||
@@ -368,7 +472,7 @@ void AudioGroupCollection::populateFiles(VSTEditor& editor, HTREEITEM colHandle,
|
||||
|
||||
m_iteratorVec.clear();
|
||||
m_iteratorVec.reserve(m_groups.size());
|
||||
for (auto it = m_groups.begin() ; it != m_groups.end() ; ++it)
|
||||
for (auto it = m_groups.begin(); it != m_groups.end(); ++it)
|
||||
{
|
||||
ins.item.pszText = LPWSTR(it->first.c_str());
|
||||
ins.item.lParam = LPARAM(0x80000000 | (parentIdx << 16) | m_iteratorVec.size());
|
||||
@@ -389,7 +493,7 @@ void AudioGroupFilePresenter::populateCollectionColumn(VSTEditor& editor)
|
||||
|
||||
m_iteratorVec.clear();
|
||||
m_iteratorVec.reserve(m_audioGroupCollections.size());
|
||||
for (auto it = m_audioGroupCollections.begin() ; it != m_audioGroupCollections.end() ; ++it)
|
||||
for (auto it = m_audioGroupCollections.begin(); it != m_audioGroupCollections.end(); ++it)
|
||||
{
|
||||
ins.item.cChildren = it->second->m_groups.size() ? 1 : 0;
|
||||
ins.item.pszText = LPWSTR(it->first.c_str());
|
||||
@@ -453,7 +557,8 @@ void AudioGroupFilePresenter::populatePageColumn(VSTEditor& editor, int collecti
|
||||
for (auto& pair : sortPages)
|
||||
{
|
||||
wchar_t name[256];
|
||||
wnsprintf(name, 256, L"%d (%s)", pair.first, GMNames[pair.first] ? GMNames[pair.first] : L"???");
|
||||
wnsprintf(name, 256, L"%d (%s)", pair.first,
|
||||
GMNames[pair.first] ? GMNames[pair.first] : L"???");
|
||||
item.pszText = name;
|
||||
item.iItem = idx++;
|
||||
item.lParam = pair.first;
|
||||
@@ -467,7 +572,8 @@ void AudioGroupFilePresenter::populatePageColumn(VSTEditor& editor, int collecti
|
||||
for (auto& pair : sortPages)
|
||||
{
|
||||
wchar_t name[256];
|
||||
wnsprintf(name, 256, L"%d (%s)", pair.first, GMPercNames[pair.first] ? GMPercNames[pair.first] : L"???");
|
||||
wnsprintf(name, 256, L"%d (%s)", pair.first,
|
||||
GMPercNames[pair.first] ? GMPercNames[pair.first] : L"???");
|
||||
item.pszText = name;
|
||||
item.iItem = idx++;
|
||||
item.lParam = 0x80000000 | pair.first;
|
||||
@@ -478,5 +584,4 @@ void AudioGroupFilePresenter::populatePageColumn(VSTEditor& editor, int collecti
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,9 +33,13 @@ struct AudioGroupDataCollection
|
||||
uint32_t absOffs;
|
||||
uint32_t active;
|
||||
MetaData(amuse::DataFormat fmtIn, uint32_t absOffsIn, uint32_t activeIn)
|
||||
: fmt(fmtIn), absOffs(absOffsIn), active(activeIn) {}
|
||||
: fmt(fmtIn), absOffs(absOffsIn), active(activeIn)
|
||||
{
|
||||
}
|
||||
MetaData(athena::io::FileReader& r)
|
||||
: fmt(amuse::DataFormat(r.readUint32Little())), absOffs(r.readUint32Little()), active(r.readUint32Little()) {}
|
||||
: fmt(amuse::DataFormat(r.readUint32Little())), absOffs(r.readUint32Little()), active(r.readUint32Little())
|
||||
{
|
||||
}
|
||||
};
|
||||
std::experimental::optional<MetaData> m_metaData;
|
||||
|
||||
@@ -58,7 +62,10 @@ struct AudioGroupDataCollection
|
||||
bool loadMeta();
|
||||
|
||||
AudioGroupDataCollection(const std::wstring& path, const std::wstring& name);
|
||||
bool isDataComplete() const {return m_projData.size() && m_poolData.size() && m_sdirData.size() && m_sampData.size() && m_metaData;}
|
||||
bool isDataComplete() const
|
||||
{
|
||||
return m_projData.size() && m_poolData.size() && m_sdirData.size() && m_sampData.size() && m_metaData;
|
||||
}
|
||||
bool _attemptLoad();
|
||||
bool _indexData();
|
||||
|
||||
@@ -84,12 +91,15 @@ struct AudioGroupCollection
|
||||
class AudioGroupFilePresenter
|
||||
{
|
||||
friend class VSTBackend;
|
||||
|
||||
public:
|
||||
using CollectionIterator = std::map<std::wstring, std::unique_ptr<AudioGroupCollection>>::iterator;
|
||||
|
||||
private:
|
||||
VSTBackend& m_backend;
|
||||
std::map<std::wstring, std::unique_ptr<AudioGroupCollection>> m_audioGroupCollections;
|
||||
std::vector<CollectionIterator> m_iteratorVec;
|
||||
|
||||
public:
|
||||
AudioGroupFilePresenter(VSTBackend& backend) : m_backend(backend) {}
|
||||
void update();
|
||||
@@ -99,9 +109,8 @@ public:
|
||||
void addCollection(const std::wstring& name,
|
||||
std::vector<std::pair<std::wstring, amuse::IntrusiveAudioGroupData>>&& collection);
|
||||
void removeCollection(unsigned idx);
|
||||
VSTBackend& getBackend() {return m_backend;}
|
||||
VSTBackend& getBackend() { return m_backend; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __AMUSE_AUDIOGROUPFILEPRESENTER_HPP__
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "FileOpenDialog.hpp"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h> // For common windows data types and function headers
|
||||
#include <windows.h> // For common windows data types and function headers
|
||||
#define STRICT_TYPED_ITEMIDS
|
||||
#include <objbase.h> // For COM headers
|
||||
#include <shobjidl.h> // for IFileDialogEvents and IFileDialogControlEvents
|
||||
#include <objbase.h> // For COM headers
|
||||
#include <shobjidl.h> // for IFileDialogEvents and IFileDialogControlEvents
|
||||
#include <shlwapi.h>
|
||||
#include <knownfolders.h> // for KnownFolder APIs/datatypes/function headers
|
||||
#include <propvarutil.h> // for PROPVAR-related functions
|
||||
@@ -15,26 +15,25 @@
|
||||
#include <new>
|
||||
|
||||
// Controls
|
||||
#define CONTROL_GROUP 2000
|
||||
#define CONTROL_GROUP 2000
|
||||
#define CONTROL_RADIOBUTTONLIST 2
|
||||
#define CONTROL_RADIOBUTTON1 1
|
||||
#define CONTROL_RADIOBUTTON2 2 // It is OK for this to have the same IDas CONTROL_RADIOBUTTONLIST,
|
||||
// because it is a child control under CONTROL_RADIOBUTTONLIST
|
||||
#define CONTROL_RADIOBUTTON1 1
|
||||
#define CONTROL_RADIOBUTTON2 2 // It is OK for this to have the same IDas CONTROL_RADIOBUTTONLIST,
|
||||
// because it is a child control under CONTROL_RADIOBUTTONLIST
|
||||
|
||||
// IDs for the Task Dialog Buttons
|
||||
#define IDC_BASICFILEOPEN 100
|
||||
#define IDC_ADDITEMSTOCUSTOMPLACES 101
|
||||
#define IDC_ADDCUSTOMCONTROLS 102
|
||||
#define IDC_SETDEFAULTVALUESFORPROPERTIES 103
|
||||
#define IDC_WRITEPROPERTIESUSINGHANDLERS 104
|
||||
#define IDC_BASICFILEOPEN 100
|
||||
#define IDC_ADDITEMSTOCUSTOMPLACES 101
|
||||
#define IDC_ADDCUSTOMCONTROLS 102
|
||||
#define IDC_SETDEFAULTVALUESFORPROPERTIES 103
|
||||
#define IDC_WRITEPROPERTIESUSINGHANDLERS 104
|
||||
#define IDC_WRITEPROPERTIESWITHOUTUSINGHANDLERS 105
|
||||
|
||||
HWND ghMainWnd = 0;
|
||||
HINSTANCE ghAppInst = 0;
|
||||
RECT winRect;
|
||||
|
||||
class CDialogEventHandler : public IFileDialogEvents,
|
||||
public IFileDialogControlEvents
|
||||
class CDialogEventHandler : public IFileDialogEvents, public IFileDialogControlEvents
|
||||
{
|
||||
public:
|
||||
// IUnknown methods
|
||||
@@ -43,15 +42,12 @@ public:
|
||||
static const QITAB qit[] = {
|
||||
QITABENT(CDialogEventHandler, IFileDialogEvents),
|
||||
QITABENT(CDialogEventHandler, IFileDialogControlEvents),
|
||||
{ 0 },
|
||||
{0},
|
||||
};
|
||||
return QISearch(this, qit, riid, ppv);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(ULONG) AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&_cRef);
|
||||
}
|
||||
IFACEMETHODIMP_(ULONG) AddRef() { return InterlockedIncrement(&_cRef); }
|
||||
|
||||
IFACEMETHODIMP_(ULONG) Release()
|
||||
{
|
||||
@@ -62,106 +58,107 @@ public:
|
||||
}
|
||||
|
||||
// IFileDialogEvents methods
|
||||
IFACEMETHODIMP OnFileOk(IFileDialog *) { return S_OK; };
|
||||
IFACEMETHODIMP OnFolderChange(IFileDialog *) { return S_OK; };
|
||||
IFACEMETHODIMP OnFolderChanging(IFileDialog *, IShellItem *) { return S_OK; };
|
||||
IFACEMETHODIMP OnHelp(IFileDialog *) { return S_OK; };
|
||||
IFACEMETHODIMP OnSelectionChange(IFileDialog *) { return S_OK; };
|
||||
IFACEMETHODIMP OnShareViolation(IFileDialog *, IShellItem *, FDE_SHAREVIOLATION_RESPONSE *) { return S_OK; };
|
||||
IFACEMETHODIMP OnTypeChange(IFileDialog *pfd);
|
||||
IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) { return S_OK; };
|
||||
IFACEMETHODIMP OnFileOk(IFileDialog*) { return S_OK; };
|
||||
IFACEMETHODIMP OnFolderChange(IFileDialog*) { return S_OK; };
|
||||
IFACEMETHODIMP OnFolderChanging(IFileDialog*, IShellItem*) { return S_OK; };
|
||||
IFACEMETHODIMP OnHelp(IFileDialog*) { return S_OK; };
|
||||
IFACEMETHODIMP OnSelectionChange(IFileDialog*) { return S_OK; };
|
||||
IFACEMETHODIMP OnShareViolation(IFileDialog*, IShellItem*, FDE_SHAREVIOLATION_RESPONSE*) { return S_OK; };
|
||||
IFACEMETHODIMP OnTypeChange(IFileDialog* pfd);
|
||||
IFACEMETHODIMP OnOverwrite(IFileDialog*, IShellItem*, FDE_OVERWRITE_RESPONSE*) { return S_OK; };
|
||||
|
||||
// IFileDialogControlEvents methods
|
||||
IFACEMETHODIMP OnItemSelected(IFileDialogCustomize *pfdc, DWORD dwIDCtl, DWORD dwIDItem);
|
||||
IFACEMETHODIMP OnButtonClicked(IFileDialogCustomize *, DWORD) { return S_OK; };
|
||||
IFACEMETHODIMP OnCheckButtonToggled(IFileDialogCustomize *, DWORD, BOOL) { return S_OK; };
|
||||
IFACEMETHODIMP OnControlActivating(IFileDialogCustomize *, DWORD) { return S_OK; };
|
||||
IFACEMETHODIMP OnItemSelected(IFileDialogCustomize* pfdc, DWORD dwIDCtl, DWORD dwIDItem);
|
||||
IFACEMETHODIMP OnButtonClicked(IFileDialogCustomize*, DWORD) { return S_OK; };
|
||||
IFACEMETHODIMP OnCheckButtonToggled(IFileDialogCustomize*, DWORD, BOOL) { return S_OK; };
|
||||
IFACEMETHODIMP OnControlActivating(IFileDialogCustomize*, DWORD) { return S_OK; };
|
||||
|
||||
CDialogEventHandler() : _cRef(1){};
|
||||
|
||||
CDialogEventHandler() : _cRef(1) { };
|
||||
private:
|
||||
~CDialogEventHandler() { };
|
||||
~CDialogEventHandler(){};
|
||||
long _cRef;
|
||||
};
|
||||
|
||||
HRESULT CDialogEventHandler_CreateInstance(REFIID riid, void **ppv);
|
||||
HRESULT CDialogEventHandler_CreateInstance(REFIID riid, void** ppv);
|
||||
|
||||
std::wstring openDB()
|
||||
{
|
||||
std::wstring ret;
|
||||
CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
|
||||
|
||||
//Cocreate the file open dialog object
|
||||
IFileDialog *pfd = NULL;
|
||||
// Cocreate the file open dialog object
|
||||
IFileDialog* pfd = NULL;
|
||||
|
||||
HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pfd));
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//Stuff needed for later
|
||||
// Stuff needed for later
|
||||
const COMDLG_FILTERSPEC rgFExt[] = {{L"Audio Group Archive (*.*)", L"*.*"}};
|
||||
|
||||
//Create event handling
|
||||
IFileDialogEvents *pfde = NULL;
|
||||
// Create event handling
|
||||
IFileDialogEvents* pfde = NULL;
|
||||
hr = CDialogEventHandler_CreateInstance(IID_PPV_ARGS(&pfde));
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//Hook the event handler
|
||||
// Hook the event handler
|
||||
DWORD dwCookie;
|
||||
|
||||
hr = pfd->Advise(pfde, &dwCookie);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//Set options for the dialog
|
||||
// Set options for the dialog
|
||||
DWORD dwFlags;
|
||||
|
||||
//Get options first so we do not override
|
||||
// Get options first so we do not override
|
||||
hr = pfd->GetOptions(&dwFlags);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//Get shell items only
|
||||
// Get shell items only
|
||||
hr = pfd->SetOptions(dwFlags | FOS_FORCEFILESYSTEM);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//Types of files to display (not default)
|
||||
// Types of files to display (not default)
|
||||
hr = pfd->SetFileTypes(ARRAYSIZE(rgFExt), rgFExt);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//Set default file type to display
|
||||
//hr = pfd->SetDefaultExtension(L"sqlite");
|
||||
// Set default file type to display
|
||||
// hr = pfd->SetDefaultExtension(L"sqlite");
|
||||
|
||||
//if (SUCCEEDED(hr))
|
||||
// if (SUCCEEDED(hr))
|
||||
//{
|
||||
//Show dialog
|
||||
hr = pfd->Show(NULL);
|
||||
// Show dialog
|
||||
hr = pfd->Show(NULL);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// Get the result once the user clicks on open
|
||||
IShellItem* result;
|
||||
|
||||
hr = pfd->GetResult(&result);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//Get the result once the user clicks on open
|
||||
IShellItem *result;
|
||||
// Print out the file name
|
||||
PWSTR fName = NULL;
|
||||
|
||||
hr = pfd->GetResult(&result);
|
||||
hr = result->GetDisplayName(SIGDN_FILESYSPATH, &fName);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//Print out the file name
|
||||
PWSTR fName = NULL;
|
||||
|
||||
hr = result->GetDisplayName(SIGDN_FILESYSPATH, &fName);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ret.assign(fName);
|
||||
CoTaskMemFree(fName);
|
||||
}
|
||||
|
||||
result->Release();
|
||||
ret.assign(fName);
|
||||
CoTaskMemFree(fName);
|
||||
}
|
||||
|
||||
result->Release();
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -178,11 +175,10 @@ std::wstring openDB()
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CDialogEventHandler_CreateInstance(REFIID riid, void **ppv)
|
||||
HRESULT CDialogEventHandler_CreateInstance(REFIID riid, void** ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
CDialogEventHandler *pDialogEventHandler = new (std::nothrow) CDialogEventHandler();
|
||||
CDialogEventHandler* pDialogEventHandler = new (std::nothrow) CDialogEventHandler();
|
||||
HRESULT hr = pDialogEventHandler ? S_OK : E_OUTOFMEMORY;
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
@@ -192,19 +188,17 @@ HRESULT CDialogEventHandler_CreateInstance(REFIID riid, void **ppv)
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CDialogEventHandler::OnTypeChange(IFileDialog *pfd)
|
||||
HRESULT CDialogEventHandler::OnTypeChange(IFileDialog* pfd)
|
||||
{
|
||||
IFileSaveDialog *pfsd;
|
||||
IFileSaveDialog* pfsd;
|
||||
HRESULT hr = pfd->QueryInterface(&pfsd);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
UINT uIndex;
|
||||
hr = pfsd->GetFileTypeIndex(&uIndex); // index of current file-type
|
||||
hr = pfsd->GetFileTypeIndex(&uIndex); // index of current file-type
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
IPropertyDescriptionList *pdl = NULL;
|
||||
|
||||
|
||||
IPropertyDescriptionList* pdl = NULL;
|
||||
}
|
||||
pfsd->Release();
|
||||
}
|
||||
@@ -214,9 +208,9 @@ HRESULT CDialogEventHandler::OnTypeChange(IFileDialog *pfd)
|
||||
// IFileDialogControlEvents
|
||||
// This method gets called when an dialog control item selection happens (radio-button selection. etc).
|
||||
// For sample sake, let's react to this event by changing the dialog title.
|
||||
HRESULT CDialogEventHandler::OnItemSelected(IFileDialogCustomize *pfdc, DWORD dwIDCtl, DWORD dwIDItem)
|
||||
HRESULT CDialogEventHandler::OnItemSelected(IFileDialogCustomize* pfdc, DWORD dwIDCtl, DWORD dwIDItem)
|
||||
{
|
||||
IFileDialog *pfd = NULL;
|
||||
IFileDialog* pfd = NULL;
|
||||
HRESULT hr = pfdc->QueryInterface(&pfd);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
||||
@@ -13,27 +13,17 @@ struct VSTVoiceEngine : boo::BaseAudioVoiceEngine
|
||||
size_t m_renderFrames = 0;
|
||||
size_t m_curBufFrame = 0;
|
||||
|
||||
boo::AudioChannelSet _getAvailableSet()
|
||||
{
|
||||
return boo::AudioChannelSet::Stereo;
|
||||
}
|
||||
boo::AudioChannelSet _getAvailableSet() { return boo::AudioChannelSet::Stereo; }
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIDevices() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIDevices() const { return {}; }
|
||||
|
||||
boo::ReceiveFunctor* m_midiReceiver = nullptr;
|
||||
|
||||
struct MIDIIn : public boo::IMIDIIn
|
||||
{
|
||||
MIDIIn(bool virt, boo::ReceiveFunctor&& receiver)
|
||||
: IMIDIIn(virt, std::move(receiver)) {}
|
||||
MIDIIn(bool virt, boo::ReceiveFunctor&& receiver) : IMIDIIn(virt, std::move(receiver)) {}
|
||||
|
||||
std::string description() const
|
||||
{
|
||||
return "VST MIDI";
|
||||
}
|
||||
std::string description() const { return "VST MIDI"; }
|
||||
};
|
||||
|
||||
std::unique_ptr<boo::IMIDIIn> newVirtualMIDIIn(boo::ReceiveFunctor&& receiver)
|
||||
@@ -43,32 +33,17 @@ struct VSTVoiceEngine : boo::BaseAudioVoiceEngine
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<boo::IMIDIOut> newVirtualMIDIOut()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
std::unique_ptr<boo::IMIDIOut> newVirtualMIDIOut() { return {}; }
|
||||
|
||||
std::unique_ptr<boo::IMIDIInOut> newVirtualMIDIInOut(boo::ReceiveFunctor&& receiver)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
std::unique_ptr<boo::IMIDIInOut> newVirtualMIDIInOut(boo::ReceiveFunctor&& receiver) { return {}; }
|
||||
|
||||
std::unique_ptr<boo::IMIDIIn> newRealMIDIIn(const char* name, boo::ReceiveFunctor&& receiver)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
std::unique_ptr<boo::IMIDIIn> newRealMIDIIn(const char* name, boo::ReceiveFunctor&& receiver) { return {}; }
|
||||
|
||||
std::unique_ptr<boo::IMIDIOut> newRealMIDIOut(const char* name)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
std::unique_ptr<boo::IMIDIOut> newRealMIDIOut(const char* name) { return {}; }
|
||||
|
||||
std::unique_ptr<boo::IMIDIInOut> newRealMIDIInOut(const char* name, boo::ReceiveFunctor&& receiver)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
std::unique_ptr<boo::IMIDIInOut> newRealMIDIInOut(const char* name, boo::ReceiveFunctor&& receiver) { return {}; }
|
||||
|
||||
bool useMIDILock() const {return false;}
|
||||
bool useMIDILock() const { return false; }
|
||||
|
||||
VSTVoiceEngine()
|
||||
{
|
||||
@@ -112,7 +87,7 @@ struct VSTVoiceEngine : boo::BaseAudioVoiceEngine
|
||||
|
||||
void pumpAndMixVoices()
|
||||
{
|
||||
for (size_t f=0 ; f<m_renderFrames ;)
|
||||
for (size_t f = 0; f < m_renderFrames;)
|
||||
{
|
||||
if (m_curBufFrame == m_5msFrames)
|
||||
{
|
||||
@@ -123,11 +98,11 @@ struct VSTVoiceEngine : boo::BaseAudioVoiceEngine
|
||||
size_t remRenderFrames = std::min(m_renderFrames - f, m_5msFrames - m_curBufFrame);
|
||||
if (remRenderFrames)
|
||||
{
|
||||
for (size_t i=0 ; i<2 ; ++i)
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
float* bufOut = m_outputData[i];
|
||||
for (size_t lf=0 ; lf<remRenderFrames ; ++lf)
|
||||
bufOut[f+lf] = m_interleavedBuf[(m_curBufFrame+lf)*2+i];
|
||||
for (size_t lf = 0; lf < remRenderFrames; ++lf)
|
||||
bufOut[f + lf] = m_interleavedBuf[(m_curBufFrame + lf) * 2 + i];
|
||||
}
|
||||
m_curBufFrame += remRenderFrames;
|
||||
f += remRenderFrames;
|
||||
@@ -135,18 +110,17 @@ struct VSTVoiceEngine : boo::BaseAudioVoiceEngine
|
||||
}
|
||||
}
|
||||
|
||||
double getCurrentSampleRate() const {return m_mixInfo.m_sampleRate;}
|
||||
double getCurrentSampleRate() const { return m_mixInfo.m_sampleRate; }
|
||||
};
|
||||
|
||||
namespace amuse
|
||||
{
|
||||
|
||||
#define kBackendID CCONST ('a','m','u','s')
|
||||
#define kBackendID CCONST('a', 'm', 'u', 's')
|
||||
|
||||
static logvisor::Module Log("amuse::AudioUnitBackend");
|
||||
|
||||
VSTBackend::VSTBackend(audioMasterCallback cb)
|
||||
: AudioEffectX(cb, 0, 0), m_filePresenter(*this), m_editor(*this)
|
||||
VSTBackend::VSTBackend(audioMasterCallback cb) : AudioEffectX(cb, 0, 0), m_filePresenter(*this), m_editor(*this)
|
||||
{
|
||||
isSynth();
|
||||
setUniqueID(kBackendID);
|
||||
@@ -170,15 +144,9 @@ VSTBackend::VSTBackend(audioMasterCallback cb)
|
||||
m_filePresenter.update();
|
||||
}
|
||||
|
||||
VSTBackend::~VSTBackend()
|
||||
{
|
||||
editor = nullptr;
|
||||
}
|
||||
VSTBackend::~VSTBackend() { editor = nullptr; }
|
||||
|
||||
AEffEditor* VSTBackend::getEditor()
|
||||
{
|
||||
return &m_editor;
|
||||
}
|
||||
AEffEditor* VSTBackend::getEditor() { return &m_editor; }
|
||||
|
||||
VstInt32 VSTBackend::processEvents(VstEvents* events)
|
||||
{
|
||||
@@ -197,7 +165,7 @@ VstInt32 VSTBackend::processEvents(VstEvents* events)
|
||||
|
||||
if (engine.m_midiReceiver)
|
||||
{
|
||||
for (VstInt32 i=0 ; i<events->numEvents ; ++i)
|
||||
for (VstInt32 i = 0; i < events->numEvents; ++i)
|
||||
{
|
||||
VstMidiEvent* evt = reinterpret_cast<VstMidiEvent*>(events->events[i]);
|
||||
if (evt->type == kVstMidiType)
|
||||
@@ -207,9 +175,9 @@ VstInt32 VSTBackend::processEvents(VstEvents* events)
|
||||
evt->midiData[0] &= ~0xf;
|
||||
evt->midiData[0] |= m_routeChannel & 0xf;
|
||||
}
|
||||
(*engine.m_midiReceiver)(std::vector<uint8_t>(std::cbegin(evt->midiData),
|
||||
std::cbegin(evt->midiData) + evt->byteSize),
|
||||
(m_curFrame + evt->deltaFrames) / sampleRate);
|
||||
(*engine.m_midiReceiver)(
|
||||
std::vector<uint8_t>(std::cbegin(evt->midiData), std::cbegin(evt->midiData) + evt->byteSize),
|
||||
(m_curFrame + evt->deltaFrames) / sampleRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,10 +210,7 @@ VstInt32 VSTBackend::canDo(char* text)
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
VstPlugCategory VSTBackend::getPlugCategory()
|
||||
{
|
||||
return kPlugCategSynth;
|
||||
}
|
||||
VstPlugCategory VSTBackend::getPlugCategory() { return kPlugCategSynth; }
|
||||
|
||||
bool VSTBackend::getEffectName(char* text)
|
||||
{
|
||||
@@ -284,10 +249,7 @@ bool VSTBackend::getOutputProperties(VstInt32 index, VstPinProperties* propertie
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
VstInt32 VSTBackend::getNumMidiInputChannels()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
VstInt32 VSTBackend::getNumMidiInputChannels() { return 1; }
|
||||
|
||||
void VSTBackend::setSampleRate(float sampleRate)
|
||||
{
|
||||
@@ -427,10 +389,6 @@ VstInt32 VSTBackend::setChunk(void* data, VstInt32 byteSize, bool)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
AudioEffect* createEffectInstance(audioMasterCallback audioMaster)
|
||||
{
|
||||
return new amuse::VSTBackend(audioMaster);
|
||||
}
|
||||
AudioEffect* createEffectInstance(audioMasterCallback audioMaster) { return new amuse::VSTBackend(audioMaster); }
|
||||
|
||||
@@ -21,8 +21,7 @@ class VSTBackend;
|
||||
class VSTBackendVoiceAllocator : public BooBackendVoiceAllocator
|
||||
{
|
||||
public:
|
||||
VSTBackendVoiceAllocator(boo::IAudioVoiceEngine& booEngine)
|
||||
: BooBackendVoiceAllocator(booEngine) {}
|
||||
VSTBackendVoiceAllocator(boo::IAudioVoiceEngine& booEngine) : BooBackendVoiceAllocator(booEngine) {}
|
||||
};
|
||||
|
||||
/** Actual plugin implementation class */
|
||||
@@ -41,6 +40,7 @@ class VSTBackend : public AudioEffectX
|
||||
int m_routeChannel = -1;
|
||||
AudioGroupFilePresenter m_filePresenter;
|
||||
VSTEditor m_editor;
|
||||
|
||||
public:
|
||||
VSTBackend(audioMasterCallback cb);
|
||||
~VSTBackend();
|
||||
@@ -58,9 +58,9 @@ public:
|
||||
void setSampleRate(float sampleRate);
|
||||
void setBlockSize(VstInt32 blockSize);
|
||||
|
||||
amuse::Engine& getAmuseEngine() {return *m_engine;}
|
||||
const std::wstring& getUserDir() const {return m_userDir;}
|
||||
AudioGroupFilePresenter& getFilePresenter() {return m_filePresenter;}
|
||||
amuse::Engine& getAmuseEngine() { return *m_engine; }
|
||||
const std::wstring& getUserDir() const { return m_userDir; }
|
||||
AudioGroupFilePresenter& getFilePresenter() { return m_filePresenter; }
|
||||
|
||||
void loadGroupFile(int collectionIdx, int fileIdx);
|
||||
void setGroup(int groupIdx, bool immediate);
|
||||
@@ -72,7 +72,6 @@ public:
|
||||
VstInt32 getChunk(void** data, bool isPreset);
|
||||
VstInt32 setChunk(void* data, VstInt32 byteSize, bool isPreset);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __AMUSE_VSTBACKEND_HPP__
|
||||
|
||||
@@ -16,10 +16,7 @@ static HBRUSH gGreyBorderBrush;
|
||||
namespace amuse
|
||||
{
|
||||
|
||||
VSTEditor::VSTEditor(VSTBackend& backend)
|
||||
: AEffEditor(&backend), m_backend(backend)
|
||||
{
|
||||
}
|
||||
VSTEditor::VSTEditor(VSTBackend& backend) : AEffEditor(&backend), m_backend(backend) {}
|
||||
|
||||
bool VSTEditor::getRect(ERect** rect)
|
||||
{
|
||||
@@ -27,10 +24,7 @@ bool VSTEditor::getRect(ERect** rect)
|
||||
return true;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK VSTEditor::WindowProc(HWND hwnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
LRESULT CALLBACK VSTEditor::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
VSTEditor& editor = *reinterpret_cast<VSTEditor*>(GetWindowLongPtrW(hwnd, 0));
|
||||
switch (uMsg)
|
||||
@@ -101,10 +95,7 @@ LRESULT CALLBACK VSTEditor::WindowProc(HWND hwnd,
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK VSTEditor::ColHeaderWindowProc(HWND hwnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
LRESULT CALLBACK VSTEditor::ColHeaderWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
@@ -119,15 +110,12 @@ LRESULT CALLBACK VSTEditor::ColHeaderWindowProc(HWND hwnd,
|
||||
RECT rect;
|
||||
GetClientRect(hwnd, &rect);
|
||||
|
||||
TRIVERTEX verts[] =
|
||||
{
|
||||
{rect.left, rect.top, 0x6000, 0x6000, 0x7000, 0xff00},
|
||||
{rect.right, rect.bottom, 0x2000, 0x2000, 0x2800, 0xff00}
|
||||
};
|
||||
TRIVERTEX verts[] = {{rect.left, rect.top, 0x6000, 0x6000, 0x7000, 0xff00},
|
||||
{rect.right, rect.bottom, 0x2000, 0x2000, 0x2800, 0xff00}};
|
||||
GRADIENT_RECT grect = {0, 1};
|
||||
GradientFill(dc, verts, 2, &grect, 1, GRADIENT_FILL_RECT_V);
|
||||
|
||||
SetTextColor(dc, RGB(255,255,255));
|
||||
SetTextColor(dc, RGB(255, 255, 255));
|
||||
SetBkMode(dc, TRANSPARENT);
|
||||
SelectObject(dc, GetStockObject(ANSI_VAR_FONT));
|
||||
rect.left += 6;
|
||||
@@ -160,33 +148,22 @@ bool VSTEditor::open(void* ptr)
|
||||
{
|
||||
AEffEditor::open(ptr);
|
||||
HWND hostView = HWND(ptr);
|
||||
gGreyBorderBrush = CreateSolidBrush(RGB(100,100,100));
|
||||
gGreyBorderBrush = CreateSolidBrush(RGB(100, 100, 100));
|
||||
|
||||
WNDCLASSW notifyCls =
|
||||
{
|
||||
CS_HREDRAW | CS_VREDRAW,
|
||||
WindowProc,
|
||||
0,
|
||||
8,
|
||||
HINSTANCE(hInstance),
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
L"VSTNotify"
|
||||
};
|
||||
WNDCLASSW notifyCls = {CS_HREDRAW | CS_VREDRAW,
|
||||
WindowProc,
|
||||
0,
|
||||
8,
|
||||
HINSTANCE(hInstance),
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
L"VSTNotify"};
|
||||
RegisterClassW(¬ifyCls);
|
||||
|
||||
m_rootView = CreateWindowW(L"VSTNotify",
|
||||
L"",
|
||||
WS_CHILD,
|
||||
0, 0,
|
||||
m_windowRect.right,
|
||||
m_windowRect.bottom,
|
||||
hostView,
|
||||
nullptr,
|
||||
HINSTANCE(hInstance),
|
||||
nullptr);
|
||||
m_rootView = CreateWindowW(L"VSTNotify", L"", WS_CHILD, 0, 0, m_windowRect.right, m_windowRect.bottom, hostView,
|
||||
nullptr, HINSTANCE(hInstance), nullptr);
|
||||
SetWindowLongPtrW(m_rootView, 0, LONG_PTR(this));
|
||||
ShowWindow(m_rootView, SW_SHOW);
|
||||
|
||||
@@ -203,18 +180,12 @@ bool VSTEditor::open(void* ptr)
|
||||
column.fmt = LVCFMT_LEFT | LVCFMT_FIXED_WIDTH;
|
||||
column.cx = 199;
|
||||
|
||||
m_collectionTree = CreateWindowW(WC_TREEVIEW,
|
||||
L"",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | TVS_SHOWSELALWAYS | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS,
|
||||
1, 25,
|
||||
199,
|
||||
m_windowRect.bottom - m_windowRect.top - 26,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
TreeView_SetBkColor(m_collectionTree, RGB(64,64,64));
|
||||
TreeView_SetTextColor(m_collectionTree, RGB(255,255,255));
|
||||
m_collectionTree =
|
||||
CreateWindowW(WC_TREEVIEW, L"",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | TVS_SHOWSELALWAYS | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS,
|
||||
1, 25, 199, m_windowRect.bottom - m_windowRect.top - 26, m_rootView, nullptr, nullptr, nullptr);
|
||||
TreeView_SetBkColor(m_collectionTree, RGB(64, 64, 64));
|
||||
TreeView_SetTextColor(m_collectionTree, RGB(255, 255, 255));
|
||||
HTREEITEM rootItemA = TreeView_InsertItem(m_collectionTree, &treeItem);
|
||||
treeItem.item.pszText = L"Root B";
|
||||
HTREEITEM rootItemB = TreeView_InsertItem(m_collectionTree, &treeItem);
|
||||
@@ -231,113 +202,61 @@ bool VSTEditor::open(void* ptr)
|
||||
TreeView_InsertItem(m_collectionTree, &treeItem);
|
||||
ShowWindow(m_collectionTree, SW_SHOW);
|
||||
|
||||
HWND cHeader = CreateWindowW(WC_HEADER,
|
||||
L"",
|
||||
WS_CHILD,
|
||||
1, 1,
|
||||
199,
|
||||
24,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
HWND cHeader = CreateWindowW(WC_HEADER, L"", WS_CHILD, 1, 1, 199, 24, m_rootView, nullptr, nullptr, nullptr);
|
||||
SetWindowLongPtrW(cHeader, GWLP_USERDATA, LONG_PTR(L"Collection"));
|
||||
OriginalListViewProc = WNDPROC(SetWindowLongPtr(cHeader, GWLP_WNDPROC, LONG_PTR(ColHeaderWindowProc)));
|
||||
ShowWindow(cHeader, SW_SHOW);
|
||||
|
||||
HWND gHeader = CreateWindowW(WC_HEADER,
|
||||
L"",
|
||||
WS_CHILD,
|
||||
201, 1,
|
||||
199,
|
||||
24,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
HWND gHeader = CreateWindowW(WC_HEADER, L"", WS_CHILD, 201, 1, 199, 24, m_rootView, nullptr, nullptr, nullptr);
|
||||
SetWindowLongPtrW(gHeader, GWLP_USERDATA, LONG_PTR(L"Group"));
|
||||
OriginalListViewProc = WNDPROC(SetWindowLongPtr(gHeader, GWLP_WNDPROC, LONG_PTR(ColHeaderWindowProc)));
|
||||
ShowWindow(gHeader, SW_SHOW);
|
||||
|
||||
HWND pHeader = CreateWindowW(WC_HEADER,
|
||||
L"",
|
||||
WS_CHILD,
|
||||
401, 1,
|
||||
198,
|
||||
24,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
HWND pHeader = CreateWindowW(WC_HEADER, L"", WS_CHILD, 401, 1, 198, 24, m_rootView, nullptr, nullptr, nullptr);
|
||||
SetWindowLongPtrW(pHeader, GWLP_USERDATA, LONG_PTR(L"Page"));
|
||||
OriginalListViewProc = WNDPROC(SetWindowLongPtr(pHeader, GWLP_WNDPROC, LONG_PTR(ColHeaderWindowProc)));
|
||||
ShowWindow(pHeader, SW_SHOW);
|
||||
|
||||
m_collectionAdd = CreateWindowW(WC_BUTTON,
|
||||
L"+",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | BS_PUSHBUTTON,
|
||||
1, m_windowRect.bottom - m_windowRect.top - 25,
|
||||
25, 24,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
m_collectionAdd =
|
||||
CreateWindowW(WC_BUTTON, L"+", WS_CHILD | WS_CLIPSIBLINGS | BS_PUSHBUTTON, 1,
|
||||
m_windowRect.bottom - m_windowRect.top - 25, 25, 24, m_rootView, nullptr, nullptr, nullptr);
|
||||
SetWindowFont(m_collectionAdd, GetStockObject(ANSI_FIXED_FONT), FALSE);
|
||||
Button_Enable(m_collectionAdd, TRUE);
|
||||
SetWindowPos(m_collectionAdd, HWND_TOP, 1, m_windowRect.bottom - m_windowRect.top - 25, 25, 24, SWP_SHOWWINDOW);
|
||||
|
||||
m_collectionRemove = CreateWindowW(WC_BUTTON,
|
||||
L"-",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | BS_PUSHBUTTON,
|
||||
26, m_windowRect.bottom - m_windowRect.top - 25,
|
||||
25, 24,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
m_collectionRemove =
|
||||
CreateWindowW(WC_BUTTON, L"-", WS_CHILD | WS_CLIPSIBLINGS | BS_PUSHBUTTON, 26,
|
||||
m_windowRect.bottom - m_windowRect.top - 25, 25, 24, m_rootView, nullptr, nullptr, nullptr);
|
||||
SetWindowFont(m_collectionRemove, GetStockObject(ANSI_FIXED_FONT), FALSE);
|
||||
Button_Enable(m_collectionRemove, FALSE);
|
||||
SetWindowPos(m_collectionRemove, HWND_TOP, 26, m_windowRect.bottom - m_windowRect.top - 25, 25, 24, SWP_SHOWWINDOW);
|
||||
|
||||
|
||||
m_groupListView = CreateWindowW(WC_LISTVIEW,
|
||||
L"",
|
||||
WS_CHILD | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER,
|
||||
201, 25,
|
||||
199,
|
||||
m_windowRect.bottom - m_windowRect.top - 26,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
m_groupListView =
|
||||
CreateWindowW(WC_LISTVIEW, L"",
|
||||
WS_CHILD | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER,
|
||||
201, 25, 199, m_windowRect.bottom - m_windowRect.top - 26, m_rootView, nullptr, nullptr, nullptr);
|
||||
column.pszText = L"Group";
|
||||
HWND header = ListView_GetHeader(m_groupListView);
|
||||
SetWindowLongPtrW(header, GWLP_USERDATA, LONG_PTR(column.pszText));
|
||||
SetWindowLongPtr(header, GWLP_WNDPROC, LONG_PTR(ColHeaderWindowProc));
|
||||
ListView_SetBkColor(m_groupListView, RGB(64,64,64));
|
||||
ListView_SetBkColor(m_groupListView, RGB(64, 64, 64));
|
||||
ListView_SetTextBkColor(m_groupListView, CLR_NONE);
|
||||
ListView_SetTextColor(m_groupListView, RGB(255,255,255));
|
||||
ListView_SetTextColor(m_groupListView, RGB(255, 255, 255));
|
||||
ListView_InsertColumn(m_groupListView, 0, &column);
|
||||
ShowWindow(m_groupListView, SW_SHOW);
|
||||
|
||||
m_pageListView = CreateWindowW(WC_LISTVIEW,
|
||||
L"",
|
||||
WS_CHILD | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER,
|
||||
401, 25,
|
||||
198,
|
||||
m_windowRect.bottom - m_windowRect.top - 26,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
m_pageListView =
|
||||
CreateWindowW(WC_LISTVIEW, L"",
|
||||
WS_CHILD | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER,
|
||||
401, 25, 198, m_windowRect.bottom - m_windowRect.top - 26, m_rootView, nullptr, nullptr, nullptr);
|
||||
column.pszText = L"Page";
|
||||
column.cx = 198 - GetSystemMetrics(SM_CXVSCROLL);
|
||||
header = ListView_GetHeader(m_pageListView);
|
||||
SetWindowLongPtrW(header, GWLP_USERDATA, LONG_PTR(column.pszText));
|
||||
SetWindowLongPtr(header, GWLP_WNDPROC, LONG_PTR(ColHeaderWindowProc));
|
||||
ListView_SetBkColor(m_pageListView, RGB(64,64,64));
|
||||
ListView_SetBkColor(m_pageListView, RGB(64, 64, 64));
|
||||
ListView_SetTextBkColor(m_pageListView, CLR_NONE);
|
||||
ListView_SetTextColor(m_pageListView, RGB(255,255,255));
|
||||
ListView_SetTextColor(m_pageListView, RGB(255, 255, 255));
|
||||
ListView_InsertColumn(m_pageListView, 0, &column);
|
||||
ShowWindow(m_pageListView, SW_SHOW);
|
||||
|
||||
@@ -468,14 +387,7 @@ void VSTEditor::reselectPage()
|
||||
}
|
||||
}
|
||||
|
||||
void VSTEditor::selectNormalPage(int idx)
|
||||
{
|
||||
m_backend.setNormalProgram(idx);
|
||||
}
|
||||
|
||||
void VSTEditor::selectDrumPage(int idx)
|
||||
{
|
||||
m_backend.setDrumProgram(idx);
|
||||
}
|
||||
void VSTEditor::selectNormalPage(int idx) { m_backend.setNormalProgram(idx); }
|
||||
|
||||
void VSTEditor::selectDrumPage(int idx) { m_backend.setDrumProgram(idx); }
|
||||
}
|
||||
|
||||
@@ -36,20 +36,11 @@ class VSTEditor : public AEffEditor
|
||||
|
||||
HTREEITEM m_deferredCollectionSel = 0;
|
||||
|
||||
static LRESULT CALLBACK WindowProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
);
|
||||
static LRESULT CALLBACK ColHeaderWindowProc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
);
|
||||
static LRESULT CALLBACK WindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam);
|
||||
static LRESULT CALLBACK ColHeaderWindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam);
|
||||
|
||||
void _reselectColumns();
|
||||
|
||||
public:
|
||||
VSTEditor(VSTBackend& backend);
|
||||
|
||||
@@ -68,7 +59,6 @@ public:
|
||||
void selectNormalPage(int idx);
|
||||
void selectDrumPage(int idx);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __AMUSE_VSTEDITOR_HPP__
|
||||
|
||||
Reference in New Issue
Block a user