Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ bool picoTrackerSamplePool::LoadInFlash(WavFile *wave) {
uint32_t sectorsToErase = ((additionalData / FLASH_SECTOR_SIZE) +
((additionalData % FLASH_SECTOR_SIZE) != 0)) *
FLASH_SECTOR_SIZE;

// Erase required number of sectors
flash_range_erase(flashEraseOffset_, sectorsToErase);
// Move erase pointer to new position
Expand Down
15 changes: 15 additions & 0 deletions sources/Application/AppWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "Application/Views/ProjectView.h"
#include "Application/Views/RecordView.h"
#include "Application/Views/SampleEditorView.h"
#include "Application/Views/SampleSlicesView.h"
#include "Application/Views/SelectProjectView.h"
#include "Application/Views/SongView.h"
#include "Application/Views/TableView.h"
Expand Down Expand Up @@ -130,6 +131,7 @@ AppWindow::AppWindow(I_GUIWindowImp &imp) : GUIWindow(imp) {
_tableView = 0;
_mixerView = 0;
_sampleEditorView = 0;
_sampleSlicesView = 0;
_recordView = 0;
_nullView = 0;
_grooveView = 0;
Expand Down Expand Up @@ -482,6 +484,12 @@ AppWindow::LoadProjectResult AppWindow::LoadProject(const char *projectName) {
new (sampleEditorViewMemBuf) SampleEditorView((*this), _viewData);
_sampleEditorView->AddObserver((*this));

alignas(SampleSlicesView) static char
sampleSlicesViewMemBuf[sizeof(SampleSlicesView)];
_sampleSlicesView =
new (sampleSlicesViewMemBuf) SampleSlicesView((*this), _viewData);
_sampleSlicesView->AddObserver((*this));

alignas(RecordView) static char recordViewMemBuf[sizeof(RecordView)];
_recordView = new (recordViewMemBuf) RecordView((*this), _viewData);
_recordView->AddObserver((*this));
Expand Down Expand Up @@ -529,6 +537,10 @@ void AppWindow::CloseProject() {
SAFE_DELETE(_instrumentView);
SAFE_DELETE(_tableView);
SAFE_DELETE(_grooveView);
SAFE_DELETE(_mixerView);
SAFE_DELETE(_sampleEditorView);
SAFE_DELETE(_sampleSlicesView);
SAFE_DELETE(_recordView);

UIController *controller = UIController::GetInstance();
controller->Reset();
Expand Down Expand Up @@ -839,6 +851,9 @@ void AppWindow::Update(Observable &o, I_ObservableData *d) {
case VT_SAMPLE_EDITOR:
_currentView = _sampleEditorView;
break;
case VT_SAMPLE_SLICES:
_currentView = _sampleSlicesView;
break;
case VT_RECORD:
_currentView = _recordView;
break;
Expand Down
2 changes: 2 additions & 0 deletions sources/Application/AppWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class MixerView;
class ThemeView;
class ThemeImportView;
class SampleEditorView;
class SampleSlicesView;
class RecordView;
class View;

Expand Down Expand Up @@ -126,6 +127,7 @@ class AppWindow : public GUIWindow, I_Observer, Status {
MixerView *_mixerView;
SelectProjectView *_selectProjectView;
SampleEditorView *_sampleEditorView;
SampleSlicesView *_sampleSlicesView;
RecordView *_recordView;
NullView *_nullView;

Expand Down
17 changes: 13 additions & 4 deletions sources/Application/Instruments/InstrumentBank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,38 @@ void InstrumentBank::RestoreContent(PersistencyDocument *doc) {
if (!strcasecmp(doc->ElemName(), "INSTRUMENT")) {
// Get the instrument ID
unsigned char id = '\0';
char *instype = NULL;
char instype[16];
instype[0] = '\0';
bool hasId = false;
bool hasType = false;
bool hasAttr = doc->NextAttribute();
while (hasAttr) {
if (!strcasecmp(doc->attrname_, "ID")) {
unsigned char b1 = (c2h__(doc->attrval_[0])) << 4;
unsigned char b2 = c2h__(doc->attrval_[1]);
id = b1 + b2;
hasId = true;
#if XML_DEBUG_LOGGING
Trace::Log("INSTRUMENTBANK", "instrument ID from xml:%d", id);
#endif
}
if (!strcasecmp(doc->attrname_, "TYPE")) {
instype = doc->attrval_;
strncpy(instype, doc->attrval_, sizeof(instype) - 1);
instype[sizeof(instype) - 1] = '\0';
hasType = true;
#if XML_DEBUG_LOGGING
Trace::Log("INSTRUMENTBANK", "instrument type from xml:%s", instype);
#endif
}
if (hasId && hasType) {
break;
}
hasAttr = doc->NextAttribute();
}

InstrumentType instrType = IT_SAMPLE; // default if no type in project XML
if (instype) {
for (uint i = 0; i < sizeof(InstrumentTypeNames); i++) {
if (instype[0] != '\0') {
for (uint i = 0; i < IT_LAST; i++) {
if (!strcasecmp(instype, InstrumentTypeNames[i])) {
instrType = (InstrumentType)i;
break;
Expand Down
Loading
Loading