Newer
Older
Import / applications / HighwayDash / ports / Platform / Qt / AudioRenderer.h
@John John on 29 Dec 2020 940 bytes bulk import from macbookpro checkouts
//
//  AudioRenderer.h
//  HighwayDash
//
//  Created by John Ryland on 18/02/2016.
//  Copyright © 2016 John Ryland. All rights reserved.
//

#ifndef AUDIO_RENDERER_H
#define AUDIO_RENDERER_H


#include <memory>
#include <QObject>


enum SampleRate
{
    SampleRate_8000Hz  = 8000,
    SampleRate_22050Hz = 22050,
    SampleRate_44100Hz = 44100,
};

enum BitsPerChannel
{
    Bits_8   = 8,
    Bits_16  = 16
};

enum Channels
{
    Mono     = 1,
    Stereo   = 2
};


class AudioRenderer : public QObject
{
    Q_OBJECT
public:
    AudioRenderer();
    virtual ~AudioRenderer();
    
    void initialize(SampleRate a_rate, BitsPerChannel a_bitsPerChannel, Channels a_channels);
    void start();
    void stop();
    
    virtual void renderSamples(void* a_outputBuffer, size_t a_frameCount) = 0;

public slots:
    void writeMoreData();
    
private:
    struct Pimpl;
    std::unique_ptr<Pimpl> m_pimpl;
};


#endif // AUDIO_RENDERER_H