Results 1 to 10 of 14
Thread: Sioc trim sound problem
-
05-02-2010, 03:40 AM #1
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
}
}
Thanks,
Maxime.
-
05-02-2010, 04:37 AM #2
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,
NicoLast edited by kiek; 05-02-2010 at 04:40 AM.
-
05-02-2010, 04:41 AM #3
- Join Date
- Jul 2013
- Posts
- 917
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
-
05-03-2010, 11:42 AM #4
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.
-
05-03-2010, 12:06 PM #5
- Join Date
- Jul 2013
- Posts
- 917
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
-
05-03-2010, 12:24 PM #6
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
}
}
Thanks,
Maxime.
-
05-03-2010, 12:30 PM #7
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)
-
05-03-2010, 12:37 PM #8
- Join Date
- Jul 2013
- Posts
- 917
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
-
05-03-2010, 12:47 PM #9
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.
-
05-03-2010, 12:50 PM #10
Re: Sioc trim sound problem
It bit of googling and you would have found how to read from FSUIPC offset
Similar Threads
-
Trim wheel Sound
By Peter Nielsen in forum PM Boing MCPReplies: 1Last Post: 01-09-2011, 11:14 AM -
SIOC Help - Stab Trim and Reversers
By redman in forum OpenCockpits General DiscussionReplies: 1Last Post: 12-08-2008, 04:12 PM -
SIOC SOUND: How to make a looping sound?
By stabell in forum OpenCockpits General DiscussionReplies: 3Last Post: 10-29-2008, 07:27 PM -
Lear trim sound
By alaxus in forum Cockpit SoundsReplies: 5Last Post: 02-15-2008, 02:58 PM -
Pitch Trim Sound
By Elisio Cruz in forum PM General Q & AReplies: 1Last Post: 01-30-2006, 05:18 PM
Search Womans from your town for night
HDG preselect function