about summary refs log tree commit homepage
path: root/lib
DateCommit message (Collapse)
2015-12-14player: show "tracklist" hash with summary info with "current"
This allows clients to quickly query tracklist size/position/shuffle/random info.
2015-12-14tracklist: swap functionality
This (from the point of the client) will atomically swap two tracks. This should allow easily implementing of a tracklist editor.
2015-12-13unix_accepted: enable checking for readability after emit
2015-12-13parse_time: enable frozen_string_literal
This is a new feature in Ruby 2.3 which can reduce allocations without adding ugly ".freeze" calls everywhere. This is a small enough file that we shouldn't have to worry about inadvertant breakage.
2015-12-13player: dump state file asynchronously when requested
This avoids stalling when we have a gigantic tracklist.
2015-12-13player: support "tl clear" internally
It is orders of magnitude more efficient to implement this in the player and very noticeable when using large playlists.
2015-12-13player: reduce I/O priority of connected clients
Do not batch processing of requests or buffered output. We cannot have clients running "dtas-tl cat" or similar to dump a gigantic playlist cause us to have gaps in our playback. Since we implemented a tunable tracklist limit, we can also remove the hardcoded 100 element limit for buffered messages while we're at it; now the tracklist limit affects maximum memory use.
2015-12-13mlib: split out the output format from the library
The caller should dictate how the output format goes, not the library.
2015-12-13mlib: add find/search functionality based on mpd
This allows fast-ish tag searching, but the internal API is still subject to change to ease emulation of mpd.
2015-12-13mlib: no kwargs for 1.9.3 compatibility
We'll continue supporting Ruby 1.9.3 as long as Debian wheezy is supported.
2015-12-13mlib: add stats support
These are the same stats used by the mpd "stats" command.
2015-12-13mlib: remove non-existent entries
Files in a music library may be deleted or renamed, so our library should not persist old data. Unfortunately this double-stats all files, but using a hash for temporary storage could also bloat memory/disk usage and probably isn't worth it at the moment.
2015-12-13switch to exception-free non-blocking I/O
Ruby 2.3 will have `exception: false' support in socket-related classes. Additionally, 2.3 will implement the existing IO#*_nonblock methods more efficiently than before by avoiding the hash allocation necessary for keywords. For users on older Rubies, we'll continue supporting them with compatibility wrappers; even Ruby 1.9.3 users (for now).
2015-12-13tracklist: fixup idempotent "tl shuffle false"
Disabling shuffle should be idempotent.
2015-12-07player: tl (repeat|shuffle|max) and trim swap values
It makes more sense to return the previous value rather than the newly-set one, since the user presumably knows what they're setting and might care about the previous value.
2015-12-07player: refactor and document tracklist interface
The dpc_tl method was becoming too large, split it up into sub-methods for easier readability. While we're at it, at least make "tl repeat" consistent with "tl shuffle" when setting new values.
2015-12-07tracklist: support limiting maximum tracklist size
This defaults to 16384? This is what mpd uses by default as well. Of course folks interacting with dtas-player directly can override this: dtas-tl max INTEGER dtas-tl max This is NOT meant to be a hard security measure for local users talking to dtas-player directly. It is only to prevent accidentally stupid things like flooding the playlist with a broken script and to prevent remote users from DoS-ing us via the to-be-written mpd proxy/emulation layer. Remember: dtas-player itself will ALWAYS remain capable of executing arbitrary code :)
2015-12-07tracklist: shuffle support
This is in the MPRIS 2.0 TrackList spec and also in mpd (as "repeat" mode), so we can probably support it directly in player to ease implementations of future wrappers.
2015-12-06tracklist: avoid needlessly building a hash for track IDs
Building this hash is a linear operation anyways, so there's no point in doing it when Array#index can stop early if the track is found, to avoid unnecessary work.
2015-12-05tracklist: do not mutate @list when serializing
This happens when "dtas-ctl state dump" is invoked manually; causing "dtas-tl cat" to break afterwards. Fixes: commit 7b065706d37df9e54c8b3299ce696545c6159fa4 ("tracklist: use lower number unique track IDs")
2015-12-05tracklist: use lower number unique track IDs
This is easier for users to read and type; and _might_ help with race conditions due to fast object recycling from GC. We'll also be implementing playist versioning on top of this in the next commits for MPD protocol compatibility. Unfortunately this adds an additional 40 bytes of per-track overhead (on 64-bit systems, its only 20 bytes on 32-bit). However, we may be able to save memory in the future by supporting dtas-mlib node IDs if we integrate dtas-player with DTAS::Mlib. While we're at it, include a minor speedup for DTAS::Tracklist#remove_track by using Array#delete_at instead of relying on Array#compact! after assignment This should improve "dtas-tl cat" output readability dramatically. The state file (~/.dtas/player_state.yml) remains compatible between dtas-player before and after this change.
2015-11-28dtas-mlib: add dump support for debugging
Using an RFC-822-like format since YAML quoting rules aren't very human-friendly, and we already prevent newlines from entering our DB anyways.
2015-11-22introduce dtas-mlib for music library functions
Eventually this will support searching and be the basis of an mpd-compatible proxy in front of dtas-player
2015-10-04player: cleanup command dispatch
We can generate many command calls easily and dynamically, so avoid the code and cognitive overhead for the majority of commands.
2015-09-07player: add "queue cat" command
This will dump the contents of the current queue, including positional seeking information and commands. This is mainly intended for debugging and tools which rely on dtas internals.
2015-09-06use a common /dev/null
This allows us to avoid wasting time reopening the same device over and over again.
2015-07-18parse_freq: trivial new module for parsing frequencies
Seems a bit stupid, but oh well.
2015-07-18parse_time: pass through numeric types
This makes it easier to use in a user-friendly scripting interface we have coming up.
2015-06-16favor recv and recv_nonblock over recvmsg variants
We never use the full return value of the recvmsg* methods, so those allocations are wasted.
2015-06-15splitfx: set OUTFMT correctly for subenv if command is set
2015-05-24splitfx: allow -p/--sox-pipe option
This allows splitfx YAML files to operate more seamlessly with external commands such as play(1) especially when combined with the -t/--trim option.
2015-05-21splitfx: simplify output display
No point in executing echo and wasting CPU cycles. We'll only waste cycles now during dry-runs
2015-05-20splitfx: documentation for subclasses
2015-05-20splitfx: drop unnecessary variable
We no longer use it since commit 7b47191aa4c88b3daa4c980013f0047cb7ae7f6d ("splitfx: avoid double-truncation with user command")
2015-05-19source/splitfx: allow watching extra external scripts
Since writing nested shell commands inside YAML is subject to all sorts of strange quoting rules, encourage users to rely on external scripts which the YAML file refers to instead. These scripts can be written in any reasonable scripting language capable of executing other commands. This allows transparently monitoring things such as `my-script.rb' in the below example when playing my-splitfx.yml via dtas-player: --------------------- my-splitfx.yml ----------------------- infile: input.flac command: $INDIR/my-script.rb "$INFILE" ... --------------------- my-script.rb -------------------------- #!/usr/bin/ruby require 'shellwords' infile = ARGV.shift ch = %W(sox #{infile} -p).concat((ENV['TRIMFX'] || '').shellsplit) fx = %W(highpass 25 gain 9) l = ch.dup.concat(%W(remix 1v1)).concat(fx).concat(%w(contrast 30)) r = ch.dup.concat(%W(remix 2v1)).concat(fx).concat(%w(contrast 0)) cmd = %W(sox -M |#{l.shelljoin} |#{r.shelljoin}) cmd.concat((ENV['SOXFMT'] || '-p').shellsplit) cmd.concat(%w(- stats)) warn cmd.inspect exec *cmd
2015-05-19splitfx: avoid double-truncation with user command
It's probably harmless as the sub (second) command is usually innocuous as fars a modifying dynamic range, but it makes the command-line output confusing.
2015-05-18splitfx: remove support for encoding opus
Lossy file encoding has too many tunable variables and it is not a good fit for an audio production tool such as dtas-splitfx. This was becoming a maintenance burden for me and is a sign of featuritis.
2015-05-18splitfx: show correct command for output
2015-05-17process: implement array expansion to preserve spaces
This can make it easier to specify mcompand parameters in socks, as those require separate levels of parameter parsing and require quoting in shell.
2015-05-17dtas-splitfx: support --trim argument
It can often be useful to expose only part of a track for quick inspection. This lets us do that.
2015-05-17use monotonic clock on Ruby 2.1+
The monotonic clock is immune to stepping adjustments so it is more suitable for tracking elapsed time differences. Process.clock_gettime also generates less garbage on 64-bit systems due to the use of Flonum.
2015-05-10splitfx: fix non-generic, user-specified targets
Regression appeared in the previous commit, oops. commit ab63c7bb1b69423f8c39a60dd00230c560eecfc4 (splitfx: fix lossy output with player command is in use)
2015-05-10splitfx: fix lossy output with player command is in use
We must ensure lossy encodings do not get lossily-encoded twice, only once at the final stage. There is no effect for lossless outputs as lossless is the common case for splitfx users.
2015-05-10splitfx: --bits and --rate for quick-n-dirty generic targets
generic targets (e.g. "wav") is useful for quickly checking if clipping is introduced by dither and resampling, so we'll support changing the sample rate and bits-per-sample from the command-line so users don't need to setup their own targets or wait on FLAC encoding.
2015-05-10splitfx: pass compression factor to sox(1)
This can be useful for speeding up splitfx during development, as sox defaults to maximum compression with FLAC and that is extremely slow.
2015-05-10splitfx: support -O/--outdir switch to control output dir
It is useful to force output to a writable directory if the YAML file is on a read-only mount point or to force the output to a large tmpfs mount point to avoid SSD/HDD wear.
2015-05-10splitfx: fix typo for dither application
We do not need to dither unless we output to 16-bit or less. This bug caused us to unnecessarily apply dither on 24-bit output files. Oops!
2015-05-10tracklist: fix inf loop on ENOENT with repeat==1
If a file is missing, we must not respect the repeat option set by the user to avoid infinite looping
2015-05-07replaygain uses the "gain" effect instead of "vol"
The `gain' effect seems superior as it can "see" across the effects chain to take into account extra/lost headroom. For example, this allows me to add the the "gain -h" effect at the start of my effects chain before the RGFX placeholder in my source command, so when I play a file requiring a -6dB ReplayGain adjustment, I will only need an additional -4dB of headroom to accomodate the 10dB boost at 20Hz I use (for listening through headphones): Before: RGFX='vol -6dB' sox "$INFILE" $SOXFMT - $TRIMFX $RGFX vol -10dB equalizer 20 0.7071q 10 After: RGFX='gain -6' sox "$INFILE" $SOXFMT - $TRIMFX gain -h $RGFX equalizer 20 0.7071q 10
2015-04-13cleanup: avoid redundant Array conversion for escapes
We already convert xs arg to be an Array, so avoid bloating our code with redundancy.