aldweb

Fermer I. aldweb

Fermer II. Gratuitiels PC

Fermer III. Gratuitiels Palm

Fermer IV. Partagiciels Palm

Fermer V. iziBasic Palm

Fermer VI. Connaissance Palm

Fermer VII. Ordinateur Poche

Fermer VIII. miniPortail

Spécial !



Version mobile
de l'aldweb Site

m.aldweb.com


Ni Français, ni Anglais ?

Essayez donc l'un de ces drapeaux :
[de] [es] [it] [pt]
Recherche




Météo / Spam / www

Météo Lyon


aldweb contre le SPAM


Newsletter
Pour avoir des nouvelles de ce site, inscrivez-vous à notre Newsletter.
S'abonner
Se désabonner
298 Abonnés
Sites web de la famille

Webmaster - Infos
News Amis
Visites

   visiteurs

   visiteurs en ligne

Sondage
Comment trouve-tu le nouvel habillage de l'aldweb Site ?
 
Superbe !
Joli
Moyen
Moche...
Résultats
forum.gifForum - iziBasic - Sujet n°1621

Forum - Forum
iziBasic - iziBasic


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

actif  Sujet n° 1621  Use C code in an iziBasic program?

le 20/09/2008 @ 19:44
par Ashley

Anonyme



I would like to use the following code in an iziBasic app. How should I do this?

#include <PalmOS.h>
#include <SerialMgrOld.h>
#include "midi.h"

UInt16 midiSerLib;
Err midiSerError;

/*********************************************************************/
/*********************************************************************/
void OpenMidiPort(void)
{
/* open port */
SysLibFind("Serial Library", &midiSerLib);
midiSerError = SerOpen(midiSerLib, 0, 31250);
/* delay for half second to allow the port to be set up properly */
SysTaskDelay(SysTicksPerSecond() >> 1);
}

/*********************************************************************/
/*********************************************************************/
void CloseMidiPort(void)
{
/* close the port only if we need to */
if (midiSerError == 0 || midiSerError == serErrAlreadyOpen)
SerClose(midiSerLib);
}

/*********************************************************************/
/*********************************************************************/
void SendMidi(UInt8 a, UInt8 b, UInt8 c, UInt8 size)
{
/* MIDI has up to three bytes per message. Size is the number of bytes to send.
The value of the unused messages doesnt matter, and i usually give it 0xFF */
Err err = 0;
UInt8 midiBuf[3] = {a, b, c};

SerSend(midiSerLib, midiBuf, size, &err);
if (err)
SerClearErr(midiSerLib);
}

/*********************************************************************/
/*********************************************************************/
void MidiPanic(void)
{
/* super-mega all notes off, adapted after the messages cakewalk sends. */

UInt8 i;

for (i = 0; i < 16; i++) {
SendMidi(0xE0 + i, 0x00, 0x40, 3);
SendMidi(0xB0 + i, 0x01, 0x00, 3);
SendMidi(0xB0 + i, 0x07, 0x7F, 3);
SendMidi(0xB0 + i, 0x0A, 0x40, 3);
SendMidi(0xB0 + i, 0x40, 0x00, 3);
SendMidi(0xB0 + i, 0x42, 0x00, 3);
SendMidi(0xB0 + i, 0x43, 0x00, 3);
SendMidi(0xB0 + i, 0x79, 0x00, 3);
SendMidi(0xB0 + i, 0x7B, 0x00, 3);
}
}

void OpenMidiPort(void);
void CloseMidiPort(void);
void SendMidi(UInt8 a, UInt8 b, UInt8 c, UInt8 size);
void MidiPanic(void);


  Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1
--------
le 21/09/2008 @ 20:28
par aldweb

Anonyme

visiteur
Hello Ashley,

You can very well use the functions provided by this code in an iziBasic application. You will just have a little bit of work to do.

The answer is to use a so-called "PP applet" (see iziBasic's user manual).

This C code will basically have to be translated to a PP code, not forgetting to retrieve those of the API functions calls (from the C headers PalmOS.h, SerialMgrOld.h and midi.h) used in this source code.

Since Pascal is quite close from C, this translation will be very easy (for those used to read C source codes and accustomed to the Pascal structure).

I wish I had some free time and access to a PC in the next days to do the job for you. Do you feel confident doing it yourself?

Cheers,
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 2
--------
le 22/09/2008 @ 20:09
par Ashley

Anonyme

visiteur
I am not confident about tranlsating this to PP. If you could help that would really useful!

Thanks. Ashley.
  Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 3
--------
le 28/09/2008 @ 19:08
par aldweb

Anonyme

visiteur
Hello Ashley,

For a series of reasons, I will not be in the capacity to do the job in the coming 2 months or so... Can you wait that long?

Anyway, drop me the C files by e-mail (including the .h ones) so that I can try to work on this conversion during some spare time...

Cheers,
aldweb
Ecrire à aldweb   Poster une réponse  Haut
actif sujet actif   clos sujet clos   Important! Important!   Nouveau Nouveau message   -   Rectifier Rectifier message   Clôturer Clôturer sujet   Remonter Remonter
[]
Catégories de discussion  Forum 



 
^ Haut ^