Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    25+ Posting Member themax222's Avatar
    Join Date
    Oct 2008
    Location
    Brussels
    Posts
    54
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Sioc trim sound problem

    Hello,

    I'm a beginner in sioc and I'm trying to play a sound when moving the trim. This is what I tried :

    Var 0091
    {
    V0091 = V0092
    }

    Var 0092, Link FSUIPC_IN, Offset $0BC2, Length 2 // pitch trim indicator
    {
    IF V0092 <> V0091
    {
    V0093 = 1
    V0091 = V0092
    }
    ELSE
    {
    V0093 = 0
    }
    }

    Var 0093
    {
    IF v0093 = 1
    {
    &PLAY_SOUND = 2
    &PLAY_SOUND = 0
    }
    ELSE
    {
    &STOP_SOUND = 2
    &STOP_SOUND = 0
    }
    }
    When sioc starts, the sound is playing, that's not good What am I doing wrong ? Does someone have a better code ?

    Thanks,

    Maxime.

  2. #2
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Sioc trim sound problem

    Hallo Maxime,

    There are two problems with your code.

    1st: Initialisation, when SIOC starts your script, the body of Var 0091 will not execute (because you do not assign a value to Var 0091)

    2nd: When the code of Var 0092 is executed the value of Var 0092 is always not equal to Var 0091 (otherwise the code in the body of Var 0092 was not executed at all ...). This is a design principle of the SIOC language, the statements in the body attached to a variable are only executed if the variable changes value.

    Observation: Note that the pitch trim value is not stable, it will always fluctuate a little, so it is not a good trigger for a sound signal (unless you smooth the values and start a sound only when big delta's are detected. Difficult, imho. You bettter look for another trigger, a change in the rotary or potmeter controlling your pitch would be better.

    regards,
    Nico
    Last edited by kiek; 05-02-2010 at 05:40 AM.

  3. #3
    500+ This must be a daytime job
    Join Date
    Jul 2013
    Posts
    948
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Sioc trim sound problem

    Maxime

    The following link explains how to code SIOC for using the SOUND function, the last post is the best example.

    http://www.opencockpits.com/modules....=1825&forum=13

    Are you using the correct FSUIPC offset? suggest you try this one:-

    Offset 3370
    4 Four single byte PFC driver ―alive‖ counters:

    3370 = COM port read thread alive and running
    3371 = Elevator trim motor action (0=off, 1=up, 2=dn)
    3372 = COM port write thread alive
    3373 = Main FS chain alive
    N.B. without the main FS chain running the other three aren‘t maintained in any case, so mean nothing

    David

  4. #4
    25+ Posting Member themax222's Avatar
    Join Date
    Oct 2008
    Location
    Brussels
    Posts
    54
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Sioc trim sound problem

    Hello,

    thanks for help but as I'm a newbie in sioc programming I don't know what to do with these offset(s). These are Project magenta offsets, isn't it a problem if I don't use it ? Do I have to use the 4 variables (3370,3371,...) ?

    Can somebody help and make a little code ?

    Thanks a lot,

    Maxime.

  5. #5
    500+ This must be a daytime job
    Join Date
    Jul 2013
    Posts
    948
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Sioc trim sound problem

    Maxime

    These are not Project Magenta offsets but native FSUIPC ones. I only suggested trying the one in red as this offset appears to signal when the trim motor is moving! If you incorporate the suggestions made by Nico and change the offset reference then give it a try. Also bear in mind the advice and example given in the thread pointer to the OC site as you will need to amend your sioc.ini file

    The best way to learn is to try it yourself

    David

  6. #6
    25+ Posting Member themax222's Avatar
    Join Date
    Oct 2008
    Location
    Brussels
    Posts
    54
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Sioc trim sound problem

    Hello,

    I already use sioc sounds so I know how to use them but I can't find to make a code working for trim. When I use this offset 3371, what is the length ?

    Var 0906, Link FSUIPC_IN, Offset $3371, Length ??
    {
    IF V0906 = 0
    {
    &STOP_SOUND = 2
    &STOP_SOUND = 0
    }
    ELSE
    {
    &PLAY_SOUND = 2
    &PLAY_SOUND = 0
    }
    }
    Is this correct to get the value if the trim is up or down ?

    Thanks,

    Maxime.

  7. #7
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Sioc trim sound problem

    You can find the definitions of all FSUIPC offsets in the FSUIPC for Programmers.pdf, available in the FSUIPC SDK (downloadable at Pete Dowson's page)

  8. #8
    500+ This must be a daytime job
    Join Date
    Jul 2013
    Posts
    948
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Sioc trim sound problem

    Maxime

    I gave you the length earlier!
    Offset 3370
    4 Four single byte PFC driver ―alive‖ counters:

    3370 = COM port read thread alive and running
    3371 = Elevator trim motor action (0=off, 1=up, 2=dn)
    3372 = COM port write thread alive
    3373 = Main FS chain alive

    Single byte at offset 3371 !!!

    David

  9. #9
    25+ Posting Member themax222's Avatar
    Join Date
    Oct 2008
    Location
    Brussels
    Posts
    54
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Sioc trim sound problem

    Ok Thanks but it is more easy with just a simple offset 0 or 1. What do I need to use ? Length 4 ? length 1 ? offset 3370 ? offset 3371 ?

    Don't find manuals or tutorials wich explains how to use such offsets. I tested the above code with length 1 but it doesn't work.

    Thanks,

    Maxime.

  10. #10
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Sioc trim sound problem

    Quote Originally Posted by themax222 View Post
    Don't find manuals or tutorials wich explains how to use such offsets. I tested the above code with length 1 but it doesn't work.
    It bit of googling and you would have found how to read from FSUIPC offset

Page 1 of 2 12 LastLast

Similar Threads

  1. Trim wheel Sound
    By Peter Nielsen in forum PM Boing MCP
    Replies: 1
    Last Post: 01-09-2011, 11:14 AM
  2. SIOC Help - Stab Trim and Reversers
    By redman in forum OpenCockpits General Discussion
    Replies: 1
    Last Post: 12-08-2008, 04:12 PM
  3. SIOC SOUND: How to make a looping sound?
    By stabell in forum OpenCockpits General Discussion
    Replies: 3
    Last Post: 10-29-2008, 08:27 PM
  4. Lear trim sound
    By alaxus in forum Cockpit Sounds
    Replies: 5
    Last Post: 02-15-2008, 02:58 PM
  5. Pitch Trim Sound
    By Elisio Cruz in forum PM General Q & A
    Replies: 1
    Last Post: 01-30-2006, 05:18 PM