Compare commits

..

No commits in common. "master" and "pulseaudio" have entirely different histories.

4 changed files with 16 additions and 24 deletions

View File

@ -16,14 +16,12 @@ Cross Platform device manager for driving and flight simulators, for use with co
- 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.
- 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
- libserialport - arduino serial devices
- hidapi - usb hid devices
- libusb - used by hidapi
- portaudio - sound devices (haptic bass shakers)
- pulseaudio - sound devices (haptic bass shakers)
- libenet - UDP support (not yet implemented)
- libxml2
- argtable2
@ -46,11 +44,6 @@ cmake ..
make
```
to use the pulseaudio backend use this cmake command
```
cmake -DUSE_PULSEAUDIO=YES ..
```
## Testing
### Setting up Your Arduino Device

View File

@ -5,19 +5,12 @@ devices = ( { device = "USB";
subtype = "Revburner";
granularity = 4;
config = "/home/paul/.config/monocoque/revburner1.xml"; },
{ device = "Sound";
type = "Engine";
devid = "alsa_output.usb-Generic_USB2.0_Device_20170726905959-00.analog-stereo";
pan = 1;
volume = 90;
frequency = 27; },
{ device = "Sound";
type = "Gear"
devid = "alsa_output.usb-Generic_USB2.0_Device_20170726905959-00.analog-stereo";
pan = 1;
duration = .25;
volume = 100;
frequency = 27; },
{ device = "Sound";
type = "Engine"
devid = "98FD:83AC"; },
{ device = "Sound";
type = "Gear"
devid = "98FD:83AC"; },
{ device = "Serial";
type = "ShiftLights";
config = "None";

View File

@ -123,7 +123,7 @@ int usb_generic_shaker_init(SoundDevice* sounddevice, pa_threaded_mainloop* main
// recommended settings, i.e. server uses sensible values
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.prebuf = (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;
uint16_t pvolume = ceil(((double) volume/100.0d)*65535);
// Settings copied as per the chromium browser source
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
pa_cvolume_set(&cv, sample_specifications.channels, pvolume);
//pa_cvolume_set(&cv, 1, 0);
pa_cvolume_set_balance(&cv, &channel_map, pan);
assert(pa_stream_connect_playback(stream, devname, &buffer_attr, stream_flags, &cv, NULL) == 0);
// Wait for the stream to be ready
for(;;) {
pa_stream_state_t stream_state = pa_stream_get_state(stream);

View File

@ -203,9 +203,10 @@ int clilooper(SimDevice* devices, int numdevices, Parameters* p, SimData* simdat
for (int x = 0; x < numdevices; x++)
{
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);
if(ch == 'q')