Compare commits
No commits in common. "b3067e520dc7d84c5ed5ad12241f4a624cf7e68a" and "67d0423997ad944ade9296494e32571e17f8505f" have entirely different histories.
b3067e520d
...
67d0423997
|
|
@ -16,14 +16,12 @@ Cross Platform device manager for driving and flight simulators, for use with co
|
||||||
- Includes utility to configure revburner tachometer
|
- Includes utility to configure revburner tachometer
|
||||||
- Can send data to any serial device. So far only tested with arduino. Includes sample arduino sketch for sim lights.
|
- Can send data to any serial device. So far only tested with arduino. Includes sample arduino sketch for sim lights.
|
||||||
- The support for haptic bass shakers is limited and needs the most work. So far the engine rev is a simple sine wave, which I find convincing. The gear shift event works but not convincing enough for me.
|
- The support for haptic bass shakers is limited and needs the most work. So far the engine rev is a simple sine wave, which I find convincing. The gear shift event works but not convincing enough for me.
|
||||||
- Choice of Portaudio or Pulseaudio backend.
|
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
- libserialport - arduino serial devices
|
- libserialport - arduino serial devices
|
||||||
- hidapi - usb hid devices
|
- hidapi - usb hid devices
|
||||||
- libusb - used by hidapi
|
- libusb - used by hidapi
|
||||||
- portaudio - sound devices (haptic bass shakers)
|
- portaudio - sound devices (haptic bass shakers)
|
||||||
- pulseaudio - sound devices (haptic bass shakers)
|
|
||||||
- libenet - UDP support (not yet implemented)
|
- libenet - UDP support (not yet implemented)
|
||||||
- libxml2
|
- libxml2
|
||||||
- argtable2
|
- argtable2
|
||||||
|
|
@ -46,11 +44,6 @@ cmake ..
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
to use the pulseaudio backend use this cmake command
|
|
||||||
```
|
|
||||||
cmake -DUSE_PULSEAUDIO=YES ..
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
### Setting up Your Arduino Device
|
### Setting up Your Arduino Device
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,11 @@ devices = ( { device = "USB";
|
||||||
granularity = 4;
|
granularity = 4;
|
||||||
config = "/home/paul/.config/monocoque/revburner1.xml"; },
|
config = "/home/paul/.config/monocoque/revburner1.xml"; },
|
||||||
{ device = "Sound";
|
{ device = "Sound";
|
||||||
type = "Engine";
|
type = "Engine"
|
||||||
devid = "alsa_output.usb-Generic_USB2.0_Device_20170726905959-00.analog-stereo";
|
devid = "98FD:83AC"; },
|
||||||
pan = 1;
|
|
||||||
volume = 90;
|
|
||||||
frequency = 27; },
|
|
||||||
{ device = "Sound";
|
{ device = "Sound";
|
||||||
type = "Gear"
|
type = "Gear"
|
||||||
devid = "alsa_output.usb-Generic_USB2.0_Device_20170726905959-00.analog-stereo";
|
devid = "98FD:83AC"; },
|
||||||
pan = 1;
|
|
||||||
duration = .25;
|
|
||||||
volume = 100;
|
|
||||||
frequency = 27; },
|
|
||||||
{ device = "Serial";
|
{ device = "Serial";
|
||||||
type = "ShiftLights";
|
type = "ShiftLights";
|
||||||
config = "None";
|
config = "None";
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ int usb_generic_shaker_init(SoundDevice* sounddevice, pa_threaded_mainloop* main
|
||||||
|
|
||||||
// recommended settings, i.e. server uses sensible values
|
// recommended settings, i.e. server uses sensible values
|
||||||
pa_buffer_attr buffer_attr;
|
pa_buffer_attr buffer_attr;
|
||||||
buffer_attr.maxlength = (uint32_t) 32767;
|
buffer_attr.maxlength = (uint32_t) -1;
|
||||||
buffer_attr.tlength = (uint32_t) -1;
|
buffer_attr.tlength = (uint32_t) -1;
|
||||||
buffer_attr.prebuf = (uint32_t) -1;
|
buffer_attr.prebuf = (uint32_t) -1;
|
||||||
buffer_attr.minreq = (uint32_t) -1;
|
buffer_attr.minreq = (uint32_t) -1;
|
||||||
|
|
@ -131,17 +131,22 @@ int usb_generic_shaker_init(SoundDevice* sounddevice, pa_threaded_mainloop* main
|
||||||
pa_cvolume cv;
|
pa_cvolume cv;
|
||||||
uint16_t pvolume = ceil(((double) volume/100.0d)*65535);
|
uint16_t pvolume = ceil(((double) volume/100.0d)*65535);
|
||||||
// Settings copied as per the chromium browser source
|
// Settings copied as per the chromium browser source
|
||||||
|
|
||||||
pa_stream_flags_t stream_flags;
|
pa_stream_flags_t stream_flags;
|
||||||
stream_flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_NOT_MONOTONIC | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_ADJUST_LATENCY | PA_STREAM_START_CORKED;
|
stream_flags = PA_STREAM_INTERPOLATE_TIMING |
|
||||||
|
PA_STREAM_NOT_MONOTONIC | PA_STREAM_AUTO_TIMING_UPDATE |
|
||||||
|
PA_STREAM_ADJUST_LATENCY;
|
||||||
|
|
||||||
|
//stream_flags = PA_STREAM_START_CORKED;
|
||||||
// Connect stream to the default audio output sink
|
// Connect stream to the default audio output sink
|
||||||
pa_cvolume_set(&cv, sample_specifications.channels, pvolume);
|
pa_cvolume_set(&cv, sample_specifications.channels, pvolume);
|
||||||
|
//pa_cvolume_set(&cv, 1, 0);
|
||||||
|
|
||||||
pa_cvolume_set_balance(&cv, &channel_map, pan);
|
pa_cvolume_set_balance(&cv, &channel_map, pan);
|
||||||
|
|
||||||
assert(pa_stream_connect_playback(stream, devname, &buffer_attr, stream_flags, &cv, NULL) == 0);
|
assert(pa_stream_connect_playback(stream, devname, &buffer_attr, stream_flags, &cv, NULL) == 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Wait for the stream to be ready
|
// Wait for the stream to be ready
|
||||||
for(;;) {
|
for(;;) {
|
||||||
pa_stream_state_t stream_state = pa_stream_get_state(stream);
|
pa_stream_state_t stream_state = pa_stream_get_state(stream);
|
||||||
|
|
|
||||||
|
|
@ -203,9 +203,10 @@ int clilooper(SimDevice* devices, int numdevices, Parameters* p, SimData* simdat
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
devices[x].update(&devices[x], simdata);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( poll(&mypoll, 1, 1000.0/update_rate) )
|
if( poll(&mypoll, 1, 1000.0/DEFAULT_UPDATE_RATE) )
|
||||||
{
|
{
|
||||||
scanf("%c", &ch);
|
scanf("%c", &ch);
|
||||||
if(ch == 'q')
|
if(ch == 'q')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue