Skip to content

Commit

Permalink
Revert "Improve Midi Input Part 1 (#142)"
Browse files Browse the repository at this point in the history
This reverts commit fbebbcf.
  • Loading branch information
djdiskmachine committed Oct 22, 2024
1 parent fbebbcf commit 13cdfa0
Show file tree
Hide file tree
Showing 8 changed files with 814 additions and 857 deletions.
6 changes: 3 additions & 3 deletions projects/resources/RG35XXPLUS/mapping.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
enable DUMPEVENT to help with mapping
-->
<MAPPINGS>

<MAP src="but:0:4" dst="/event/lshoulder" />
<MAP src="but:0:5" dst="/event/rshoulder" />
<MAP src="but:0:5" dst="/event/rshoulder" />

<MAP src="hat:0:0:0" dst="/event/up" />
<MAP src="hat:0:0:2" dst="/event/down" />
<MAP src="hat:0:0:3" dst="/event/left" />
<MAP src="hat:0:0:1" dst="/event/right" />

<MAP src="but:0:0" dst="/event/a" />
<MAP src="but:0:1" dst="/event/b" />
<MAP src="but:0:1" dst="/event/b" />
<MAP src="but:0:7" dst="/event/start" />

</MAPPINGS>
78 changes: 50 additions & 28 deletions sources/Application/Application.cpp
Original file line number Diff line number Diff line change
@@ -1,42 +1,64 @@
#include "Application.h"

#include "Application/AppWindow.h"
#include "Application/Application.h"
#include "Application/AppWindow.h"
#include "UIFramework/Interfaces/I_GUIWindowFactory.h"
#include "Application/Persistency/PersistencyService.h"
#include "Services/Audio/Audio.h"
#include "Application/Commands/CommandDispatcher.h"
#include "Application/Controllers/ControlRoom.h"
#include "Application/Model/Config.h"
#include "Application/Persistency/PersistencyService.h"
#include "Services/Audio/Audio.h"
#include "Services/Midi/MidiService.h"
#include "UIFramework/Interfaces/I_GUIWindowFactory.h"

#include <math.h>

Application *Application::instance_ = NULL;
Application *Application::instance_=NULL ;

Application::Application() {}
Application::Application() {
}

void Application::initMidiInput()
{
const char *preferedDevice=Config::GetInstance()->GetValue("MIDICTRLDEVICE");

void Application::initMidiInput() {
const char *preferedDevice =
Config::GetInstance()->GetValue("MIDICTRLDEVICE");
if (preferedDevice) {
MidiService::GetInstance()->SelectDevice(preferedDevice);
IteratorPtr<MidiInDevice>it(MidiService::GetInstance()->GetInIterator()) ;
for(it->Begin();!it->IsDone();it->Next())
{
MidiInDevice &in=it->CurrentItem() ;
if ((preferedDevice) && (!strncmp(in.GetName(), preferedDevice, strlen(preferedDevice))))
{
if (in.Init())
{
if (in.Start())
{
Trace::Log("MIDI","Controlling activated for MIDI interface %s",in.GetName()) ;
}
else
{
in.Close() ;
}
}
}
}
}

bool Application::Init(GUICreateWindowParams &params) {
const char *root = Config::GetInstance()->GetValue("ROOTFOLDER");
if (root) {
Path::SetAlias("root", root);
}
window_ = AppWindow::Create(params);
PersistencyService::GetInstance();
Audio *audio = Audio::GetInstance();
audio->Init();
CommandDispatcher::GetInstance()->Init();
initMidiInput();
ControlRoom::GetInstance()->LoadMapping("bin:mapping.xml");
return true;
}
const char* root=Config::GetInstance()->GetValue("ROOTFOLDER") ;
if (root) {
Path::SetAlias("root",root) ;
} ;
window_=AppWindow::Create(params) ;
PersistencyService::GetInstance() ;
Audio *audio=Audio::GetInstance() ;
audio->Init() ;
CommandDispatcher::GetInstance()->Init() ;
initMidiInput();
ControlRoom::GetInstance()->LoadMapping("bin:mapping.xml") ;
return true ;
} ;

GUIWindow *Application::GetWindow() { return window_; }
GUIWindow *Application::GetWindow() {
return window_ ;
} ;

Application::~Application() { delete window_; }
Application::~Application() {
delete window_ ;
}
31 changes: 15 additions & 16 deletions sources/Application/Application.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
#ifndef _APPLICATION_H_
#define _APPLICATION_H_

#include "Foundation/T_Singleton.h"
#include "UIFramework/SimpleBaseClasses/GUIWindow.h"
#include "Foundation/T_Singleton.h"

class Application : public T_Singleton<Application> {

public:
Application();
~Application();
bool Init(GUICreateWindowParams &params);
class Application:public T_Singleton<Application> {

GUIWindow *GetWindow();
public:
Application() ;
~Application() ;
bool Init(GUICreateWindowParams &params) ;

protected:
void initMidiInput();
GUIWindow *GetWindow() ;
protected:
void initMidiInput();

private:
GUIWindow *window_;
private:
GUIWindow *window_ ;
private:
static Application* instance_ ;
} ;

private:
static Application *instance_;
};
#endif

#endif // _APPLICATION_H_
Loading

0 comments on commit 13cdfa0

Please sign in to comment.