@@ -631,12 +631,15 @@ RHD2000Editor::RHD2000Editor(GenericProcessor* parentNode,
631631 // add HW audio parameter selection
632632 audioInterface = new AudioInterface (board, this );
633633 addAndMakeVisible (audioInterface);
634- audioInterface->setBounds (175 , 65 , 65 , 50 );
634+ audioInterface->setBounds (179 , 58 , 70 , 50 );
635635
636+ clockInterface = new ClockDivideInterface (board, this );
637+ addAndMakeVisible (clockInterface);
638+ clockInterface->setBounds (179 , 82 , 70 , 50 );
636639
637640 adcButton = new UtilityButton (" ADC 1-8" , Font (" Small Text" , 13 , Font::plain));
638641 adcButton->setRadius (3 .0f );
639- adcButton->setBounds (175 , 100 , 65 ,18 );
642+ adcButton->setBounds (179 , 108 , 70 ,18 );
640643 adcButton->addListener (this );
641644 adcButton->setClickingTogglesState (true );
642645 adcButton->setTooltip (" Enable/disable ADC channels" );
@@ -742,7 +745,7 @@ void RHD2000Editor::handleAsyncUpdate()
742745
743746 String path (CoreServices::RecordNode::getRecordingPath ().getFullPathName ()
744747 + File::separatorString + " impedance_measurement.xml" );
745- std::cout << " Saving impedance measurements in " << path << std::endl ;
748+ std::cout << " Saving impedance measurements in " << path << " \n " ;
746749 File file (path);
747750
748751 if (!file.getParentDirectory ().exists ())
@@ -840,17 +843,17 @@ void RHD2000Editor::buttonEvent(Button* button)
840843 {
841844 board->enableAdcs (button->getToggleState ());
842845 // board->updateChannelNames();
843- std::cout << " ADC Button toggled" << std::endl ;
846+ std::cout << " ADC Button toggled" << " \n " ;
844847 CoreServices::updateSignalChain (this );
845- std::cout << " Editor visible." << std::endl ;
848+ std::cout << " Editor visible." << " \n " ;
846849 }
847850 else if (button == dacTTLButton)
848851 {
849852 board->setTTLoutputMode (dacTTLButton->getToggleState ());
850853 }
851854 else if (button == dspoffsetButton && !acquisitionIsActive)
852855 {
853- std::cout << " DSP offset " << button->getToggleState () << std::endl ;
856+ std::cout << " DSP offset " << button->getToggleState () << " \n " ;
854857 board->setDSPOffset (button->getToggleState ());
855858 }
856859 else if (button == ledButton)
@@ -1027,8 +1030,8 @@ void BandwidthInterface::labelTextChanged(Label* label)
10271030
10281031 actualUpperBandwidth = board->setUpperBandwidth (requestedValue);
10291032
1030- std::cout << " Setting Upper Bandwidth to " << requestedValue << std::endl ;
1031- std::cout << " Actual Upper Bandwidth: " << actualUpperBandwidth << std::endl ;
1033+ std::cout << " Setting Upper Bandwidth to " << requestedValue << " \n " ;
1034+ std::cout << " Actual Upper Bandwidth: " << actualUpperBandwidth << " \n " ;
10321035 label->setText (String (round (actualUpperBandwidth*10 .f )/10 .f ), dontSendNotification);
10331036
10341037 }
@@ -1049,8 +1052,8 @@ void BandwidthInterface::labelTextChanged(Label* label)
10491052
10501053 actualLowerBandwidth = board->setLowerBandwidth (requestedValue);
10511054
1052- std::cout << " Setting Lower Bandwidth to " << requestedValue << std::endl ;
1053- std::cout << " Actual Lower Bandwidth: " << actualLowerBandwidth << std::endl ;
1055+ std::cout << " Setting Lower Bandwidth to " << requestedValue << " \n " ;
1056+ std::cout << " Actual Lower Bandwidth: " << actualLowerBandwidth << " \n " ;
10541057
10551058 label->setText (String (round (actualLowerBandwidth*10 .f )/10 .f ), dontSendNotification);
10561059 }
@@ -1157,7 +1160,7 @@ void SampleRateInterface::comboBoxChanged(ComboBox* cb)
11571160 {
11581161 board->setSampleRate (cb->getSelectedId ()-1 );
11591162
1160- std::cout << " Setting sample rate to index " << cb->getSelectedId ()-1 << std::endl ;
1163+ std::cout << " Setting sample rate to index " << cb->getSelectedId ()-1 << " \n " ;
11611164
11621165 CoreServices::updateSignalChain (editor);
11631166 }
@@ -1286,15 +1289,15 @@ void HeadstageOptionsInterface::buttonClicked(Button* button)
12861289 if (!(editor->acquisitionIsActive ) && board->foundInputSource ())
12871290 {
12881291
1289- // std::cout << "Acquisition is not active" << std::endl ;
1292+ // std::cout << "Acquisition is not active" << "\n" ;
12901293 if ((button == hsButton1) && (board->getChannelsInHeadstage (hsNumber1) == 32 ))
12911294 {
12921295 if (channelsOnHs1 == 32 )
12931296 channelsOnHs1 = 16 ;
12941297 else
12951298 channelsOnHs1 = 32 ;
12961299
1297- // std::cout << "HS1 has " << channelsOnHs1 << " channels." << std::endl ;
1300+ // std::cout << "HS1 has " << channelsOnHs1 << " channels." << "\n" ;
12981301
12991302 hsButton1->setLabel (String (channelsOnHs1));
13001303 board->setNumChannels (hsNumber1, channelsOnHs1);
@@ -1390,7 +1393,7 @@ void AudioInterface::labelTextChanged(Label* label)
13901393
13911394 actualNoiseSlicerLevel = board->setNoiseSlicerLevel (requestedValue);
13921395
1393- std::cout << " Setting Noise Slicer Level to " << requestedValue << std::endl ;
1396+ std::cout << " Setting Noise Slicer Level to " << requestedValue << " \n " ;
13941397 label->setText (String ((roundFloatToInt)(actualNoiseSlicerLevel)), dontSendNotification);
13951398
13961399 }
@@ -1424,16 +1427,66 @@ void AudioInterface::paint(Graphics& g)
14241427{
14251428
14261429 g.setColour (Colours::darkgrey);
1427-
14281430 g.setFont (Font (" Small Text" ,9 ,Font::plain));
1429-
14301431 g.drawText (name, 0 , 0 , 200 , 15 , Justification::left, false );
1431-
14321432 g.drawText (" Level: " , 0 , 10 , 200 , 20 , Justification::left, false );
1433+ }
1434+
1435+
1436+ // Clock Divider options
1437+ ClockDivideInterface::ClockDivideInterface (RHD2000Thread* board_,
1438+ RHD2000Editor* editor_) :
1439+ board(board_)
1440+ , editor(editor_)
1441+
1442+ {
1443+ divideRatioSelection = new Label (" Clock Divider" , lastDivideRatioString);
1444+ divideRatioSelection->setEditable (true ,false ,false );
1445+ divideRatioSelection->addListener (this );
1446+ divideRatioSelection->setBounds (30 ,10 ,30 ,20 );
1447+ divideRatioSelection->setColour (Label::textColourId, Colours::darkgrey);
1448+ addAndMakeVisible (divideRatioSelection);
1449+ }
1450+
1451+ void ClockDivideInterface::labelTextChanged (Label* label)
1452+ {
1453+ if (board->foundInputSource ())
1454+ {
1455+ if (label == divideRatioSelection)
1456+ {
1457+ Value val = label->getTextValue ();
1458+ int requestedValue = int (val.getValue ());
1459+
1460+ if (requestedValue < 1 || requestedValue > 65534 )
1461+ {
1462+ CoreServices::sendStatusMessage (" Value must be between 1 and 65534." );
1463+ label->setText (lastDivideRatioString, dontSendNotification);
1464+ return ;
1465+ }
1466+
1467+ actualDivideRatio = board->setClockDivider (requestedValue);
1468+ lastDivideRatioString = String (actualDivideRatio);
14331469
1470+ std::cout << " Setting clock divide ratio to " << actualDivideRatio << " \n " ;
1471+ label->setText (lastDivideRatioString, dontSendNotification);
1472+ }
1473+ }
14341474}
14351475
1476+ void ClockDivideInterface::setClockDivideRatio (int value)
1477+ {
1478+ actualDivideRatio = board->setClockDivider (value);
1479+ divideRatioSelection->setText (String (actualDivideRatio), dontSendNotification);
1480+ }
14361481
1482+ void ClockDivideInterface::paint (Graphics& g)
1483+ {
1484+
1485+ g.setColour (Colours::darkgrey);
1486+ g.setFont (Font (" Small Text" ,9 ,Font::plain));
1487+ g.drawText (name, 0 , 0 , 200 , 15 , Justification::left, false );
1488+ g.drawText (" Level: " , 0 , 10 , 200 , 20 , Justification::left, false );
1489+ }
14371490
14381491// DSP Options --------------------------------------------------------------------
14391492
@@ -1472,8 +1525,8 @@ void DSPInterface::labelTextChanged(Label* label)
14721525
14731526 actualDspCutoffFreq = board->setDspCutoffFreq (requestedValue);
14741527
1475- std::cout << " Setting DSP Cutoff Freq to " << requestedValue << std::endl ;
1476- std::cout << " Actual DSP Cutoff Freq: " << actualDspCutoffFreq << std::endl ;
1528+ std::cout << " Setting DSP Cutoff Freq to " << requestedValue << " \n " ;
1529+ std::cout << " Actual DSP Cutoff Freq: " << actualDspCutoffFreq << " \n " ;
14771530 label->setText (String (round (actualDspCutoffFreq*10 .f )/10 .f ), dontSendNotification);
14781531
14791532 }
0 commit comments