fbpx
Skip to main content

MIDI Forum

AKAI MPK225 drivers
 
Notifications
Clear all

AKAI MPK225 drivers

5 Posts
2 Users
0 Reactions
3,475 Views
goth
 goth
Posts: 2
New Member
Topic starter
 

Is there a way to create your own application to communicate with the AKAI mpk225 without having to create a special driver? I understand you will need extensive classes to be able to write a program.. What I don't know is if I will be able to communicate to the AKAI mpk225 thorough code I write. I will be writing in c or c++ once I'm able to know if it is possible. Thanks for any help 😀

 
Posted : 15/02/2023 4:50 am
Geoff
Posts: 1043
Noble Member
 

Generally, most 'drivers' are not essential.

What happens is that the people who write software, or the people that design hardware, don't worry about all the complexities of how users might communicate, they construct their system for their convenience. A driver is a little piece of code that translates between the system/device that is seeking to communicate, and whatever it's trying to communicate with. Most users are not programmers, and are not in a position to do this themselves.

If you consult the manual for your AKAI and understand how it communicates (either/both sending and/or receiving data), and write your code to follow the same rules, then your code should be able to communicate fine. Without any driver. But this code may work ONLY for this setup - another benefit of the separate driver module is that if the hardware changes, you might need to change JUST the driver.

Geoff

 
Posted : 15/02/2023 5:50 am
goth
 goth
Posts: 2
New Member
Topic starter
 

I think this is handling some of what is needed

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static Balloon balloon; // Var to hold balloon data
static ParserABC* parser; // Pointer to abstract parser
static MapControl mapControl (hwnd); // Create MapControl
static UserInterface userInterface; // Create UserInterface
static WindDataReader windDataReader; // Create WindDataReader
static Predictor predictor; // Create predictor
// Set the predictors private data member to reference of balloon
predictor.setBalloon(&balloon);
static ControlState controlState(&predictor); // Create control state and pass reference of predict
static HWND hwndCombo, hwndStatic, hwndQuit, hwndFollow,
hwndFpers, hwndFperm, hwndMpers; // Create handles for buttons on WndProcs UI
string buffer; // Buffer to display on the UI the most recent point
HDC hdc; // Device context for painting
PAINTSTRUCT ps; // Structure for painting
RECT rect; // RECT for representing the UI dimensions
// Checks to see if a serial message occurs
if (message == CSerialWnd::mg_nDefaultComMsg)
{
// Create serial event
const CSerialWnd::EEvent eEvent = CSerialWnd::EEvent(LOWORD(wParam));
// Switch to see what type of event
switch (eEvent)
{
case CSerialWnd::EEventRecv: // EVENT RECIEVED
// Read in the point recieved
parser->readIn();
buffer.resize (150);
// TODO: FIX THIS CRASHING
buffer = mapControl.getLatestPoint();
SetWindowText (hwndStatic, buffer.c_str());
break;
}
}
// Switch to see what message was sent
switch (message)
{
case WM_CREATE: // WINDOW CREATION
// Create child controls
hwndStatic = CreateWindow(TEXT("static"), NULL, WS_CHILD | WS_VISIBLE |
SS_LEFT, 10, 10, 160, 300, hwnd, (HMENU) STATIC,
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndCombo = CreateWindow(TEXT("combobox"), NULL, WS_CHILD | WS_VISIBLE
| LBS_STANDARD, 10, 330, 60 + 100, 60 + 200, hwnd, (HMENU) COMBO,
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndFollow = CreateWindow(TEXT("button"), TEXT("Follow"), WS_CHILD |
WS_VISIBLE | BS_CHECKBOX, 10, 400, 160, 40, hwnd, (HMENU) FOLLOW,
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndQuit = CreateWindow(TEXT("button"), TEXT("Quit"), WS_CHILD
| WS_VISIBLE | BS_PUSHBUTTON, 100, 600, 70, 70, hwnd, (HMENU) QUIT,
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
// Create child control radio buttons
hwndFpers = CreateWindow(TEXT("button"), TEXT("f/s"),
WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON, 10, 470, 60, 20, hwnd,
(HMENU) FPERS, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndFperm = CreateWindow(TEXT("button"), TEXT("f/m"),
WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON, 10, 490, 60, 20, hwnd,
(HMENU) FPERM, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndMpers = CreateWindow(TEXT("button"), TEXT("m/s"),
WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON, 10, 510, 60, 20, hwnd,
(HMENU) MPERS, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
// Fill combo box with intervals
SendMessage (hwndCombo, CB_ADDSTRING, 0, (LPARAM) "1 Point Interval");
SendMessage (hwndCombo, CB_ADDSTRING, 1, (LPARAM) "3 Point Interval");
SendMessage (hwndCombo, CB_ADDSTRING, 2, (LPARAM) "6 Point Interval");
// Set default radio button
SendMessage (hwndFpers, BM_SETCHECK, 1, 0);
// Set userInterface private member _hwnd to WndProcs hwnd
userInterface.setHwnd (hwnd);
// Set mapControls private member _balloon to balloon
mapControl.setData (&balloon);
// Set windDataReaders private member _balloon to balloon
windDataReader.setBalloon (&balloon);
// Set userInterfaces private member _mapControl to mapControl
userInterface.setMapControl (&mapControl);
// Set up file initialize to common open dialog for .ptm files
mapControl.mapFileInitialize (hwnd);
// Start the Initialize dialog box
userInterface.InitializeDialog (hwnd);
// If the user chose to read in from serial
if (userInterface.getIsSerial())
{
// Populate wind data reader
if ( !userInterface.getWindFrom().empty() )
windDataReader.GenerateWindData(userInterface.getWindFrom());
else
MessageBox (hwnd, "No wind data table.", "Critical Error.", 0);
// Set abstract parser to a new SerialParser
parser = new SerialParser (serial, hwnd);
// Open the com port
if ( !userInterface.getReadingFrom().empty() )
parser->openCom( userInterface.getReadingFrom().c_str() );
else
MessageBox (hwnd, "No COM port selected.", "Critical Error.", 0);
// Attach parser to the observer
parser->attach (&controlState);
}
else
{
// If the user didn't select serial, then they had to select
// from file, so set abstract parser to a FileParser and pass
// the file it is reading from
parser = new FileParser (userInterface.getReadingFrom());
}
// Set parsers private member _balloon to balloon
parser->setBalloon (&balloon);
// Set parsers private member _mapControl to mapControl
parser->attach (&mapControl);
// If the user is reading from a file
if ( !userInterface.getIsSerial() )
{
// Read in the entire file
parser->readIn();
}
break;
case WM_COMMAND: // COMMAND MESSAGE RECIEVED
// If the combo box has a new selection
if (LOWORD(wParam) == COMBO && HIWORD (wParam) == LBN_SELCHANGE)
{
// Find which text has been selected and set update frequenchy appropiately
switch (SendMessage (hwndCombo, CB_GETCURSEL, 0, 0))
{
case 0:
mapControl.setUpdateFrequency (1);
break;
case 1:
mapControl.setUpdateFrequency (3);
break;
case 2:
mapControl.setUpdateFrequency (6);
break;
default:
break;
}
}
switch (LOWORD(wParam))
{
case FOLLOW: // Follow button has been checked
SendMessage ( (HWND) lParam, BM_SETCHECK, (WPARAM)
!SendMessage ((HWND) lParam, BM_GETCHECK, NULL, NULL), NULL );
// Switch the bool member follow
mapControl.SwitchFollow ( );
break;
case FPERS: // Feet Per Second Selected
SendMessage (hwndFpers, BM_SETCHECK, 1, 0);
SendMessage (hwndFperm, BM_SETCHECK, 0, 0);
SendMessage (hwndMpers, BM_SETCHECK, 0, 0);
// Set the ascent rate display
mapControl.setAscentRateEnum ( FEETPERSECOND );
break;
case FPERM: // Feet Per Minute Selected
SendMessage (hwndFpers, BM_SETCHECK, 0, 0);
SendMessage (hwndFperm, BM_SETCHECK, 1, 0);
SendMessage (hwndMpers, BM_SETCHECK, 0, 0);
// Set the ascent rate display to feet per minute
mapControl.setAscentRateEnum ( FEETPERMINUTE );
break;
case MPERS: // Meter Per Second Selected
SendMessage (hwndFpers, BM_SETCHECK, 0, 0);
SendMessage (hwndFperm, BM_SETCHECK, 0, 0);
SendMessage (hwndMpers, BM_SETCHECK, 1, 0);
// Set the ascent rate display to meters per second
mapControl.setAscentRateEnum ( METERPERSECOND );
break;
case QUIT:
// Clean up what we newed
delete parser;
PostQuitMessage(0);
return 0;
break;
}
break;
case WM_PAINT:
// Paint the window
hdc = BeginPaint (hwnd, &ps);
GetClientRect (hwnd, &rect);
EndPaint (hwnd, &ps);
return 0;
case WM_DESTROY:
// Clean up what we newed
delete parser;
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hwnd, message, wParam, lParam);
}

 
Posted : 15/02/2023 7:40 am
Geoff
Posts: 1043
Noble Member
 

Further to the previous message, I note that the MPK225 is not 'just' a controller, it seems to be other things as well. So it may be a case that it's easier to communicate regarding some things than others.

Also, I note that the device can link EITHER using USB, or using the standard midi ports. So it will depend on the computer you're using to connect to. I assume a WinDoze machine?

A proper driver will make the USB options much easier, the system may well recognise the Akai automatically. However, programming yourself via USB may get pretty complicated. Your own programming may be much easier using the standard midi ports, but your computer may not have the DIN interface, although you might be able to use a USB MIDI interface (but beware of the dodgy cheap ones).

Geoff

 
Posted : 15/02/2023 7:43 am
Geoff
Posts: 1043
Noble Member
 

Regarding your code...

I wonder where you got this from? Seems to be about processing wind speed data received through serial link?

I'm not sure there is anything here you might use, although some bits might give some useful hints?

Is your computer prog needing to receive midi data (from the controller), and do - what? with the data received. Or do you intend your computer prog to send data to the Akai to control that?

Which PC version are you planning to use? Do you have access to a MIDI port. Do you have any sort of VST set up?

Geoff

 
Posted : 15/02/2023 4:06 pm
Share: