CSL  6.0
CSL_AbstComponent.cpp
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This is an automatically generated file created by the Jucer!
5 
6  Creation date: 17 Sep 2009 3:29:44 pm
7 
8  Be careful when adding custom code to these files, as only the code within
9  the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
10  and re-saved.
11 
12  Jucer version: 1.12
13 
14  ------------------------------------------------------------------------------
15 
16  The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
17  Copyright 2004-6 by Raw Material Software ltd.
18 
19  ==============================================================================
20 */
21 
22 //[Headers] You can add your own extra header files here...
23 
24 //[/Headers]
25 
26 #include "CSL_AbstComponent.h"
27 
28 
29 //[MiscUserDefs] You can add your own user definitions and misc code here...
30 
31 using namespace csl;
32 
33 // The main() function reads argv[1] as the suite selector (from the above list, 1-based)
34 // and argv[2] as the test within the suite, e.g., use "2 10" to select the 10th test in the
35 // srcTestList suite ("Vector IFFT" -- found at the bottom of Test_Sources.cpp).
36 // This is useful for debugging; set up the GUI to run the test you're working on.
37 
38 // Globals are here
39 
40 extern IO * theIO; // global IO object accessed by other threads
41 juce::Label* gCPULabel; // CPU % label...
42 juce::AudioDeviceManager * gAudioDeviceManager; // global JUCE audio device mgr
43 //unsigned argCnt; // globals for argc/v from cmd-line
44 //const char **argVals;
45 VoidFcnPtrN * gFcn; // test function ptr
46 
47 #define WRITE_TO_FILE // support file recording
48 #ifdef WRITE_TO_FILE
49  Buffer * gFileBuffer = 0; // global buffer for file cache
50  int gSampIndex = 0; // write index into out buffer
51 #endif
52 
53 //
54 // LThread run function spawns/loops its CThread and sleeps interruptably
55 //
56 
57 void LThread::run() {
58  while (1) { // endless loop
59  if (thr->isThreadRunning()) // sleep some
60  if (csl::sleepMsec(250)) // interruptable sleep, check for failure
61  goto turn_off;
62  if (this->threadShouldExit()) // check flag
63  goto turn_off;
64  if ( ! thr->isThreadRunning()) { // if off
65  if (loop)
66  thr->startThread(); // restart if looping
67  else {
68 turn_off: if (CGestalt::stopNow()) { // if a timer was interrupted
69  CGestalt::clearStopNow(); // clear the global flag
70  thr->signalThreadShouldExit();
71  }
72  comp->playing = false;
73  const juce::MessageManagerLock mmLock; // create a lock to call the GUI thread here
74  if (comp->isTimerRunning())
75  comp->stopTimer(); // nasty to do this from here, but it freezes the GUI
76 // if (comp->playButton)
77 // comp->playButton->setButtonText(T("Play"));
78  if (comp->recrding)
79  comp->recordOnOff();
80  return;
81  }
82  }
83  }
84 }
85 
86 //[/MiscUserDefs]
87 
88 //==============================================================================
90  : Component(),
91  playThread(0), loopThread(0), amplValue(1.0f),
92  loop(false), recrding(false), playing(false), displayMode(true), changed(false) {
93 
94  //[UserPreSize]
95  //[/UserPreSize]
96 
97  setSize (600, 400);
98 
99  //[Constructor] You can add your own custom stuff here..
100 
101 ////////////////////////////// Here we go! //////////////////////////////////////////
102 
103  // CSL Code starts here
104 
105  // initiali[zs]e the device manager so it picks a default device to use.
106  const juce::String error (mAudioDeviceManager.initialise (CGestalt::numInChannels(), /* stereo input */
107  CGestalt::numOutChannels(), /* stereo output */
108  0, /* no XML defaults */
109  true /* select default device */));
110  if (error.isNotEmpty())
111  juce::AlertWindow::showMessageBox (juce::AlertWindow::WarningIcon,
112  "CSL 6 Demo",
113  "Couldn't open an output device!\n\n" + error);
114  // get the audio device
115  juce::AudioIODevice* audioIO = mAudioDeviceManager.getCurrentAudioDevice();
116 // unsigned sRate = (unsigned) audioIO->getCurrentSampleRate();
117 // unsigned bufSize = audioIO->getCurrentBufferSizeSamples();
118 
119 #ifdef READ_IO_PROPS // overwrite the system frame rate and block size from the
120  // selected hardware interface at startup time
121  theIO = new csl::IO(sRate, bufSize, -1, -1, // still use the default # IO channels
122  CGestalt::numInChannels(), CGestalt::numOutChannels());
123 #else // reset the HW frame rate & block size to the CSL definition
124  juce::AudioDeviceManager::AudioDeviceSetup setup;
125  mAudioDeviceManager.getAudioDeviceSetup(setup);
126  setup.bufferSize = CGestalt::blockSize();
127  setup.sampleRate = CGestalt::frameRate();
128  mAudioDeviceManager.setAudioDeviceSetup(setup,true);
129  // set up CSL IO
130  theIO = new csl::IO(CGestalt::frameRate(), CGestalt::blockSize(), -1, -1,
131  CGestalt::numInChannels(), CGestalt::numOutChannels());
132 #endif
133  theIO->start(); // start IO and register callback
134  mAudioDeviceManager.addAudioCallback(this);
135 
137  playThread = 0;
138  loopThread = 0;
139 
140  //[/Constructor]
141 }
142 
144 {
145  //[Destructor_pre]. You can add your own custom destruction code here..
146 
147  if (playing) // CSL shut-down
148  this->startStop(NULL);
149  playing = false;
150  mAudioDeviceManager.removeAudioCallback(this);
151  if (gFileBuffer) {
152  gFileBuffer->freeBuffers();
153  delete gFileBuffer;
154  }
155 
156  //[/Destructor_pre]
157 
158 
159  //[Destructor]. You can add your own custom destruction code here..
160  //[/Destructor]
161 }
162 
163 
164 //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
165 
166 /////////////// CSL/JUCE Audio callback method ///////////////////
167 
168 void CSLAbstComponent::audioDeviceIOCallback (const float** inputChannelData,
169  int totalNumInputChannels,
170  float** outputChannelData,
171  int totalNumOutputChannels,
172  int numSamples) {
173  // put silence in the output buffers
174  for (unsigned i = 0; i < totalNumOutputChannels; i++)
175  memset(outputChannelData[i], 0, numSamples * sizeof(float));
176 
177  if ( ! playing) // if off
178  return;
179  if (CGestalt::stopNow()) // if being interrupted
180  return;
181  // set up CSL buffer object
182  if (theIO->mGraph) {
183  outBuffer.setSize(totalNumOutputChannels, numSamples);
184  // copy JUCE data ptrs
185  for (unsigned i = 0; i < totalNumOutputChannels; i++)
186  outBuffer.setBuffer(i, outputChannelData[i]);
187 
188  try { //////
189  // Set up the input pointers and
190  // Tell the IO to call its graph
191  //////
192  theIO->mInputBuffer.setSize(totalNumInputChannels, numSamples);
193  for (unsigned i = 0; i < totalNumInputChannels; i++)
194  theIO->mInputBuffer.setBuffer(i, (sample *)inputChannelData[i]);
195  theIO->pullInput(outBuffer);
196  } catch (csl::CException e) {
197  logMsg(kLogError, "Error running CSL: graph: %s\n", e.what());
198  }
199  if (amplValue != 1.0f) { // scale by volume slider
200  // channel loop
201  for (unsigned i = 0; i < totalNumOutputChannels; i++) {
202  float * sampPtr = outputChannelData[i];
203  // frame loop
204  for (unsigned j = 0; j < numSamples; j++)
205  *sampPtr++ *= amplValue;
206  }}
207  if (recrding) { // cache to (stereo) record buffer
208  if (gSampIndex >= SAMPS_TO_WRITE)
209  return;
210  if ( ! gFileBuffer)
211  return;
212  // get cache ptrs & copy outbuf
213  csl::sample * sPtr = gFileBuffer->buffer(0) + gSampIndex;
214  memcpy(sPtr, outputChannelData[0], (numSamples * sizeof(csl::sample)));
215  sPtr = gFileBuffer->buffer(1) + gSampIndex;
216  memcpy(sPtr, outputChannelData[1], (numSamples * sizeof(csl::sample)));
217  // update ptrs
218  gSampIndex += numSamples;
219  gFileBuffer->mNumFrames = gSampIndex;
220  }
221  } // if mGraph
222 }
223 
224 // Handle file output in record mode; creates a remp file named "dataFolder(), OUT_SFILE_NAME"
225 // such as /Users/stp/Code/CSL/CSL_Data/02_csl_out.aiff
226 // The template is XX_csl_out.aiff, could be like CSL_TakeXX.aiff.
227 // Increments the field XX in the name template with integers, wrapping at 100.
228 //
229 
231  if (recrding) { // stop recording and write output file
232  recrding = false; // reset flag checked in audioDeviceIOCallback
233  if (gFileBuffer->mNumFrames == 0)
234  return;
235  string outName = CGestalt::sndFileName();
236  // write to snd file
237  logMsg("Write %5.3f sec (%d ksamp) to file \"%s\"\n",
238  ((float) gSampIndex / CGestalt::frameRate()), gSampIndex / 1000, outName.c_str());
239  SoundFile * ioFile = new SoundFile(outName);
240  ioFile->openForWrite(kSoundFileFormatAIFF, 2);
241  ioFile->writeBuffer(*gFileBuffer); // snd file write of record buffer
242  ioFile->close();
243  delete ioFile;
244  } else { // start recording
245  if ( ! gFileBuffer) { // allocate buffer first time
246  gFileBuffer = new Buffer(2, SAMPS_TO_WRITE + CGestalt::maxBufferFrames());
247  gFileBuffer->allocateBuffers();
248  }
249  recrding = true; // set flag checked in audioDeviceIOCallback
250  }
251  gSampIndex = 0; // reset write ptr
252  gFileBuffer->mNumFrames = gSampIndex;
253 }
254 
255 // Audio device support
256 
257 void CSLAbstComponent::audioDeviceAboutToStart (juce::AudioIODevice* device) {
258 // oscilloscopeL->audioDeviceAboutToStart (device);
259 // oscilloscopeR->audioDeviceAboutToStart (device);
260 // csl::CGestalt::setBlockSize(numSamplesPerBlock);
261 }
262 
264 // oscilloscope->audioDeviceStopped();
265 }
266 
267 // timer call
268 
270  if (! gCPULabel) return;
271  const juce::MessageManagerLock mmLock; // create the lock so we can call the GUI thread from this thread
272  char msg[10]; // print the CPU usage
273  sprintf(msg, "%5.2f%%", (gAudioDeviceManager->getCpuUsage() * 100.0));
274  juce::String msgS(msg);
275  gCPULabel->setText(msgS, juce::sendNotification);
276 }
277 
278 // start/stop
279 
281  if ( ! playing) { // if not playing, start!
282  playing = true;
283  CGestalt::clearStopNow(); // clear flag
284  // create a threadfcn that plays CSL
285  ThreadFunc fcn = (void * (*)(void *)) fcn;
286 
287  playThread = new GThread(fcn); // thread to call the CSL test function
288  playThread->startThread();
289  loopThread = new LThread(playThread, this, loop); // thread to wait and/or loop it
290  loopThread->startThread();
291 // playButton->setButtonText (T("Stop"));
292  this->startTimer(1000); // 1-sec timer
293  } else { // if playing
294  playing = false;
295  theIO->clearRoot();
296  this->stopTimer();
297  CGestalt::setStopNow(); // set flag to clear timers
298  if (recrding)
299  recordOnOff();
300  sleepMsec(100);
301  if (loop)
302  loopThread->stopThread(1000);
303  if (playThread->isThreadRunning())
304  playThread->stopThread(1000); // try to kill
305  delete playThread;
306  playThread = 0;
307 // playButton->setButtonText (T("Play"));
308  CGestalt::clearStopNow(); // clear flag
309  }
310 }
311 
312 // CSLSignalComponent constructor
313 
315  : CSLAbstComponent(),
316  playButton (0),
317  quitButton (0),
318  prefsButton (0),
319  cpuLabel (0),
320  VUMeterL (0),
321  VUMeterR (0),
322  amplitudeSlider (0),
323  loopButton (0),
324  recordButton (0)
325 {
326  addAndMakeVisible (playButton = new juce::TextButton ("playNote"));
327  playButton->setButtonText ("Play/Stop");
328  playButton->addListener (this);
329 
330  addAndMakeVisible (quitButton = new juce::TextButton ("quitAction"));
331  quitButton->setButtonText ("Quit");
332  quitButton->addListener (this);
333 
334  addAndMakeVisible (prefsButton = new juce::TextButton ("new button"));
335  prefsButton->setButtonText ("Audio Prefs");
336  prefsButton->addListener (this);
337 
338  addAndMakeVisible (cpuLabel = new juce::Label("new label", "0.0%"));
339  cpuLabel->setFont (juce::Font (juce::Font::getDefaultSansSerifFontName(), 15.0000f, juce::Font::bold));
340  cpuLabel->setJustificationType (juce::Justification::centredRight);
341  cpuLabel->setEditable (false, false, false);
342  cpuLabel->setColour (juce::TextEditor::textColourId, juce::Colours::black);
343  cpuLabel->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x0));
344 
345  addAndMakeVisible (VUMeterL = new VUMeter());
346  VUMeterL->setName ("new component");
347 
348  addAndMakeVisible (VUMeterR = new VUMeter());
349  VUMeterR->setName ("new component");
350 
351  addAndMakeVisible (amplitudeSlider = new juce::Slider ("new slider"));
352  amplitudeSlider->setRange (-5, 5, 0);
353  amplitudeSlider->setSliderStyle (juce::Slider::LinearVertical);
354  amplitudeSlider->setTextBoxStyle (juce::Slider::NoTextBox, true, 80, 20);
355  amplitudeSlider->addListener (this);
356 
357  addAndMakeVisible (loopButton = new juce::ToggleButton ("new toggle button"));
358  loopButton->setButtonText ("Loop");
359  loopButton->addListener (this);
360 
361  addAndMakeVisible (recordButton = new juce::ToggleButton ("new toggle button"));
362  recordButton->setButtonText ("Record");
363  recordButton->addListener (this);
364 
365  amplitudeSlider->setValue(-0.2); // GUI settings
366  VUMeterL->setChannel(0);
367  VUMeterR->setChannel(1);
368  loopButton->setToggleState (false, false);
369  gCPULabel = cpuLabel; // component settings
370 }
371 
373 {
374  //[Destructor_pre]. You can add your own custom destruction code here..
375  //[/Destructor_pre]
376 
377  deleteAndZero (playButton);
378  deleteAndZero (quitButton);
379  deleteAndZero (prefsButton);
380  deleteAndZero (cpuLabel);
381  deleteAndZero (VUMeterL);
382  deleteAndZero (VUMeterR);
383  deleteAndZero (amplitudeSlider);
384  deleteAndZero (loopButton);
385  deleteAndZero (recordButton);
386 
387  //[Destructor]. You can add your own custom destruction code here..
388  //[/Destructor]
389 }
390 
391 void CSLSignalComponent::audioDeviceIOCallback (const float** inputChannelData,
392  int totalNumInputChannels,
393  float** outputChannelData,
394  int totalNumOutputChannels,
395  int numSamples) {
396  // call the inherited version
397  CSLAbstComponent::audioDeviceIOCallback (inputChannelData, totalNumInputChannels,
398  outputChannelData, totalNumOutputChannels, numSamples);
399  if (theIO->mGraph) {
400  // pass the audio callback on to the waveform display components
401  VUMeterL->audioDeviceIOCallback (inputChannelData, totalNumInputChannels,
402  outputChannelData, totalNumOutputChannels, numSamples);
403  VUMeterR->audioDeviceIOCallback (inputChannelData, totalNumInputChannels,
404  outputChannelData, totalNumOutputChannels, numSamples);
405 
406  } // if mGraph
407 }
408 
410 {
411  playButton->setBounds (336, getHeight() - 39, 136, 32);
412  quitButton->setBounds (getWidth() - 8 - 176, 8, 176, 32);
413  prefsButton->setBounds (8, 8, 144, 32);
414  cpuLabel->setBounds (getWidth() - 64, getHeight() - 35, 56, 24);
415  VUMeterL->setBounds (25, 48, 15, juce::roundFloatToInt ((proportionOfHeight (0.3400f)) * 1.0000f));
416  VUMeterR->setBounds (24, proportionOfHeight (0.5000f), 15, juce::roundFloatToInt ((proportionOfHeight (0.3400f)) * 1.0000f));
417  amplitudeSlider->setBounds (0, 43, 20, proportionOfHeight (0.7475f));
418  loopButton->setBounds ((336) + 144, getHeight() - 11 - 24, 64, 24);
419  recordButton->setBounds ((getWidth() - 8 - 176) + -2 - 72, 37 - 24, 72, 24);
420  //[UserResized] Add your own custom resize handling here..
421  //[/UserResized]
422 }
423 
424 void CSLSignalComponent::buttonClicked (juce::Button* buttonThatWasClicked)
425 {
426  //[UserbuttonClicked_Pre]
427  //[/UserbuttonClicked_Pre]
428 
429  if (buttonThatWasClicked == playButton)
430  {
431  //[UserButtonCode_playButton] -- add your button handler code here..
432 
433  this->startStop(gFcn);
434 
435  //[/UserButtonCode_playButton]
436  }
437  else if (buttonThatWasClicked == quitButton)
438  {
439  //[UserButtonCode_quitButton] -- add your button handler code here..
440 
441  if (playing)
442  this->startStop(gFcn);
443  juce::JUCEApplication::quit();
444 
445  //[/UserButtonCode_quitButton]
446  }
447  else if (buttonThatWasClicked == prefsButton)
448  {
449  //[UserButtonCode_prefsButton] -- add your button handler code here..
450 
451  // Create an AudioDeviceSelectorComponent which contains the audio choice widgets...
452 // if (displayMode) {
453 // oscilloscopeL->stop(); // stop scope display during dialog
454 // oscilloscopeR->stop();
455 // } else {
456 // spectrogam->stop();
457 // }
458 // AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
459 // const int minAudioInputChannels,
460 // const int maxAudioInputChannels,
461 // const int minAudioOutputChannels,
462 // const int maxAudioOutputChannels,
463 // const bool showMidiInputOptions,
464 // const bool showMidiOutputSelector,
465 // const bool showChannelsAsStereoPairs,
466 // const bool hideAdvancedOptionsWithButton);
467 
468  juce::AudioDeviceSelectorComponent audioSettingsComp (mAudioDeviceManager,
469  CGestalt::numInChannels(), CGestalt::numInChannels(),
470  CGestalt::numOutChannels(), CGestalt::numOutChannels(),
471  true, true,
472  false, false);
473  // ...and show it in a DialogWindow...
474  audioSettingsComp.setSize (500, 400);
475  juce::DialogWindow::showModalDialog ("Audio Settings",
476  &audioSettingsComp,
477  this,
478  juce::Colours::azure,
479  true);
480 // if (displayMode) {
481 // oscilloscopeL->start(); // stop scope display during dialog
482 // oscilloscopeR->start();
483 // } else {
484 // spectrogam->start();
485 // }
486 
487  //[/UserButtonCode_prefsButton]
488  }
489  else if (buttonThatWasClicked == loopButton)
490  {
491  //[UserButtonCode_loopButton] -- add your button handler code here..
492 
493  if (loop) {
494  if (loopThread) {
495  loopThread->stopThread(100);
496  delete loopThread;
497  loopThread = 0;
498  }
499  }
500  loop = ! loop;
501 
502  //[/UserButtonCode_loopButton]
503  }
504  else if (buttonThatWasClicked == recordButton)
505  {
506  //[UserButtonCode_recordButton] -- add your button handler code here..
507 
508  bool wasRec = recrding;
509  recordOnOff();
510  if (wasRec)
511  recrding = false;
512 
513  //[/UserButtonCode_recordButton]
514  }
515 
516  //[UserbuttonClicked_Post]
517  //[/UserbuttonClicked_Post]
518 }
519 
520 void CSLSignalComponent::comboBoxChanged (juce::ComboBox* comboBoxThatHasChanged)
521 {
522  //[UsercomboBoxChanged_Pre]
523  //[/UsercomboBoxChanged_Pre]
524 
525 
526  //[UsercomboBoxChanged_Post]
527  //[/UsercomboBoxChanged_Post]
528 }
529 
530 void CSLSignalComponent::sliderValueChanged (juce::Slider* sliderThatWasMoved)
531 {
532  //[UsersliderValueChanged_Pre]
533  //[/UsersliderValueChanged_Pre]
534 
535  if (sliderThatWasMoved == amplitudeSlider)
536  {
537  //[UserSliderCode_amplitudeSlider] -- add your slider handling code here..
538 
539  amplValue = pow(2.0, amplitudeSlider->getValue());
540 
541  //[/UserSliderCode_amplitudeSlider]
542  }
543 
544  //[UsersliderValueChanged_Post]
545  //[/UsersliderValueChanged_Post]
546 }
547 
548 //[/MiscUserCode]
549 
550 
551 //==============================================================================
552 #if 0
553 /* -- Jucer information section --
554 
555  This is where the Jucer puts all of its metadata, so don't change anything in here!
556 
557 BEGIN_JUCER_METADATA
558 
559 <JUCER_COMPONENT documentType="Component" className="CSLAbstComponent" componentName=""
560  parentClasses="public Component, public AudioIODeviceCallback, public Timer"
561  constructorParams="" variableInitialisers="" snapPixels="8" snapActive="1"
562  snapShown="1" overlayOpacity="0.330000013" fixedSize="1" initialWidth="600"
563  initialHeight="400">
564  <BACKGROUND backgroundColour="ffaeaeae"/>
565  <TEXTBUTTON name="playNote" id="ed1811e776eea99b" memberName="playButton"
566  virtualName="" explicitFocusOrder="0" pos="336 39R 136 32" buttonText="Play"
567  connectedEdges="0" needsCallback="1" radioGroupId="0"/>
568  <TEXTBUTTON name="quitAction" id="dbaf2871fd41de83" memberName="quitButton"
569  virtualName="" explicitFocusOrder="0" pos="8Rr 8 176 32" buttonText="Quit"
570  connectedEdges="0" needsCallback="1" radioGroupId="0"/>
571  <COMBOBOX name="test to run" id="bd1a5c541fbc8bc7" memberName="testCombo"
572  virtualName="" explicitFocusOrder="0" pos="152 35R 176 24" editable="0"
573  layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
574  <GENERICCOMPONENT name="new component" id="d64c351a292a43a4" memberName="oscilloscopeL"
575  virtualName="" explicitFocusOrder="0" pos="44 48 52M 34%" class="AudioWaveformDisplay"
576  params=""/>
577  <LABEL name="CSL test" id="a9876f115ab3c22e" memberName="label" virtualName=""
578  explicitFocusOrder="0" pos="247c 10 158 28" textCol="fffffc00"
579  edTextCol="ff000000" edBkgCol="0" labelText="CSL 5 Demos" editableSingleClick="0"
580  editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default serif font"
581  fontsize="30" bold="1" italic="0" justification="33"/>
582  <TEXTBUTTON name="new button" id="beeb15a1537fd4f6" memberName="prefsButton"
583  virtualName="" explicitFocusOrder="0" pos="8 8 144 32" buttonText="Audio Prefs"
584  connectedEdges="0" needsCallback="1" radioGroupId="0"/>
585  <LABEL name="new label" id="87d3c5b55ea75f76" memberName="cpuLabel"
586  virtualName="" explicitFocusOrder="0" pos="64R 35R 56 24" edTextCol="ff000000"
587  edBkgCol="0" labelText="0.0%" editableSingleClick="0" editableDoubleClick="0"
588  focusDiscardsChanges="0" fontname="Default sans-serif font" fontsize="15"
589  bold="1" italic="0" justification="34"/>
590  <GENERICCOMPONENT name="new component" id="4aa0f216430fecde" memberName="oscilloscopeR"
591  virtualName="" explicitFocusOrder="0" pos="44 50% 52M 34%" class="AudioWaveformDisplay"
592  params=""/>
593  <GENERICCOMPONENT name="new component" id="28308fd8ae783890" memberName="VUMeterL"
594  virtualName="" explicitFocusOrder="0" pos="25 48 15 100%" posRelativeH="d64c351a292a43a4"
595  class="VUMeter" params=""/>
596  <GENERICCOMPONENT name="new component" id="643b07b4b6cf41d" memberName="VUMeterR"
597  virtualName="" explicitFocusOrder="0" pos="24 50% 15 100%" posRelativeH="4aa0f216430fecde"
598  class="VUMeter" params=""/>
599  <SLIDER name="new slider" id="c62ea84a7afde2e3" memberName="scaleSlider"
600  virtualName="" explicitFocusOrder="0" pos="8 62R 12M 24" min="0"
601  max="1" int="0" style="LinearHorizontal" textBoxPos="NoTextBox"
602  textBoxEditable="0" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
603  <SLIDER name="new slider" id="78c6bd39da739ba6" memberName="amplitudeSlider"
604  virtualName="" explicitFocusOrder="0" pos="0 43 20 74.75%" min="-5"
605  max="5" int="0" style="LinearVertical" textBoxPos="NoTextBox"
606  textBoxEditable="0" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
607  <TOGGLEBUTTON name="new toggle button" id="2322f603f1796f48" memberName="loopButton"
608  virtualName="" explicitFocusOrder="0" pos="144 11Rr 64 24" posRelativeX="ed1811e776eea99b"
609  buttonText="Loop" connectedEdges="0" needsCallback="1" radioGroupId="0"
610  state="0"/>
611  <COMBOBOX name="test family" id="55af3a98f2faf643" memberName="familyCombo"
612  virtualName="" explicitFocusOrder="0" pos="16 35R 128 24" editable="0"
613  layout="33" items="Oscillators&#10;Sources&#10;Envelopes&#10;Effects&#10;Panners&#10;Controls"
614  textWhenNonSelected="" textWhenNoItems="(no choices)"/>
615  <TOGGLEBUTTON name="new toggle button" id="82a5a3f16d517231" memberName="recordButton"
616  virtualName="" explicitFocusOrder="0" pos="-2r 37r 72 24" posRelativeX="dbaf2871fd41de83"
617  buttonText="Record" connectedEdges="0" needsCallback="1" radioGroupId="0"
618  state="0"/>
619 </JUCER_COMPONENT>
620 
621 END_JUCER_METADATA
622 */
623 #endif
void logMsg(const char *format,...)
These are the public logging messages.
Definition: CGestalt.cpp:292
juce::TextButton * quitButton
juce::Label * gCPULabel
#define kSoundFileFormatAIFF
Definition: SoundFile.h:60
#define SAMPS_TO_WRITE
record 30 seconds by default
Definition: CSL_Types.h:125
void *(* ThreadFunc)(void *)
This is the CSL_AbstComponent JUCE wrapper for the CSL demos.
juce::ToggleButton * loopButton
unsigned mNumFrames
num frames used in each buffer
Definition: CSL_Core.h:113
void audioDeviceIOCallback(const float **inputChannelData, int totalNumInputChannels, float **outputChannelData, int totalNumOutputChannels, int numSamples)
IO * theIO
virtual void setBuffer(unsigned bufNum, SampleBuffer sPtr)
Definition: CSL_Core.h:158
bool sleepMsec(float dur)
Definition: CGestalt.cpp:372
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
Definition: Accessor.h:17
void pullInput(Buffer &outBuffer, SampleBuffer out=0)
get a buffer from the CSL graph
Definition: CSL_Core.cpp:1425
virtual void comboBoxChanged(juce::ComboBox *comboBoxThatHasChanged)
static bool stopNow()
flag to stop threads and timers
Definition: CGestalt.cpp:64
virtual SampleBuffer buffer(unsigned bufNum)
convenience accessors for sample buffers
Definition: CSL_Core.cpp:66
virtual void audioDeviceIOCallback(const float **inputChannelData, int totalNumInputChannels, float **outputChannelData, int totalNumOutputChannels, int numSamples)
GThread takes a CSL test function and runs it.
void freeBuffers()
fcn to free them
Definition: CSL_Core.cpp:141
void setSize(unsigned numChannels, unsigned numFrames)
Definition: CSL_Core.cpp:75
static void clearStopNow()
Definition: CGestalt.cpp:101
juce::Label * cpuLabel
juce_UseDebuggingNewOperator juce::AudioDeviceManager mAudioDeviceManager
UnitGenerator * mGraph
the root of my client DSP graph, often a mixer or panner
Definition: CSL_Core.h:777
const char * what()
void VoidFcnPtrN(void)
the truly void fcn pointer
Definition: CSL_Types.h:222
virtual void start()
Definition: CSL_Core.h:761
float sample
(could be changed to int, or double)
Definition: CSL_Types.h:191
IO – the abstract I/O scheduling class; subclasses interface to specific I/O APIs.
Definition: CSL_Core.h:752
virtual void buttonClicked(juce::Button *buttonThatWasClicked)
void setChannel(unsigned channel)
Definition: JCSL_Widgets.h:174
virtual void audioDeviceStopped()
VoidFcnPtrN * gFcn
void setBounds(int x, int y, int width, int height)
virtual void sliderValueChanged(juce::Slider *sliderThatWasMoved)
virtual void audioDeviceAboutToStart(juce::AudioIODevice *device)
juce::Slider * amplitudeSlider
juce::AudioDeviceManager * gAudioDeviceManager
juce::ToggleButton * recordButton
virtual void timerCallback()
int gSampIndex
juce::TextButton * prefsButton
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Definition: CSL_Core.h:106
void clearRoot()
Definition: CSL_Core.cpp:1410
Buffer mInputBuffer
the most recent input buffer (if it's turned on)
Definition: CSL_Core.h:778
void allocateBuffers()
fcn to malloc storage buffers
Definition: CSL_Core.cpp:122
virtual void audioDeviceIOCallback(const float **inputChannelData, int totalNumInputChannels, float **outputChannelData, int totalNumOutputChannels, int numSamples)
juce::TextButton * playButton
Buttons, sliders and meters.
void error(int num, const char *m, const char *path)
Definition: OSC_support.cpp:70
virtual void startStop(csl::VoidFcnPtrN *fcn)
Buffer * gFileBuffer
Base class of CSL exceptions (written upper-case). Has a string message.
virtual void recordOnOff()