YesNoOk
avatar

Ikemen GO (Read 1207397 times)

Started by K4thos, May 26, 2018, 03:04:27 am
Share this topic:
Re: Ikemen GO Plus
#1101  July 14, 2019, 05:35:48 am
  • ***
  • One of Ikemen GO devs
    • Colombia
Thanks!!
I'll test it once Install more dependencies. (There is so many stuff to install...)
It seem that Fluidsynth require pkg-config.

A recommendation for the next time you can use something like github gist to upload code like that. (If you don not want to create a merge commit)
https://gist.github.com/

EDIT:

Hey Mike can I ask what dependencies did you install? I'm lost.
But wait!! We haven't made the Suave Dude character yet!!
Last Edit: July 14, 2019, 06:23:08 am by Gacel
Re: Ikemen GO Plus
#1102  July 14, 2019, 06:29:16 am
  • **
  • The need situation makes the man
    • Mexico
    • www.facebook.com/mike.funkyman
Thanks!!
I'll test it once Install more dependencies. (There is so many stuff to install...)
It seem that Fluidsynth require pkg-config.

A recommendation for the next time you can use something like github gist to upload code like that. (If you don not want to create a merge commit)
https://gist.github.com/

EDIT:

Hey Mike can I ask what dependencies did you install? I'm lost.

Talking about dependencies, let me tell you, Only classic C libraries, (you know the classic .h  and .c formats, that is because I use fluidsynth for another projects based on C, you know Raspberry P, in fact for Zynthian midi module http://zynthian.org/#menu-concept)

The thing I do is only converting C language to Golang https://golang.org/cmd/cgo/

Man, I came here from programming arduinos, in the arduino thing to insatll a dependecie you only need to make this

Code:
#include "DrumPins.h"
#include <midi.h>
#include <EEPROM.h>

#define VersionMajor 1
#define VersionMinor 0

#pragma region arrays
byte pinLocation[MAX_PIN_SIZE] = {
getPinLoc(A6 , 0), // HiHat Pedal
getPinLoc(A7 , 0), // HiHat Cymbal T
getPinLoc(A8 , 0), // HiHat Cymbal R
getPinLoc(A9 , 0), // Kick Drum
getPinLoc(A0 , 0), // Snare T
getPinLoc(A0 , 1), // Snare R
getPinLoc(A0 , 2), // Tom 1 T
getPinLoc(A0 , 3), // Tom 1 R
getPinLoc(A0 , 4), // Tom 2 T
getPinLoc(A0 , 5), // Tom 2 R
getPinLoc(A0 , 6), // Tom 3 T
getPinLoc(A0 , 7), // Tom 3 R
getPinLoc(A1 , 0), // Tom 4 T
getPinLoc(A1 , 1), // Tom 4 R
getPinLoc(A1 , 2), // Crash 1 T
getPinLoc(A1 , 3), // Crash 1 R
getPinLoc(A1 , 4), // Crash 2 T
getPinLoc(A1 , 5), // Crash 2 R
getPinLoc(A1 , 6), // Ride 1 T
getPinLoc(A1 , 7), // Ride 1 R
getPinLoc(A2 , 0), // Ride 1 S
getPinLoc(A2 , 1), // Ride 2 T
getPinLoc(A2 , 2), // Ride 2 R
getPinLoc(A2 , 3), // Ride 2 S
getPinLoc(A2 , 4), // Ride 3 T
getPinLoc(A2 , 5), // Ride 3 R
getPinLoc(A2 , 6), // Ride 3 S
getPinLoc(A2 , 7), // Aux 1 T
getPinLoc(A3 , 0), // Aux 1 R
getPinLoc(A3 , 1), // Aux 2 T
getPinLoc(A3 , 2), // Aux 2 R
getPinLoc(A3 , 3), // Aux 3 T
getPinLoc(A3 , 4), // Aux 3 R
getPinLoc(A3 , 5), // Aux 4 T
getPinLoc(A3 , 6), // Aux 4 R
getPinLoc(A3 , 7), // Aux 5 T
getPinLoc(A10 , 0), // Aux 5 R
};
byte pinType[MAX_PIN_SIZE];
byte pinThreshold[MAX_PIN_SIZE];
byte pinNoteOnThreshold[MAX_PIN_SIZE];
byte pinNoteOnValue[MAX_PIN_SIZE];
byte pinPitch[MAX_PIN_SIZE];
#pragma endregion

#pragma region Setups
void setup() {
EEPROM_Load();
setupADC();
setupSerial();
}
// set up funcs
void setupADC() {
// Define various ADC prescaler
//------------------------------
const unsigned char PS_16 = (1 << ADPS2);
//const unsigned char PS_32 = (1 << ADPS2) | (1 << ADPS0);
//const unsigned char PS_64 = (1 << ADPS2) | (1 << ADPS1);
const unsigned char PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);

//http://www.microsmart.co.za/technical/2014/03/01/advanced-arduino-adc/
ADCSRA &= ~PS_128;  // remove bits set by Arduino library
ADCSRA |= PS_16;    // set our own prescaler to 16 for ~20 us
}
#pragma endregion

#pragma region Serial
#define BAUD_RATE 115200
#define MAX_DATA_BYTES          7 // max number of data bytes in incoming messages
#define START_SYSEX             0xF0 // start a MIDI Sysex message
#define END_SYSEX               0xF7 // end a MIDI Sysex message

byte storedInputData[MAX_DATA_BYTES]; // multi-byte data for SysEx
int sysexBytesRead = 0;
boolean parsingSysex = false;

void setupSerial() {
Serial.begin(BAUD_RATE);
while (!Serial);
Serial.print("Welcome to aDrums v");
Serial.print(VersionMajor);
Serial.print(".");
Serial.print(VersionMinor);
}

void processSerialInput() {
while (Serial.available()) {
int inputData = Serial.read(); // this is 'int' to handle -1 when no data
if (inputData != -1) {
parse(inputData);
}
}
}
void parse(byte inputData) {
if (parsingSysex)
{
if (inputData == END_SYSEX)
{
//stop sysex byte
parsingSysex = false;
//fire off handler function
processSysexMessage();
}
else
{
//normal data byte - add to buffer
storedInputData[sysexBytesRead] = inputData;
sysexBytesRead++;
}
}
else if (inputData == START_SYSEX)
{
parsingSysex = true;
sysexBytesRead = 0;
}
}
void processSysexMessage() {
sysexCallback(storedInputData[0], sysexBytesRead - 1, storedInputData + 1);
}

void TX_SERIAL(byte command, byte pin, int value) {
Serial.write(START_SYSEX);
Serial.write(command);
Serial.write(pin);
Serial.write(value);
Serial.write(END_SYSEX);
Serial.flush();
}
#pragma endregion

#pragma region Loops
void loop()
{
processSerialInput();
readPins();
}
#pragma endregion

#pragma region MIDI
#define DEFAULT_CHANNEL 0
// First parameter is the event type (0x09 = note on, 0x08 = note off).
// Second parameter is note-on/note-off, combined with the channel.
// Channel can be anything between 0-15. Typically reported to the user as 1-16.
// Third parameter is the note number (48 = middle C).
// Fourth parameter is the velocity (64 = normal, 127 = fastest).
void noteOn(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOn = { 0x09, 0x90 | channel, pitch, velocity };
MidiUSB.sendMIDI(noteOn);
}
void noteOff(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOff = { 0x08, 0x80 | channel, pitch, velocity };
MidiUSB.sendMIDI(noteOff);
}
// First parameter is the event type (0x0B = control change).
// Second parameter is the event type, combined with the channel.
// Third parameter is the control number number (0-119).
// Fourth parameter is the control value (0-127).
void controlChange(byte channel, byte control, byte value) {
midiEventPacket_t event = { 0x0B, 0xB0 | channel, control, value };
MidiUSB.sendMIDI(event);
}
#pragma endregion

#pragma region ReadDrums
void readPins() {
for (byte i = 0; i < MAX_PIN_SIZE; i++)
{
switch (pinType[i])
{
case PINTYPE_DISABLED:
break;
default:
ReadDrum(i, getAnalogueValue(i));
break;
}
}
}
int getAnalogueValue(byte pin) {
byte location = pinLocation[pin];
digitalWrite(ADCD1, (location & FLAG_IC1) ? HIGH : LOW);  //flag 00000001
digitalWrite(ADCD2, (location & FLAG_IC2) ? HIGH : LOW);  //flag 00000010
digitalWrite(ADCD3, (location & FLAG_IC3) ? HIGH : LOW);  //flag 00000100
return analogRead((location >> 3));
}
void ReadDrum(byte pin, int value) {
if (value >= pinThreshold[pin])
{
if (pinNoteOnValue[pin] == 0)
noteOn(DEFAULT_CHANNEL, pinPitch[pin], getVelocity(pin, value));

pinNoteOnValue[pin]++;
}
else if (pinNoteOnValue[pin] > 0 && pinNoteOnValue[pin] > pinNoteOnThreshold[pin])
{
noteOff(DEFAULT_CHANNEL, pinPitch[pin], 0);
pinNoteOnValue[pin] = 0;
}
}
byte getVelocity(byte pin, int analogue_value) {
//analogue_value max = 1023
return (analogue_value / 8);
}
#pragma endregion

#pragma region Callbacks
#define toMSG(NAME) MSG_ ## NAME
#define caseCallBack(NAME) \
case toMSG(NAME): \
if(isSet) \
  NAME [arrayPointer[0]] = arrayPointer[1]; \
else \
TX_SERIAL( command , arrayPointer[0], NAME [arrayPointer[0]] ); \
break;

#define MSG_GET_HANDSHAKE 0
#define MSG_GET_PINCOUNT 8
#define MSG_EEPROM 100
#define MSG_pinType 1
#define MSG_pinThreshold 2
#define MSG_pinNoteOnThreshold 3
#define MSG_pinPitch 4

void sysexCallback(byte command, byte size, byte* arrayPointer) {
bool isSet = command & 1;
switch ((command >> 1))
{
case MSG_GET_HANDSHAKE: TX_SERIAL(command, VersionMajor, VersionMinor); break;
case MSG_GET_PINCOUNT: TX_SERIAL(command, MAX_PIN_SIZE, 0); break;
case MSG_EEPROM: if (isSet) EEPROM_Save(); else EEPROM_Load(); TX_SERIAL(command, 1, 1); break;
caseCallBack(pinType);
caseCallBack(pinThreshold);
caseCallBack(pinNoteOnThreshold);
caseCallBack(pinPitch);
}
}

#pragma endregion

#pragma region EEPROM
#define _S_EPROM(a,b) eeprom_write_bytes((MAX_PIN_SIZE * b), a, MAX_PIN_SIZE)
#define _L_EPROM(a,b) eeprom_read_bytes((MAX_PIN_SIZE * b), a, MAX_PIN_SIZE)
#define _EPROM_StartAddr 0

void EEPROM_Save() {
_S_EPROM(pinType, 0);
_S_EPROM(pinThreshold, 1);
_S_EPROM(pinNoteOnThreshold, 2);
_S_EPROM(pinPitch, 3);
}
void EEPROM_Load() {
_L_EPROM(pinType, 0);
_L_EPROM(pinThreshold, 1);
_L_EPROM(pinNoteOnThreshold, 2);
_L_EPROM(pinPitch, 3);
}

//
// Absolute min and max eeprom addresses.
// Actual values are hardware-dependent.
//
// These values can be changed e.g. to protect
// eeprom cells outside this range.
//
const int EEPROM_MIN_ADDR = 0;
const int EEPROM_MAX_ADDR = 1023;

//
// Returns true if the address is between the
// minimum and maximum allowed values,
// false otherwise.
//
// This function is used by the other, higher-level functions
// to prevent bugs and runtime errors due to invalid addresses.
//
boolean eeprom_is_addr_ok(int addr) {
return ((addr >= EEPROM_MIN_ADDR) && (addr <= EEPROM_MAX_ADDR));
}

//
// Writes a sequence of bytes to eeprom starting at the specified address.
// Returns true if the whole array is successfully written.
// Returns false if the start or end addresses aren't between
// the minimum and maximum allowed values.
// When returning false, nothing gets written to eeprom.
//
boolean eeprom_write_bytes(int startAddr, const byte* array, int numBytes) {
// counter
int i;

// both first byte and last byte addresses must fall within
// the allowed range 
if (!eeprom_is_addr_ok(startAddr) || !eeprom_is_addr_ok(startAddr + numBytes)) {
return false;
}

for (i = 0; i < numBytes; i++) {
EEPROM.write(startAddr + i, array[i]);
}

return true;
}

//
// Reads the specified number of bytes from the specified address into the provided buffer.
// Returns true if all the bytes are successfully read.
// Returns false if the star or end addresses aren't between
// the minimum and maximum allowed values.
// When returning false, the provided array is untouched.
//
// Note: the caller must ensure that array[] has enough space
// to store at most numBytes bytes.
//
boolean eeprom_read_bytes(int startAddr, byte array[], int numBytes) {
int i;

// both first byte and last byte addresses must fall within
// the allowed range 
if (!eeprom_is_addr_ok(startAddr) || !eeprom_is_addr_ok(startAddr + numBytes)) {
return false;
}

for (i = 0; i < numBytes; i++) {
array[i] = EEPROM.read(startAddr + i);
}

return true;
}
#pragma endregion


The Idea is that I get the API only for adding fluidsynth support for games like Unreal Engine, Unity or something like that, but the Go language is something that I never mess, so that is the reaseon of the squeaky bindings, but are so criptyc!, so I learn a little about fluidsynth and I discover that a lot of Android apps use this library
Last Edit: July 14, 2019, 07:13:04 am by Mike77154
Re: Ikemen GO Plus
#1103  July 14, 2019, 08:14:47 am
  • avatar
  • ***
  • If you rip sprites i´ll rip your code
    • Mexico
    • www.m3xweb.260mb.com
Ikemen is written in Go ,uses Lua for scripting, JSON languaje for config and ranking system and now C calls too for audio synth, this is not good at all but.

Here is a manner to use some C in goolang altought are completely diferent kind of coding. Just as Mike said, is a matter of importing c and the synth packages.

Code:
   Import 
"C"
"github.com/x42/avldrums.lv2/tree/master/fluidsynth"
"github.com/sqweek/fluidsynth"
There is no knowledge that is not power
--------------------------------------
My Web Site
Last Edit: July 14, 2019, 08:40:43 am by MangeX
Re: Ikemen GO Plus
#1104  July 14, 2019, 08:56:44 am
  • **
  • The need situation makes the man
    • Mexico
    • www.facebook.com/mike.funkyman
Ikemen is written in Go ,uses Lua for scripting, JSON languaje for config and ranking system and now C calls too for audio synth, this is not good at all but.

Here is a manner to use some C in goolang altought are completely diferent kind of coding. Just as Mike said, is a matter of importing c and the synth packages.

Code:
   Import 
"C"
"github.com/x42/avldrums.lv2/tree/master/fluidsynth"
"github.com/sqweek/fluidsynth"

Man, And I didnt tell you another weird things do I plan to study for implement to the midi music engine

together with the fluidsynth implementation for .sf2 format for synth, I plan to add .dls compatibility, .vgm music file compatibility and... the cherry over the cake, YM2151 and or YM2612 custom patches loading for every General Midi Instrument, an onboard FM synth

for example, do you remember Street Fighter 2 World Warrior?, imagine have something similar on the music but natively maded instead of reading an MP# prerendered file

Example on a file system.def
Code:
fight = fight.def
fightfx = fightfx.def
select = select.def
soundfont= data/gamesoundfont.sf2
YM2151 confing file= data/YM2151.def
YM2612 config file data/YM2612=

and in the file YM2151.def we have inside something like these
Code:
Hello, this is the config file
for instrument section of YM2151, please add your OPM
file for GM instrument playing

00 piano= pianostreetfighter2.opm
01 brightpiano = pianostrider.opm
02 harpsichord = thunderzonehpr.opm
40 bass = zangiefingerbass.opm....

something like that for the FM synth
Re: Ikemen GO Plus
#1105  July 14, 2019, 09:24:46 am
  • avatar
  • ***
  • If you rip sprites i´ll rip your code
    • Mexico
    • www.m3xweb.260mb.com
... the cherry over the cake, YM2151 and or YM2612 custom patches loading for every General Midi Instrument, an onboard FM synth

for example, do you remember Street Fighter 2 World Warrior?, imagine have something similar on the music but natively maded instead of reading an MP# prerendered file

Example on a file system.def
Code:
fight = fight.def
fightfx = fightfx.def
select = select.def
soundfont= data/gamesoundfont.sf2
YM2151 confing file= data/YM2151.def
YM2612 config file data/YM2612=

00 piano= pianostreetfighter2.opm
01 brightpiano = pianostrider.opm
02 harpsichord = thunderzonehpr.opm
40 bass = zangiefingerbass.opm....[/code]

something like that for the FM synth

If im not mistaken those are the Megadrive/Genesis yamaha synthetizers..... Wow i love the sound it does and the best thing is their music construction method using samples and waves.

Nice, Mike .

There is no knowledge that is not power
--------------------------------------
My Web Site
Last Edit: July 14, 2019, 01:08:49 pm by MangeX
Re: Ikemen GO Plus
#1106  July 14, 2019, 05:44:55 pm
  • *****
  • Formerly known as HyperClawManiac
  • Competitive MUGEN when?
    • UK
    • sites.google.com/view/ragingrowen/home
Mike you should probably use Spoilers when you write lines of code like those on the previous page especially.

Black screen bug occurs for me aswell btw.
WIP Schedule:
The next Street Fighter All-Stars update
Re: Ikemen GO Plus
#1107  July 16, 2019, 01:11:59 am
  • **
  • The need situation makes the man
    • Mexico
    • www.facebook.com/mike.funkyman
Thanks!!
I'll test it once Install more dependencies. (There is so many stuff to install...)
It seem that Fluidsynth require pkg-config.

A recommendation for the next time you can use something like github gist to upload code like that. (If you don not want to create a merge commit)
https://gist.github.com/

EDIT:

Hey Mike can I ask what dependencies did you install? I'm lost.

you ask about dependencies, maybe this can be helpful
https://github.com/FluidSynth/fluidsynth/wiki/BuildingWithCMake

but for morre stability, please use these
Code:
git clone git://github.com/x42/avldrums.lv2.git
  cd avldrums.lv2
  make submodules
  make
  sudo make install PREFIX=/usr


and, talking about the Second player menu glitch, there still cant be the arcade mode selectable by the second player yet, but thanks to the help of pablo Santana, by now I can make choosable the options by second player, but there is imposible to play the second player mode

https://www.facebook.com/pagayo the facebook of this good samaritan that helps me

so here is the update, its buggy but maybe you can check the updates
Code:
https://gist.github.com/Mike77154/92c18fd70bb4b54e6533935f03911d6e
Last Edit: July 16, 2019, 03:59:20 am by Mike77154
Re: Ikemen GO Plus
#1108  July 16, 2019, 11:51:11 am
  • ***
    • Greece
Gacel are you going to release a new version without the  msaa filter?
Re: Ikemen GO Plus
#1109  July 16, 2019, 11:52:43 am
  • avatar
  • **
    • South Africa
Well it should be optional I think
Re: Ikemen GO Plus
#1110  July 16, 2019, 12:13:11 pm
  • ***
    • Greece
He could remove it from the newer version till he finds time to make it optional so everyone can test the new build. Of course if it is hard to remove it he can leave it as it is till he adds it as an option.
Re: Ikemen GO Plus
#1111  July 17, 2019, 01:28:42 am
  • ***
  • One of Ikemen GO devs
    • Colombia
Sorry for begin late.
I did make MSAA a toggleable option (Is disabled by default)
I can run MSAA so I need people who had the problem to test if it worked.

In circa 20 minutes the build should aparear on AppVeyor in this link:
https://ci.appveyor.com/project/Windblade-GR01/ikemen-go/build/artifacts

If everything goes well I'll add a way to change the MSAA option from the menu. (Right now it can be only changed from the config file)

EDIT: Remember to delete the config.json file before opening the update.
But wait!! We haven't made the Suave Dude character yet!!
Last Edit: July 17, 2019, 01:31:59 am by Gacel
Re: Ikemen GO Plus
#1112  July 17, 2019, 02:31:37 am
  • *****
  • Formerly known as HyperClawManiac
  • Competitive MUGEN when?
    • UK
    • sites.google.com/view/ragingrowen/home
Ok thanks for the update.
I forgot to tell you about another issue with the Broly, and that's how Helpers/Projectiles overlap each other. The creator said he combines add transparency and sub transparency, and that doesn't work well in this build seemingly.
MUGEN: https://streamable.com/pdmk6
IKEMEN: https://streamable.com/r9z4t
WIP Schedule:
The next Street Fighter All-Stars update
Re: Ikemen GO Plus
#1113  July 17, 2019, 01:22:01 pm
  • ***
    • Greece
Tested the new build without the MSAA and IKEMEN starts normaly, when i turn on the MSAA option from the config IKEMEN starts and stays on black screen. So it is the MSAA that creates the problem as Neat Unsou wrote.
Re: Ikemen GO Plus
#1114  July 17, 2019, 02:00:23 pm
  • avatar
  • **
    • Turkey
MSAA doesnt gives black screen on me.
Re: Ikemen GO Plus
#1115  July 18, 2019, 07:45:05 am
  • ***
  • One of Ikemen GO devs
    • Colombia
Ok so we can say that MSAA was the problem.
It seem that it was only on some GPUs.
I'll add it to the options menu later.

Ok thanks for the update.
I forgot to tell you about another issue with the Broly, and that's how Helpers/Projectiles overlap each other. The creator said he combines add transparency and sub transparency, and that doesn't work well in this build seemingly.
MUGEN: https://streamable.com/pdmk6
IKEMEN: https://streamable.com/r9z4t


I'm not good with openGL and I mean that I do not know apart from the bare basics of OpenGL, maybe Neat Unsou would be the indicated person to help with that bug.
But wait!! We haven't made the Suave Dude character yet!!
Re: Ikemen GO Plus
#1116  July 20, 2019, 12:06:47 am
  • ***
  • One of Ikemen GO devs
    • Colombia
You already send me that Adnan. I'm in the process of learning OpenGL. (That link helped a lot)
I have practiced but it takes time to learn everything.
But wait!! We haven't made the Suave Dude character yet!!
Re: Ikemen GO Plus
#1117  July 20, 2019, 07:41:54 am
  • avatar
  • **
    • Turkey
I understand,i thought you had missed my link.Take your time.
Re: Ikemen GO Plus
#1118  July 25, 2019, 12:40:09 pm
  • *****
  • Formerly known as HyperClawManiac
  • Competitive MUGEN when?
    • UK
    • sites.google.com/view/ragingrowen/home
Stage problems, it's with the floor on the Shine of the Forgotten God stage.
Mugen 1.1:
Ikemen:
WIP Schedule:
The next Street Fighter All-Stars update
Re: Ikemen GO Plus
#1119  July 27, 2019, 02:44:21 pm
  • avatar
  • **
    • South Africa
Demo mode crashes for me, error log below:



panic: ./script/randomtest.lua:221: attempt to index a non-table object(nil)
stack traceback:
   ./script/randomtest.lua:221: in function 'rosterTxt'
   ./script/randomtest.lua:236: in function 'init'
   ./script/randomtest.lua:242: in function 'run'
   script/main.lua:2051: in function 'f_mainExtras'
   script/main.lua:1689: in function 'f_mainMenu'
   script/main.lua:2188: in main chunk
   [G]: ?

goroutine 1 [running, locked to thread]:
main.main()
   /code/src/main.go:263 +0x1f53
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]
Re: Ikemen GO Plus
#1120  July 28, 2019, 03:24:14 pm
  • **
    • Spain
    • cidiego@gmail.com
Any possibilities on porting this wonder to Android??
Thank you all for sharing!