OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 // the last computed value. | 692 // the last computed value. |
693 if (writeIndex >= 1) | 693 if (writeIndex >= 1) |
694 value = values[writeIndex - 1]; | 694 value = values[writeIndex - 1]; |
695 currentFrame = fillToEndFrame; | 695 currentFrame = fillToEndFrame; |
696 } | 696 } |
697 break; | 697 break; |
698 } | 698 } |
699 | 699 |
700 case ParamEvent::SetValueCurve: | 700 case ParamEvent::SetValueCurve: |
701 { | 701 { |
702 DOMFloat32Array* curve = event.curve(); | 702 CrossThreadPersistent<DOMFloat32Array>& curve = event.curve(
); |
703 float* curveData = curve ? curve->data() : 0; | 703 float* curveData = curve ? curve->data() : 0; |
704 unsigned numberOfCurvePoints = curve ? curve->length() : 0; | 704 unsigned numberOfCurvePoints = curve ? curve->length() : 0; |
705 | 705 |
706 // Curve events have duration, so don't just use next event
time. | 706 // Curve events have duration, so don't just use next event
time. |
707 double duration = event.duration(); | 707 double duration = event.duration(); |
708 // How much to step the curve index for each frame. This is
basically the term | 708 // How much to step the curve index for each frame. This is
basically the term |
709 // (N - 1)/Td in the specification. | 709 // (N - 1)/Td in the specification. |
710 double curvePointsPerFrame = (numberOfCurvePoints - 1) / dur
ation / sampleRate; | 710 double curvePointsPerFrame = (numberOfCurvePoints - 1) / dur
ation / sampleRate; |
711 | 711 |
712 if (!curve || !curveData || !numberOfCurvePoints || duration
<= 0 || sampleRate <= 0) { | 712 if (!curve || !curveData || !numberOfCurvePoints || duration
<= 0 || sampleRate <= 0) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 for (; writeIndex < numberOfValues; ++writeIndex) | 856 for (; writeIndex < numberOfValues; ++writeIndex) |
857 values[writeIndex] = value; | 857 values[writeIndex] = value; |
858 | 858 |
859 // This value is used to set the .value attribute of the AudioParam. it sho
uld be the last | 859 // This value is used to set the .value attribute of the AudioParam. it sho
uld be the last |
860 // computed value. | 860 // computed value. |
861 return values[numberOfValues - 1]; | 861 return values[numberOfValues - 1]; |
862 } | 862 } |
863 | 863 |
864 } // namespace blink | 864 } // namespace blink |
865 | 865 |
OLD | NEW |