String RecordNode::generateHeader(Channel* ch) { String header = "header.format = 'Open Ephys Data Format'; \n"; header += "header.version = 0.2;"; header += "header.header_bytes = "; header += String(HEADER_SIZE); header += ";\n"; if (ch->isEventChannel) { header += "header.description = 'each record contains one 64-bit timestamp, one 16-bit sample position, one uint8 event type, one uint8 processor ID, one uint8 event ID, one uint8 event channel, and one uint16 recordingNumber'; \n"; } else { header += "header.description = 'each record contains one 64-bit timestamp, one 16-bit sample count (N), 1 uint16 recordingNumber, N 16-bit samples, and one 10-byte record marker (0 1 2 3 4 5 6 7 8 255)'; \n"; } header += "header.date_created = '"; header += generateDateString(); header += "';\n"; header += "header.channel = '"; header += ch->name; header += "';\n"; if (ch->isEventChannel) { header += "header.channelType = 'Event';\n"; } else { header += "header.channelType = 'Continuous';\n"; } header += "header.sampleRate = "; // all channels need to have the same sample rate under the current scheme header += String(channelPointers[0]->sampleRate); header += ";\n"; header += "header.blockLength = "; header += BLOCK_LENGTH; header += ";\n"; header += "header.bufferSize = "; header += getAudioComponent()->getBufferSize(); header += ";\n"; header += "header.bitVolts = "; header += String(ch->bitVolts); header += ";\n"; header = header.paddedRight(' ', HEADER_SIZE); //std::cout << header << std::endl; return header; }
void AudioEditor::buttonClicked(Button* button) { if (button == muteButton) { if (muteButton->getToggleState()) { lastValue = volumeSlider->getValue(); getAudioProcessor()->setParameter(1,0.0f); std::cout << "Mute on." << std::endl; } else { getAudioProcessor()->setParameter(1,lastValue); std::cout << "Mute off." << std::endl; } } else if (button == audioWindowButton) { if (audioWindowButton->getToggleState()) { if (acw == 0) { // AudioComponent* audioComponent = getAudioComponent(); // audioComponent->restartDevice(); // if (audioComponent != 0) { acw = new AudioConfigurationWindow(getAudioComponent()->deviceManager, (Button*) audioWindowButton); acw->setUIComponent(getUIComponent()); //} } getAudioComponent()->restartDevice(); acw->setVisible(true); } else { acw->setVisible(false); //deleteAndZero(acw); getAudioComponent()->stopDevice(); } } }
void UIComponent::getCommandInfo(CommandID commandID, ApplicationCommandInfo& result) { bool acquisitionStarted = getAudioComponent()->callbacksAreActive(); switch (commandID) { case openConfiguration: result.setInfo("Open...", "Load a saved processor graph.", "General", 0); result.addDefaultKeypress('O', ModifierKeys::commandModifier); result.setActive(!acquisitionStarted); break; case saveConfiguration: result.setInfo("Save", "Save the current processor graph.", "General", 0); result.addDefaultKeypress('S', ModifierKeys::commandModifier); break; case saveConfigurationAs: result.setInfo("Save as...", "Save the current processor graph with a new name.", "General", 0); result.addDefaultKeypress('S', ModifierKeys::commandModifier | ModifierKeys::shiftModifier); break; case reloadOnStartup: result.setInfo("Reload on startup", "Load the last used configuration on startup.", "General", 0); result.setActive(!acquisitionStarted); result.setTicked(mainWindow->shouldReloadOnStartup); break; case undo: result.setInfo("Undo", "Undo the last action.", "General", 0); result.addDefaultKeypress('Z', ModifierKeys::commandModifier); result.setActive(false); break; case redo: result.setInfo("Redo", "Undo the last action.", "General", 0); result.addDefaultKeypress('Y', ModifierKeys::commandModifier); result.setActive(false); break; case copySignalChain: result.setInfo("Copy", "Copy a portion of the signal chain.", "General", 0); result.addDefaultKeypress('C', ModifierKeys::commandModifier); result.setActive(false); break; case pasteSignalChain: result.setInfo("Paste", "Paste a portion of the signal chain.", "General", 0); result.addDefaultKeypress('V', ModifierKeys::commandModifier); result.setActive(false); break; case clearSignalChain: result.setInfo("Clear signal chain", "Clear the current signal chain.", "General", 0); result.addDefaultKeypress(KeyPress::backspaceKey, ModifierKeys::commandModifier); result.setActive(!getEditorViewport()->isSignalChainEmpty() && !acquisitionStarted); break; case toggleProcessorList: result.setInfo("Processor List", "Show/hide Processor List.", "General", 0); result.addDefaultKeypress('P', ModifierKeys::shiftModifier); result.setTicked(processorList->isOpen()); break; case toggleSignalChain: result.setInfo("Signal Chain", "Show/hide Signal Chain.", "General", 0); result.addDefaultKeypress('S', ModifierKeys::shiftModifier); result.setTicked(editorViewportButton->isOpen()); break; case toggleFileInfo: result.setInfo("File Info", "Show/hide File Info.", "General", 0); result.addDefaultKeypress('F', ModifierKeys::shiftModifier); result.setTicked(controlPanel->isOpen()); break; case showHelp: result.setInfo("Show help...", "Take me to the GUI wiki.", "General", 0); result.setActive(true); break; case resizeWindow: result.setInfo("Reset window bounds", "Reset window bounds", "General", 0); break; default: break; }; }
void AudioConfigurationWindow::closeButtonPressed() { controlButton->setToggleState(false,false); getAudioComponent()->stopDevice(); setVisible(false); }