Native interface questions.

About Monkey 2 Forums Monkey 2 Development Native interface questions.

This topic contains 3 replies, has 2 voices, and was last updated by  Simon Armstrong 2 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2235

    Simon Armstrong
    Participant

    Hi Mark,

    Some questions about module development.

    What are the best ways to do following:

    1. Returning const char * to monkey2
    2. Add a -Ddefine to compiler flags when building a module’s .c and .cpp
    3. What is state of audio modules?

    For the first I am using the extern struct constcstring=”const char” as you do in gles20 and for the second I am hacking #define into appropriate header so they build properly.

    I am also interested if you have any immediate plans to add to the module space and state of audio. Does openal mean sdl2 mixer should be deprecated. Does emscriptem have audio and how? Can monkey2 call webgl / webaudio/ webmidi directly for web? Am looking forward to exploring this area.

    S

    #2238

    Mark Sibly
    Keymaster

    Returning const char * to monkey2

    This side of things is still a bit nasty, but for now I’d suggest make the function return a pointer to one of the char types in libc, eg: libc.char_t Ptr, libc.unsigned_char_t Ptr or libc.signed_char Ptr (I will probably also add const_char_t, const_signed_char_t etc).

    Then use String.FromCString() or String.FromUtf8String() to convert the pointer to an mx2 string.

    Add a -Ddefine to compiler flags when building a module’s .c and .cpp

    You can’t yet, although you can hack the env_blah.txt file to force the define everywhere. I want to come up with a better way to achieve this rather than abusing #import ala bmx, but until then…

    I am hacking #define into appropriate header so they build properly.

    …is probably your best bet and what I actually what I’ve done for several modules.

    What is state of audio modules?

    Pretty good IMO!

    Does openal mean sdl2 mixer should be deprecated.

    I wont be using it myself for mojo.audio, but I don’t see why it can’t be left in there for others to use. Note also that AppInstance no longer inits SDL_AUDIO, but I probably don’t have to do this.

    Does emscriptem have audio and how?

    It has openal ‘built-in’. No fibers though, so no WaitQueued(). NumQueued can probably happen so you should eventually be able to poll.

    Can monkey2 call webgl / webaudio/ webmidi directly for web?

    Don’t see why not. #Import js might be useful here? Not in right now though.

    #2239

    Simon Armstrong
    Participant

    Thanks!

    Yes, I imagine importing js will be very useful when I poke my nose in.

    I think maybe emscripten is ok name for target but seems a bit cryptic for lay person. In monkey2 is there a way for #if testing between cpp and js or maybe native and web environments?

    #2288

    Simon Armstrong
    Participant

    OK, vsynth is running well on OpenAL,

    To make use of new? std.audio stuff just been playing with skidmarks engine sample oscillator. Very happy it was so easy and bug free? and I may have missed a helper method…

     

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.