Page 1 of 1

String problem in midiout + free hex converter inside ;)

Posted: 08 Dec 2017 17:34
by Bonobo
Hey guys,

the function decimal2hex(float)

Code: Select all

decl hexvalues = {'0','1','2','3','4','5','6','7','8','9','a','b','c','f','e','f'};
decl hexval = '';
decl input = float;
while(input != 0)
{
	hexval = hexvalues[(input%16)]+ hexval;
	input = floor(input/16);
}
return hexval;
.... which is working fine and returns a hex value as a string.

The Problem:
Midi-Message-part of the midiout command.
The channel bit will accept string data just fine. -> string variable "channel"
The midi-message part will not. -> string variable "patch".

Code: Select all

channel = decimal2hex(1); // results in hex "1" as string
patch = decimal2hex(10); // results in hex "a" as string

midiout(0,{0xc+channel,0x0+patch});
Any ideas how to get the midi message part to accept a hex value as a string or some way to do it ?

Thanks so much !!