Commit Graph
229 Commits
Author SHA1 Message Date
Mike Brady bfc7b9b774 lengthen some mutex timeouts to allow valgrind to work okay on a Pi 3B. Make operations that open the mixer uncancellable until it's closed again to stop a few small memory leaks when a player is cancelled. 2019-02-01 16:19:27 +00:00
Mike Brady 0c5521488c add a special mixer-only mutex, do make open/close mixer stuff safer and probably quicker, not waiting for the main alsa mutex. 2019-02-01 12:38:45 +00:00
Mike Brady 2c0250b32a Don't do a hardware mute when doing a flush -- if disable_standby is true, the mode goes to connected and then if player goes back to play immediately, you might hear some of the sound still moving through the output buffer. This happens due to a bug in IOS player. 2019-01-31 17:11:33 +00:00
Mike Brady 60487c86b1 Make mute work only if not diconnected. Clewan up some debug messages. 2019-01-31 13:35:11 +00:00
Mike Brady 555bb97a39 Rebuild the hardware mute code -- clear up the logic. Needs to check if disconnected though. 2019-01-31 09:01:35 +00:00
Mike Brady fd08511f1f Make it work with deferred initialisation of the alsa device -- deferred to first use. Investigate hardware mute again. 2019-01-30 17:43:15 +00:00
Mike Brady c5ff0dfed0 Rebuild the volume control calculations. Implement software mute. Try to delay alsa initialisation as long as possible. 2019-01-30 09:24:10 +00:00
Mike Brady aa5698fce2 Remove the preflight call - don't seem to need it. 2019-01-27 15:53:36 +00:00
Mike Brady 02955ecabd bring up to date with unstable branch 2019-01-27 14:25:02 +00:00
Mike Brady 56bf886206 gracefully handle situation when the output device is already in use; release it properly when finished. 2019-01-27 14:19:39 +00:00
Mike Brady c807513422 quieten a few debug messages, bring a standard one forward. 2019-01-24 16:33:50 +00:00
Mike Brady b02e5d9f20 Use returned codes from do_open() to control the state machine -- don't go to abm_connected unless, eh, connected. 2019-01-24 09:14:41 +00:00
Mike Brady 9fb37e4293 Reorganise code to make it respond dynamically to changes in settings. 2019-01-23 22:22:27 +00:00
Mike Brady bd81e733cd Introduce a simple state machine into the alsa backend to keep track of the connected state of it. Needed to deal properly with disabling and enabling standby dynamically. 2019-01-23 16:44:02 +00:00
Mike Brady 2e4428538d Add an "active" mode that can time out after a period -- 10 seconds by default -- after play ends. 2019-01-21 21:43:55 +00:00
Mike Brady 020a69dfb9 remove the cause of a CLANG warning 2019-01-18 16:27:29 +00:00
Mike Brady fbd8377519 Always add dither if no hardware mixer and volume control is not ignored. 2019-01-10 16:57:40 +00:00
Mike Brady c958d506b1 reduce thresholds towards a buffer time of 0.2 seconds rather than the 0.25 seconds before. 2019-01-09 14:15:05 +00:00
Mike Brady 2a9d46afed backend silence threshold should be 0.060 not 0.6! 2019-01-09 10:10:04 +00:00
Mike Brady e9623faa44 Go for a 0.250 second buffer length. 2019-01-08 17:28:38 +00:00
Mike Brady 56f4b124bd Adjust thresholds and timings to suit pi zero. 2019-01-08 13:06:46 +00:00
Mike Brady caf06c5aba Add the idea of a preflight message to tell the backend that frames will be coming... 2019-01-07 17:34:50 +00:00
Mike Brady 4613ee6bcb Make buffer size threashold 100 ms instead of 50 ms. Remove some surplus snd_pcm_prepare calls. 2019-01-07 16:00:58 +00:00
Mike Brady 0e37f7e78d Only look for snd_pcm_status_get_driver_htstamp is alsa version 1.1 or later... 2019-01-04 21:52:36 +00:00
Mike Brady 6b42abab72 Use driver htstamp rather than regular one. Use untimed_delay so that a regualr delay sets the standoff timer for silence. 2019-01-04 20:57:18 +00:00
Mike Brady 48043a81cc Move stall threshold calculation to init from start, duh. 2019-01-04 18:17:30 +00:00
Mike Brady 80f15e1f57 clang format 2019-01-04 17:26:55 +00:00
Mike Brady 9552b278b7 remove some debugging code from delay(). 2019-01-04 17:26:00 +00:00
Mike Brady 7496364aaa continue to change delay() and play() to reflect use of snd_pcm_recover _after_ a XRUN has occurred -- fix rate calculations etc. 2019-01-04 17:20:15 +00:00
Mike Brady 459dd51a31 Use snd_pcm_recover only _after_ an XRUN or suspend has happened. Don't use it to remove one -- it doesn't work. 2019-01-04 13:50:14 +00:00
Mike Brady 8e5733e6ae Check before using snd_pcm_prepare in delay() 2019-01-04 11:29:18 +00:00
Mike Brady 41c8c8b9a1 Strengthen the ability to recover from an XRUN by putting in a call to snd_pcm_prepare first. 2019-01-03 10:19:44 +00:00
Mike Brady 15729ebcd4 Fix trivial error in a debug message. 2019-01-02 22:40:48 +00:00
Mike Brady 8d8b8c05f6 new play(), delay(), delay_prep_and_status() routines in place and working, but with the old stuff taken out. 2019-01-02 19:54:12 +00:00
Mike Brady 59d26918f6 new play(), delay(), delay_prep_and_status() routines in place and working, but with the old stuff still around. 2019-01-02 19:49:15 +00:00
Mike Brady 6f8b35d121 Try out a new alsa delay routine. Could be very buggy! 2019-01-02 14:43:25 +00:00
Mike Brady fe857037de If output is stalled, don't write any more frames to the output device. 2018-12-31 17:46:05 +00:00
Mike Brady fc08572631 Modify my_snd_pcm_delay but don't test it yet! 2018-12-29 09:34:10 +00:00
Mike Brady 919c5fe8b8 Add some diagnostics around the state of the DAC during delays. 2018-12-28 10:35:13 +00:00
Mike Brady ad6c721d5a Format 2018-12-27 14:04:31 +00:00
Mike Brady 1828545602 Account for duration of samples to be played and use the untimed_play when calculating silence-filling backoff period. 2018-12-27 14:01:32 +00:00
Mike Brady 284cb9d3fb Return genuine error codes where available in actual_open_alsa_device. 2018-12-26 10:41:20 +00:00
Mike Brady 70cd4fe81f Further adjustments to the silence thread -- make the sleep time 30 ms, thus if the queue goes below 60 ms of samples, silence will be inserted unless an audio write occurred within the last 30 ms. 2018-12-17 17:11:46 +00:00
Mike Brady 2830cdf712 adjust minimum interval between last audio write and writing silence. 2018-12-17 16:50:36 +00:00
Mike Brady a96d28c4e5 Need to use an untimed play for the silence buffer filler. 2018-12-17 16:44:19 +00:00
Mike Brady cb17fb263a Don't send silence into the alsa device within the scanner's sleep time of the last legitimate write to it. This is to stop the scanner inserting silent frames while the player is flushing fames. 2018-12-17 16:31:03 +00:00
Mike Brady 57e9619e5b Don't add dither if volume control is set to max. 2018-12-17 13:14:40 +00:00
Mike Brady 14e867a66b use dither if using software mixer (i.e. no hardware mixer and not ignoring the volume control) -- fix a mistake in accounting for the ignore_volume_control setting. 2018-12-17 11:30:23 +00:00
Mike Brady 4ba0947ddb Move the keep_dac_busy in to a configuration setting. Always start the keep_dac_busy thread and check if the keep_dac_busy is set. Don't dither is ignore volume control is set. 2018-12-15 15:36:44 +00:00
Mike Brady 7708ee3cdf Bring in the "disable_standby_mode" feature on alsa to stop some DACs making popping noises. Fix dither generation. 2018-12-14 15:28:32 +00:00