Stereo Record
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ set (CMAKE_INSTALL_PREFIX "/usr/")
|
|||||||
|
|
||||||
set (USE_PCH 1)
|
set (USE_PCH 1)
|
||||||
|
|
||||||
set (ENABLE_BACKTRACE 1)
|
set (ENABLE_BACKTRACE 0)
|
||||||
|
|
||||||
set (USE_SANITIZE OFF) # seems to be broken on Ubuntu 24.10
|
set (USE_SANITIZE OFF) # seems to be broken on Ubuntu 24.10
|
||||||
|
|
||||||
|
|||||||
@@ -2882,5 +2882,5 @@ void PiPedalModel::OnAlsaDriverTerminatedAbnormally() {
|
|||||||
|
|
||||||
bool PiPedalModel::IsInUploadsDirectory(const std::string &path)
|
bool PiPedalModel::IsInUploadsDirectory(const std::string &path)
|
||||||
{
|
{
|
||||||
return !storage.IsInUploadsDirectory(path);
|
return storage.IsInUploadsDirectory(path);
|
||||||
}
|
}
|
||||||
+1
-57
@@ -221,63 +221,7 @@ namespace pipedal
|
|||||||
return readSpace_();
|
return readSpace_();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool write_packet(size_t bytes, void *data)
|
|
||||||
{
|
|
||||||
if (MULTI_WRITER)
|
|
||||||
{
|
|
||||||
std::lock_guard writeLock{writeMutex};
|
|
||||||
if (writeSpace() < bytes + sizeof(bytes))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
size_t index = this->writePosition;
|
|
||||||
for (size_t i = 0; i < sizeof(bytes); ++i)
|
|
||||||
{
|
|
||||||
buffer[(index++() & ringBufferMask] = ((uint8_t*)(&bytes))[i];
|
|
||||||
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < bytes; ++i)
|
|
||||||
{
|
|
||||||
buffer[(index++) & ringBufferMask] = data[i];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::lock_guard lock(mutex);
|
|
||||||
this->writePosition = (index) & ringBufferMask;
|
|
||||||
}
|
|
||||||
if (SEMAPHORE_READER)
|
|
||||||
{
|
|
||||||
cvRead.notify_all();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (writeSpace() < bytes + sizeof(bytes))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
size_t index = this->writePosition;
|
|
||||||
for (size_t i = 0; i < sizeof(bytes); ++i)
|
|
||||||
{
|
|
||||||
buffer[(index++() & ringBufferMask] = ((uint8_t*)(&bytes))[i];
|
|
||||||
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < bytes; ++i)
|
|
||||||
{
|
|
||||||
buffer[(index++) & ringBufferMask] = data[i];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::lock_guard lock(mutex);
|
|
||||||
this->writePosition = (index) & ringBufferMask;
|
|
||||||
}
|
|
||||||
if (SEMAPHORE_READER)
|
|
||||||
{
|
|
||||||
cvRead.notify_all();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool write(size_t bytes, uint8_t *data)
|
bool write(size_t bytes, uint8_t *data)
|
||||||
{
|
{
|
||||||
if (MULTI_WRITER)
|
if (MULTI_WRITER)
|
||||||
|
|||||||
+44
-18
@@ -246,6 +246,26 @@ public:
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::string segment = request_uri.segment(1);
|
std::string segment = request_uri.segment(1);
|
||||||
|
if (segment == "downloadMediaFile") {
|
||||||
|
fs::path path = request_uri.query("path");
|
||||||
|
|
||||||
|
if (!fs::exists(path) || !this->model->IsInUploadsDirectory(path) || HasDotDot(path))
|
||||||
|
{
|
||||||
|
throw PiPedalException("File not found.");
|
||||||
|
}
|
||||||
|
auto mimeType = GetMimeType(path);
|
||||||
|
if (mimeType.empty()) {
|
||||||
|
throw PiPedalException("Can't download files of this type.");
|
||||||
|
}
|
||||||
|
res.set(HttpField::content_type, mimeType);
|
||||||
|
res.set(HttpField::cache_control, "no-cache");
|
||||||
|
std::string disposition = GetContentDispositionHeader(path.stem().string(), path.extension().string());
|
||||||
|
res.set(HttpField::content_disposition, disposition);
|
||||||
|
size_t contentLength = std::filesystem::file_size(path);
|
||||||
|
res.setContentLength(contentLength);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (segment == "downloadPluginPresets")
|
if (segment == "downloadPluginPresets")
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
@@ -263,6 +283,7 @@ public:
|
|||||||
res.set(HttpField::content_disposition, GetContentDispositionHeader(name, PLUGIN_PRESETS_EXTENSION));
|
res.set(HttpField::content_disposition, GetContentDispositionHeader(name, PLUGIN_PRESETS_EXTENSION));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (segment == "downloadPreset")
|
if (segment == "downloadPreset")
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
@@ -322,7 +343,29 @@ public:
|
|||||||
{
|
{
|
||||||
std::string segment = request_uri.segment(1);
|
std::string segment = request_uri.segment(1);
|
||||||
|
|
||||||
if (segment == "downloadPluginPresets")
|
if (segment == "downloadMediaFile") {
|
||||||
|
fs::path path = request_uri.query("path");
|
||||||
|
|
||||||
|
bool t = this->model->IsInUploadsDirectory(path);
|
||||||
|
std::cout << (t? "true": "false") << std::endl;
|
||||||
|
(void)t;
|
||||||
|
if (!fs::exists(path) || !this->model->IsInUploadsDirectory(path) || HasDotDot(path))
|
||||||
|
{
|
||||||
|
throw PiPedalException("File not found.");
|
||||||
|
}
|
||||||
|
auto mimeType = GetMimeType(path);
|
||||||
|
if (mimeType.empty()) {
|
||||||
|
throw PiPedalException("Can't download files of this type.");
|
||||||
|
}
|
||||||
|
res.set(HttpField::content_type, mimeType);
|
||||||
|
res.set(HttpField::cache_control, "no-cache");
|
||||||
|
std::string disposition = GetContentDispositionHeader(path.stem().string(), path.extension().string());
|
||||||
|
res.set(HttpField::content_disposition, disposition);
|
||||||
|
size_t contentLength = std::filesystem::file_size(path);
|
||||||
|
res.setContentLength(contentLength);
|
||||||
|
res.setBodyFile(path,false);
|
||||||
|
return;
|
||||||
|
} else if (segment == "downloadPluginPresets")
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string content;
|
std::string content;
|
||||||
@@ -451,23 +494,6 @@ public:
|
|||||||
{
|
{
|
||||||
std::string segment = request_uri.segment(1);
|
std::string segment = request_uri.segment(1);
|
||||||
|
|
||||||
if (segment == "downloadMediaFile") {
|
|
||||||
fs::path path = request_uri.query("path");
|
|
||||||
|
|
||||||
if (!fs::exists(path) || !this->model->IsInUploadsDirectory(path) || HasDotDot(path))
|
|
||||||
{
|
|
||||||
throw PiPedalException("File not found.");
|
|
||||||
}
|
|
||||||
auto mimeType = GetMimeType(path);
|
|
||||||
if (mimeType.empty()) {
|
|
||||||
throw PiPedalException("Can't download files of this type.");
|
|
||||||
}
|
|
||||||
res.set(HttpField::content_type, mimeType);
|
|
||||||
res.set(HttpField::cache_control, "no-cache");
|
|
||||||
std::string disposition = GetContentDispositionHeader(path.stem().string(), path.extension().string());
|
|
||||||
res.set(HttpField::content_disposition, disposition);
|
|
||||||
res.setBodyFile(path,false);
|
|
||||||
}
|
|
||||||
if (segment == "uploadPluginPresets")
|
if (segment == "uploadPluginPresets")
|
||||||
{
|
{
|
||||||
PluginPresets presets;
|
PluginPresets presets;
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ export interface FilePropertyDialogProps extends WithStyles<typeof styles> {
|
|||||||
instanceId: number,
|
instanceId: number,
|
||||||
selectedFile: string,
|
selectedFile: string,
|
||||||
onOk: (fileProperty: UiFileProperty, selectedItem: string) => void,
|
onOk: (fileProperty: UiFileProperty, selectedItem: string) => void,
|
||||||
|
onApply: (fileProperty: UiFileProperty, selectedItem: string) => void,
|
||||||
onCancel: () => void
|
onCancel: () => void
|
||||||
};
|
};
|
||||||
export interface FilePropertyDialogState {
|
export interface FilePropertyDialogState {
|
||||||
@@ -124,6 +125,7 @@ export interface FilePropertyDialogState {
|
|||||||
newFolderDialogOpen: boolean;
|
newFolderDialogOpen: boolean;
|
||||||
renameDialogOpen: boolean;
|
renameDialogOpen: boolean;
|
||||||
moveDialogOpen: boolean;
|
moveDialogOpen: boolean;
|
||||||
|
initialSelection: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function pathExtension(path: string) {
|
function pathExtension(path: string) {
|
||||||
@@ -218,7 +220,8 @@ export default withStyles(
|
|||||||
menuAnchorEl: null,
|
menuAnchorEl: null,
|
||||||
newFolderDialogOpen: false,
|
newFolderDialogOpen: false,
|
||||||
renameDialogOpen: false,
|
renameDialogOpen: false,
|
||||||
moveDialogOpen: false
|
moveDialogOpen: false,
|
||||||
|
initialSelection: this.props.selectedFile
|
||||||
};
|
};
|
||||||
this.requestScroll = true;
|
this.requestScroll = true;
|
||||||
}
|
}
|
||||||
@@ -380,6 +383,10 @@ export default withStyles(
|
|||||||
|
|
||||||
onSelectValue(fileEntry: FileEntry) {
|
onSelectValue(fileEntry: FileEntry) {
|
||||||
this.requestScroll = true;
|
this.requestScroll = true;
|
||||||
|
if (!fileEntry.isDirectory)
|
||||||
|
{
|
||||||
|
this.props.onApply(this.props.fileProperty,fileEntry.pathname);
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
selectedFile: fileEntry.pathname,
|
selectedFile: fileEntry.pathname,
|
||||||
selectedFileIsDirectory: fileEntry.isDirectory,
|
selectedFileIsDirectory: fileEntry.isDirectory,
|
||||||
@@ -756,7 +763,10 @@ export default withStyles(
|
|||||||
|
|
||||||
<div style={{ flex: "1 1 auto" }}> </div>
|
<div style={{ flex: "1 1 auto" }}> </div>
|
||||||
|
|
||||||
<Button variant="dialogSecondary" onClick={() => { this.props.onCancel(); }} aria-label="cancel">
|
<Button variant="dialogSecondary" onClick={() => {
|
||||||
|
this.props.onApply(this.props.fileProperty,this.state.initialSelection);
|
||||||
|
this.props.onCancel();
|
||||||
|
}} aria-label="cancel">
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="dialogPrimary" style={{ flex: "0 0 auto" }}
|
<Button variant="dialogPrimary" style={{ flex: "0 0 auto" }}
|
||||||
|
|||||||
@@ -779,6 +779,20 @@ const PluginControlView =
|
|||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
this.setState({ showFileDialog: false });
|
this.setState({ showFileDialog: false });
|
||||||
}}
|
}}
|
||||||
|
onApply={(fileProperty,selectedFile) => {
|
||||||
|
this.model.setPatchProperty(
|
||||||
|
this.props.instanceId,
|
||||||
|
fileProperty.patchProperty,
|
||||||
|
JsonAtom.Path(selectedFile)
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.model.showAlert("Unable to complete the operation. " + error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}}
|
||||||
onOk={(fileProperty, selectedFile) => {
|
onOk={(fileProperty, selectedFile) => {
|
||||||
|
|
||||||
this.model.setPatchProperty(
|
this.model.setPatchProperty(
|
||||||
|
|||||||
Reference in New Issue
Block a user