Changeset 73174 in webkit


Ignore:
Timestamp:
Dec 2, 2010 11:48:39 AM (13 years ago)
Author:
crogers@google.com
Message:

2010-12-02 Chris Rogers <crogers@google.com>

Reviewed by Kenneth Russell.

AudioContext needs createBuffer() method from ArrayBuffer
https://bugs.webkit.org/show_bug.cgi?id=50343

No new tests since audio API is not yet implemented.

  • webaudio/AudioContext.cpp: (WebCore::AudioContext::createBuffer):
  • webaudio/AudioContext.h:
  • webaudio/AudioContext.idl:
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r73173 r73174  
     12010-12-02  Chris Rogers  <crogers@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        AudioContext needs createBuffer() method from ArrayBuffer
     6        https://bugs.webkit.org/show_bug.cgi?id=50343
     7
     8        No new tests since audio API is not yet implemented.
     9
     10        * webaudio/AudioContext.cpp:
     11        (WebCore::AudioContext::createBuffer):
     12        * webaudio/AudioContext.h:
     13        * webaudio/AudioContext.idl:
     14
    1152010-12-02  Noel Gordon  <noel.gordon@gmail.com>
    216
  • trunk/WebCore/webaudio/AudioContext.cpp

    r72426 r73174  
    2929#include "AudioContext.h"
    3030
     31#include "ArrayBuffer.h"
    3132#include "AudioBuffer.h"
    3233#include "AudioBufferSourceNode.h"
     
    3839#include "AudioNodeOutput.h"
    3940#include "AudioPannerNode.h"
    40 #include "CachedAudio.h"
    4141#include "ConvolverNode.h"
    4242#include "DelayNode.h"
     
    6060
    6161namespace WebCore {
    62 
    63 PassRefPtr<CachedAudio> AudioContext::createAudioRequest(const String &url, bool mixToMono)
    64 {
    65     lazyInitialize();
    66 
    67     // Convert relative URL to absolute
    68     KURL completedURL = document()->completeURL(url);
    69     String completedURLString = completedURL.string();
    70 
    71     RefPtr<CachedAudio> cachedAudio = CachedAudio::create(completedURLString, this, document(), sampleRate(), mixToMono);
    72     CachedAudio* c = cachedAudio.get();
    73 
    74     m_cachedAudioReferences.append(c);
    75 
    76     return cachedAudio;
    77 }
    7862
    7963PassRefPtr<AudioContext> AudioContext::create(Document* document)
     
    202186}
    203187
     188PassRefPtr<AudioBuffer> AudioContext::createBuffer(ArrayBuffer* arrayBuffer, bool mixToMono)
     189{
     190    ASSERT(arrayBuffer);
     191    if (!arrayBuffer)
     192        return 0;
     193   
     194    return AudioBuffer::createFromAudioFileData(arrayBuffer->data(), arrayBuffer->byteLength(), mixToMono, sampleRate());
     195}
     196
    204197PassRefPtr<AudioBufferSourceNode> AudioContext::createBufferSource()
    205198{
  • trunk/WebCore/webaudio/AudioContext.h

    r70604 r73174  
    4141namespace WebCore {
    4242
     43class ArrayBuffer;
    4344class AudioBuffer;
    4445class AudioBufferSourceNode;
     
    4849class AudioPannerNode;
    4950class AudioListener;
    50 class CachedAudio;
    5151class DelayNode;
    5252class Document;
     
    8282
    8383    PassRefPtr<AudioBuffer> createBuffer(unsigned numberOfChannels, size_t numberOfFrames, double sampleRate);
    84 
    85     PassRefPtr<CachedAudio> createAudioRequest(const String &url, bool mixToMono);
     84    PassRefPtr<AudioBuffer> createBuffer(ArrayBuffer* arrayBuffer, bool mixToMono);
    8685
    8786    // Keep track of this buffer so we can release memory after the context is shut down...
     
    222221    Vector<AudioNode*> m_nodesToDelete;
    223222
    224     Vector<RefPtr<CachedAudio> > m_cachedAudioReferences;
    225    
    226223    // Only accessed when the graph lock is held.
    227224    HashSet<AudioNodeInput*> m_dirtyAudioNodeInputs;
  • trunk/WebCore/webaudio/AudioContext.idl

    r69094 r73174  
    4343
    4444        AudioBuffer createBuffer(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate);
     45        AudioBuffer createBuffer(in ArrayBuffer buffer, in boolean mixToMono);
    4546
    4647        // Source
     
    6061        AudioChannelSplitter createChannelSplitter();
    6162        AudioChannelMerger createChannelMerger();
    62 
    63         // FIXME: Temporary - to be replaced with XHR.
    64         CachedAudio createAudioRequest(in DOMString url, in boolean mixToMono);
    6563    };
    6664}
Note: See TracChangeset for help on using the changeset viewer.