MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Initialize

Method Initialize

Source/Push2Control.cpp:387–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387bool Push2Control::Initialize()
388{
389 if (!ThePushBridge.IsInitialized())
390 {
391 if (auto result = ThePushBridge.Init(); result.Failed())
392 {
393 mPushBridgeInitErrMsg = result.GetDescription();
394 ofLog() << mPushBridgeInitErrMsg;
395 return false;
396 }
397 ofLog() << "push 2 connected";
398 }
399
400 mPixels = new unsigned char[GetNumDisplayPixels()];
401
402 mFontHandle = nvgCreateFont(sVG, ofToResourcePath("frabk.ttf").c_str(), ofToResourcePath("frabk.ttf").c_str());
403 mFontHandleBold = nvgCreateFont(sVG, ofToResourcePath("frabk_m.ttf").c_str(), ofToResourcePath("frabk_m.ttf").c_str());
404
405 const std::vector<std::string>& devices = mDevice.GetPortList(false);
406 for (int i = 0; i < devices.size(); ++i)
407 {
408#if JUCE_WINDOWS
409 if (strcmp(devices[i].c_str(), "Ableton Push 2") == 0)
410#else
411 if (strcmp(devices[i].c_str(), "Ableton Push 2 Live Port") == 0)
412#endif
413 {
414 mDevice.ConnectOutput(i);
415 mDevice.ConnectInput(devices[i].c_str());
416
417 std::string touchStripConfig = { 0x00, 0x21, 0x1D, 0x01, 0x01, 0x17, 0x03 };
418 mDevice.SendSysEx(touchStripConfig);
419 break;
420 }
421 }
422
423 return true;
424}
425
426int Push2Control::GetNumDisplayPixels() const
427{

Callers 1

winusbx_claim_interfaceFunction · 0.80

Calls 12

ofLogClass · 0.85
nvgCreateFontFunction · 0.85
ofToResourcePathFunction · 0.85
FailedMethod · 0.80
GetPortListMethod · 0.80
sizeMethod · 0.80
ConnectInputMethod · 0.80
IsInitializedMethod · 0.45
InitMethod · 0.45
GetDescriptionMethod · 0.45
ConnectOutputMethod · 0.45
SendSysExMethod · 0.45

Tested by

no test coverage detected