Class: SFML::SoundBufferRecorder
- Inherits:
-
Object
- Object
- SFML::SoundBufferRecorder
- Defined in:
- ext/audio/sound_buffer_recorder.c,
ext/audio/sound_buffer_recorder.c
Overview
Records audio from a capture device directly into a SoundBuffer. For custom processing of captured samples as they arrive, subclass SoundRecorder instead.
Instance Method Summary collapse
-
#buffer ⇒ SoundBuffer
Returns the buffer holding the audio recorded so far.
-
#channel_count ⇒ Integer
Returns the number of capture channels.
-
#channel_count=(value) ⇒ Integer
Must be called while not recording.
-
#device ⇒ String
Returns the name of the capture device in use.
-
#device=(value) ⇒ Boolean
Must be called while not recording.
-
#new ⇒ SoundBufferRecorder
constructor
Creates a recorder that captures into a SoundBuffer.
-
#sample_rate ⇒ Integer
Returns the sample rate used for capture.
-
#start(sample_rate) ⇒ Boolean
Starts capturing audio at the given sample rate.
-
#stop ⇒ self
Stops capturing audio.
Constructor Details
#new ⇒ SoundBufferRecorder
Creates a recorder that captures into a SoundBuffer.
56 57 58 |
# File 'ext/audio/sound_buffer_recorder.c', line 56 static VALUE SoundBufferRecorder_initialize(VALUE self) { return self; } |
Instance Method Details
#buffer ⇒ SoundBuffer
Returns the buffer holding the audio recorded so far.
99 100 101 102 |
# File 'ext/audio/sound_buffer_recorder.c', line 99 static VALUE SoundBufferRecorder_buffer(VALUE self) { return sound_buffer_from_borrowed( sfSoundBufferRecorder_getBuffer(Get_SoundBufferRecorder_Struct(self))); } |
#channel_count ⇒ Integer
Returns the number of capture channels.
133 134 135 |
# File 'ext/audio/sound_buffer_recorder.c', line 133 static VALUE SoundBufferRecorder_channel_count(VALUE self) { return UINT2NUM(sfSoundBufferRecorder_getChannelCount(Get_SoundBufferRecorder_Struct(self))); } |
#channel_count=(value) ⇒ Integer
Must be called while not recording.
144 145 146 147 148 |
# File 'ext/audio/sound_buffer_recorder.c', line 144
static VALUE SoundBufferRecorder_set_channel_count(VALUE self, VALUE rb_count) {
sfSoundBufferRecorder_setChannelCount(Get_SoundBufferRecorder_Struct(self),
(unsigned int)NUM2INT(rb_count));
return rb_count;
}
|
#device ⇒ String
Returns the name of the capture device in use.
110 111 112 |
# File 'ext/audio/sound_buffer_recorder.c', line 110 static VALUE SoundBufferRecorder_device(VALUE self) { return rb_str_new_cstr(sfSoundBufferRecorder_getDevice(Get_SoundBufferRecorder_Struct(self))); } |
#device=(value) ⇒ Boolean
Must be called while not recording. Get available names from SoundRecorder.available_devices.
122 123 124 125 |
# File 'ext/audio/sound_buffer_recorder.c', line 122
static VALUE SoundBufferRecorder_set_device(VALUE self, VALUE rb_name) {
return BOOL2RB(sfSoundBufferRecorder_setDevice(Get_SoundBufferRecorder_Struct(self),
StringValueCStr(rb_name)));
}
|
#sample_rate ⇒ Integer
Returns the sample rate used for capture.
89 90 91 |
# File 'ext/audio/sound_buffer_recorder.c', line 89 static VALUE SoundBufferRecorder_sample_rate(VALUE self) { return UINT2NUM(sfSoundBufferRecorder_getSampleRate(Get_SoundBufferRecorder_Struct(self))); } |
#start(sample_rate) ⇒ Boolean
Starts capturing audio at the given sample rate.
67 68 69 70 |
# File 'ext/audio/sound_buffer_recorder.c', line 67
static VALUE SoundBufferRecorder_start(VALUE self, VALUE rb_sample_rate) {
return BOOL2RB(sfSoundBufferRecorder_start(Get_SoundBufferRecorder_Struct(self),
(unsigned int)NUM2INT(rb_sample_rate)));
}
|
#stop ⇒ self
Stops capturing audio.
78 79 80 81 |
# File 'ext/audio/sound_buffer_recorder.c', line 78 static VALUE SoundBufferRecorder_stop(VALUE self) { sfSoundBufferRecorder_stop(Get_SoundBufferRecorder_Struct(self)); return self; } |