Twitch SDK (Internal)
pcmaudiomixer.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
12 
13 namespace ttv
14 {
15  namespace broadcast
16  {
17  class PcmAudioMixer;
18  }
19 }
20 
21 
26 {
27 public:
28  PcmAudioMixer(uint32_t numChannels, uint32_t numSamplesPerChannelPerPacket);
29  virtual ~PcmAudioMixer();
30 
31  // IAudioMixer implementation
32  TTV_ErrorCode SubmitAudioSamples(const int16_t* data, uint64_t startTime, size_t length, float volume);
33  TTV_ErrorCode GetNextPacketTime(uint64_t& nextPacketTime) const;
38  TTV_ErrorCode GetPacket(int16_t* buffer, uint64_t& nextPacketTime);
39 
40 private:
41  typedef std::vector<int32_t> buffer_t;
42 
43  uint32_t mNumChannels;
44  uint32_t mNumSamplesPerChannelPerPacket; // The number of samples that will be returned in a call to GetPacket().
45  buffer_t mMixerBuffer;
46  uint64_t mNextPacketTime;
47 };
uint32_t mNumChannels
Definition: pcmaudiomixer.h:43
TTV_ErrorCode GetNextPacketTime(uint64_t &nextPacketTime) const
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
buffer_t mMixerBuffer
Definition: pcmaudiomixer.h:45
uint64_t mNextPacketTime
Definition: pcmaudiomixer.h:46
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
PcmAudioMixer(uint32_t numChannels, uint32_t numSamplesPerChannelPerPacket)
uint32_t mNumSamplesPerChannelPerPacket
Definition: pcmaudiomixer.h:44
TTV_ErrorCode GetPacket(int16_t *buffer, uint64_t &nextPacketTime)
Definition: pcmaudiomixer.h:25
TTV_ErrorCode SubmitAudioSamples(const int16_t *data, uint64_t startTime, size_t length, float volume)
std::vector< int32_t > buffer_t
Definition: pcmaudiomixer.h:41