Class: AudioPlayback::Playback::StreamData

Inherits:
Object
  • Object
show all
Defined in:
lib/audio-playback/playback/stream_data.rb

Overview

Playback data for the Device::Stream

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(playback) ⇒ StreamData

Returns a new instance of StreamData.

Parameters:



17
18
19
20
# File 'lib/audio-playback/playback/stream_data.rb', line 17

def initialize(playback)
  @playback = playback
  populate
end

Class Method Details

.to_pointer(playback) ⇒ FFI::Pointer

A C pointer version of the audio data

Parameters:

Returns:

  • (FFI::Pointer)


11
12
13
14
# File 'lib/audio-playback/playback/stream_data.rb', line 11

def self.to_pointer(playback)
  stream_data = new(playback)
  stream_data.to_pointer
end

Instance Method Details

#to_pointerFFI::Pointer

A C pointer version of the audio data

Returns:

  • (FFI::Pointer)


24
25
26
27
28
# File 'lib/audio-playback/playback/stream_data.rb', line 24

def to_pointer
  pointer = FFI::LibC.malloc(@playback.data_size)
  pointer.write_array_of_float(@data.flatten)
  pointer
end