Commit graph

847 commits

Author SHA1 Message Date
Ken Cooke
f80304d68e Change audio pipelines to process in exactly 10ms blocks (240 samples instead of 256).
This produces an integral number of samples when resampled to 44.1k or 48k, allowing a 44.1k back-end to work correctly without extra buffering or dynamic buffers sizes.
2016-08-18 08:27:20 -07:00
Ken Cooke
d9f12e44dc Add resampler support for downsampling with variable-input constant-output buffering mode 2016-08-16 16:47:55 -07:00
Brad Hefta-Gaub
ca3a194454 implment coded renegotiation in client if for some reason unexpected audio codecs come in to inbound stream 2016-08-02 15:30:03 -07:00
Brad Davis
89d9affb41 Merge remote-tracking branch 'upstream/stable' 2016-07-22 19:47:31 -07:00
David Kelly
3d3a7a8820 Merge branch 'stable' of github.com:highfidelity/hifi into dk/hotfixForAudio 2016-07-22 18:40:06 -07:00
David Kelly
8b8a98bfcc Acutally audio was really broken
Seems there were 2 issues:
* If you couldn't inject locally (say, no audio interface
  because you are an assignment client), we would not do the
  network injection at all.  That's bad.
* When we don't have a codec, like when using an injector, we
  were serializing the empty string in some problematic way.  I
  just use the built-in serialization, and it seems fine.

I tested this by first playing a sound in the console (or maybe you
want to tip some cows, that is ok too).  Then in _another_ interface
client on another machine in the same domain, I better hear the
sound.

Then, I added a script to play audio as a persistent script, which
just loops forever and ever.  You should hear that on both interface
clients also.

A detailed test plan to follow.

Also: using @zappoman serialization code, which is safer than using
the Qt code which does magical things for nulls.  Good to do this cuz
you know, things happen...
2016-07-22 18:33:38 -07:00
David Kelly
4b48cc7c2e Acutally audio was really broken
Seems there were 2 issues:
* If you couldn't inject locally (say, no audio interface
  because you are an assignment client), we would not do the
  network injection at all.  That's bad.
* When we don't have a codec, like when using an injector, we
  were serializing the empty string in some problematic way.  I
  just use the built-in serialization, and it seems fine.

I tested this by first playing a sound in the console (or maybe you
want to tip some cows, that is ok too).  Then in _another_ interface
client on another machine in the same domain, I better hear the
sound.

Then, I added a script to play audio as a persistent script, which
just loops forever and ever.  You should hear that on both interface
clients also.

A detailed test plan to follow.

Also: using @zappoman serialization code, which is safer than using
the Qt code which does magical things for nulls.  Good to do this cuz
you know, things happen...
2016-07-22 17:47:24 -07:00
Brad Hefta-Gaub
bb8224be8c fix silence on no codec after previous codec has been set 2016-07-21 13:57:11 -07:00
David Kelly
7b2d5e7fab Potential cause of that buzzsaw when resetting 2016-07-20 10:41:16 -07:00
Brad Hefta-Gaub
1ee5023f6d fix warnings 2016-07-19 08:33:54 -07:00
Brad Hefta-Gaub
c484fec51d cleanup 2016-07-18 22:54:57 -07:00
Brad Hefta-Gaub
dbf60a594c Merge branch 'master' of https://github.com/highfidelity/hifi into addCodecNameToStream 2016-07-18 22:43:16 -07:00
Brad Hefta-Gaub
c6ffd81c4b some cleanup 2016-07-18 22:42:38 -07:00
Brad Hefta-Gaub
2e63aba8c9 when getting unexpected codec in the mixer, send a message to the client to select a different codec 2016-07-18 22:29:05 -07:00
Brad Hefta-Gaub
20824f038c include codec in audio stream packets so that each side can discard packets that don't match 2016-07-18 21:59:44 -07:00
David Kelly
2a89fa25bb Removing comments
Since I looked into it, seems ok
2016-07-18 16:22:12 -07:00
David Kelly
df615b1503 NotFinished never should have had its own bit
Since there is a Finished flag too.  So now, it is just 0, used as
a starting point, and we check for !hasState(Finished).  <sigh>
2016-07-18 16:02:02 -07:00
David Kelly
8c0eb1e4d2 Fixed some bad logic
When I "fixed" my or instead of and issue, I did it in the wrong
direction.  But it looked right :)  Now it is.  Sigh.  Long story
how it got there, but it seems good now.
2016-07-15 19:48:15 -07:00
David Kelly
fb99828e30 PR feedback
Code a bit more readable.  Sadly (and I guess it makes sense), a
enum class XXX is not a class, so you cannot have member functions
for it.  I can imagine no way to have a vtable if you are really
representing it as a uint8_t or whatever.  So, I put a stateHas
function in the AudioInjector instead.  Definite improvement.
2016-07-15 17:09:27 -07:00
David Kelly
8df4ed01d9 fixed typo
which oddly I was sure I already did.  Seems I didn't push it?  OK
now it is pushed.
2016-07-15 16:22:41 -07:00
David Kelly
0fcc427d41 Merge branch 'master' of github.com:highfidelity/hifi into dk/localNoEcho 2016-07-15 11:01:42 -07:00
David Kelly
e1212c54cb Updated to deal with streaming out of both buffers
So gotta keep track of when finished streaming to network and
locally separately.  That means the State needed to be more of a
bitflag and less of an enum.
2016-07-15 09:55:50 -07:00
Ken Cooke
d84c7524bf Remove global HRTF headroom.
The initial HRTF reduced overall gain by -6dB to avoid clipping at spectral peaks. With the addition of a peak limiter, this is no longer necessary. Changing to 0dB improves the loudness match between spatialized and unspatialized sounds.
2016-07-14 14:56:58 -07:00
Ken Cooke
fa55fc84f5 Optimized compute of distance filters using log-quantized lookup tables.
Magnitude error < 0.25dB for entire parameter space.
2016-07-14 12:04:05 -07:00
Ken Cooke
c7c02d7a59 Fix compiler warning 2016-07-14 11:24:48 -07:00
Ken Cooke
d7399f5781 Improved HRTF.
Adds a distance filter to model the frequency-dependent attenuation of sound propagation in open air.
Optimized using SIMD and computing all biquads in parallel. Performance impact is almost zero.
Filter updates are continuously interpolated and clean to -90dB.

Not enabled yet (distance hardcoded to 0.0f)
2016-07-14 10:34:42 -07:00
David Kelly
dde4d16759 Merge branch 'master' of github.com:highfidelity/hifi into dk/firstLameAttempt 2016-07-13 15:15:35 -07:00
David Kelly
c951f507e3 Fixed issue with calling setOptions
Since the stereo option is computed from the .wav file, if you call
setOptions later (like the cow.js does), it resets stereo to false.
So, I now just copy the stereo flag into the new options, since the
sound file is the same.

Also, calling AudioClient::outputLocalInjector on the AudioClient
thread now to avoid potential concurrency issues accessing the
vector of injectors.
2016-07-13 11:28:36 -07:00
Brad Hefta-Gaub
ceffa219b3 support for lost packets 2016-07-11 15:18:02 -07:00
David Kelly
c84ef5f626 Stereo injectors now handled same as mono
Except of course no HRTF.
2016-07-11 11:31:47 -07:00
David Kelly
46dc5bea04 cleanup from PR comments 2016-07-11 09:31:05 -07:00
Brad Hefta-Gaub
7d608ba592 groundwork for injector support 2016-07-10 21:01:20 -07:00
Brad Hefta-Gaub
ed9715ae5f some cleanup, proper memory allocation/deallocation 2016-07-10 17:40:58 -07:00
Brad Hefta-Gaub
ba6bb24595 rework plugins to allow different decoder/encoder instances per streams 2016-07-10 16:49:03 -07:00
Brad Hefta-Gaub
a71baf5601 handle codec prioritization, handle multiple codec choices 2016-07-08 21:18:03 -07:00
Brad Hefta-Gaub
126e5c2926 codec pipeline working, zlib example 2016-07-08 14:34:44 -07:00
Brad Hefta-Gaub
3c6447326e more codec plumbing 2016-07-07 21:24:24 -07:00
David Kelly
6cc085b48e Merge branch 'master' of github.com:highfidelity/hifi into dk/firstLameAttempt 2016-07-07 16:15:20 -07:00
David Kelly
600348bf10 Initial cut of htrf for mono localOnly injectors
Probably need to clean up a bit, but wanted to get this out there
for comment on more general issues, etc...

To test, I added a localOnly: true to the cow in the tutorial.
2016-07-07 16:07:41 -07:00
Ken Cooke
f43c6447e1 remove unneeded #pragma 2016-07-03 11:46:23 -07:00
Ken Cooke
014f6fa259 PR feedback: better naming of convertInput() and convertOutput() 2016-07-03 11:40:32 -07:00
Ken Cooke
f7c9957bb1 PR feedback: better naming of convertInput() and convertOutput() 2016-07-03 11:33:05 -07:00
Ken Cooke
941067b9d0 Added floating-point audio reverb 2016-07-02 07:25:04 -07:00
Ken Cooke
ad8f17a142 Add support for deinterleaved float-point audio (native format) 2016-07-01 19:29:43 -07:00
Ken Cooke
d3c006b5da Added floating-point audio resampler 2016-07-01 18:50:53 -07:00
Ken Cooke
dd0d594524 cleanup 2016-06-09 16:31:09 -07:00
Ken Cooke
d7079fce8c Use shared CPUDetect.h for CPU detection 2016-06-09 15:07:24 -07:00
Ken Cooke
14b51d6615 Use common code for AVX detection 2016-06-07 06:50:38 -07:00
Ken Cooke
b60b9bb312 compiler fixes for GCC/clang 2016-06-06 14:54:15 -07:00
Ken Cooke
8faaa36913 moved table of precomputed data into AudioSRCData.h 2016-06-06 12:05:48 -07:00