OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // concatenated response. | 63 // concatenated response. |
64 const int ElevationIndexTableSize = 10; | 64 const int ElevationIndexTableSize = 10; |
65 const int ElevationIndexTable[ElevationIndexTableSize] = { | 65 const int ElevationIndexTable[ElevationIndexTableSize] = { |
66 0, 15, 30, 45, 60, 75, 90, 315, 330, 345 | 66 0, 15, 30, 45, 60, 75, 90, 315, 330, 345 |
67 }; | 67 }; |
68 | 68 |
69 // Lazily load a concatenated HRTF database for given subject and store it in a | 69 // Lazily load a concatenated HRTF database for given subject and store it in a |
70 // local hash table to ensure quick efficient future retrievals. | 70 // local hash table to ensure quick efficient future retrievals. |
71 static PassRefPtr<AudioBus> getConcatenatedImpulseResponsesForSubject(const Stri
ng& subjectName) | 71 static PassRefPtr<AudioBus> getConcatenatedImpulseResponsesForSubject(const Stri
ng& subjectName) |
72 { | 72 { |
73 typedef HashMap<String, RefPtr<AudioBus> > AudioBusMap; | 73 typedef HashMap<String, RefPtr<AudioBus>> AudioBusMap; |
74 DEFINE_STATIC_LOCAL(AudioBusMap, audioBusMap, ()); | 74 DEFINE_STATIC_LOCAL(AudioBusMap, audioBusMap, ()); |
75 DEFINE_STATIC_LOCAL(Mutex, mutex, ()); | 75 DEFINE_STATIC_LOCAL(Mutex, mutex, ()); |
76 | 76 |
77 MutexLocker locker(mutex); | 77 MutexLocker locker(mutex); |
78 RefPtr<AudioBus> bus; | 78 RefPtr<AudioBus> bus; |
79 AudioBusMap::iterator iterator = audioBusMap.find(subjectName); | 79 AudioBusMap::iterator iterator = audioBusMap.find(subjectName); |
80 if (iterator == audioBusMap.end()) { | 80 if (iterator == audioBusMap.end()) { |
81 RefPtr<AudioBus> concatenatedImpulseResponses(AudioBus::loadPlatformReso
urce(subjectName.utf8().data(), ResponseSampleRate)); | 81 RefPtr<AudioBus> concatenatedImpulseResponses(AudioBus::loadPlatformReso
urce(subjectName.utf8().data(), ResponseSampleRate)); |
82 ASSERT(concatenatedImpulseResponses); | 82 ASSERT(concatenatedImpulseResponses); |
83 if (!concatenatedImpulseResponses) | 83 if (!concatenatedImpulseResponses) |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); | 324 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); |
325 | 325 |
326 // Linearly interpolate delays. | 326 // Linearly interpolate delays. |
327 frameDelayL = (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay
2L; | 327 frameDelayL = (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay
2L; |
328 frameDelayR = (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay
2R; | 328 frameDelayR = (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay
2R; |
329 } | 329 } |
330 | 330 |
331 } // namespace blink | 331 } // namespace blink |
332 | 332 |
333 #endif // ENABLE(WEB_AUDIO) | 333 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |