Lines Matching refs:frames

16                                 int frames,
21 const float v = start_offset + start + ch * bus->frames() * increment;
22 for (int i = offset; i < offset + frames; ++i) {
29 static void VerifyBus(AudioBus* bus, int frames, float start, float increment) {
30 VerifyBusWithOffset(bus, 0, frames, start, 0, increment);
36 const int frames = kSampleRate / 10;
45 frames,
47 EXPECT_EQ(frames, buffer->frame_count());
51 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
53 // Verify all frames before trimming.
54 buffer->ReadFrames(frames, 0, 0, bus.get());
55 VerifyBus(bus.get(), frames, 0, 1);
57 // Trim 10ms of frames from the middle of the buffer.
58 int trim_start = frames / 2;
62 EXPECT_EQ(frames - trim_length, buffer->frame_count());
75 // Trim 10ms of frames from the start, which just adjusts the buffer's
79 EXPECT_EQ(frames - 2 * trim_length, buffer->frame_count());
92 // Trim 10ms of frames from the end, which just adjusts the buffer's frame
95 EXPECT_EQ(frames - 3 * trim_length, buffer->frame_count());
110 EXPECT_EQ(frames - 4 * trim_length, buffer->frame_count());
125 EXPECT_EQ(frames - 5 * trim_length, buffer->frame_count());
141 EXPECT_EQ(frames - 6 * trim_length, buffer->frame_count());
218 const int frames = 10;
226 frames,
228 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
229 buffer->ReadFrames(frames, 0, 0, bus.get());
230 VerifyBus(bus.get(), frames, 0, 1.0f / 127.0f);
234 for (int i = 0; i < frames; ++i)
236 VerifyBus(bus.get(), frames, 0, 1.0f / 127.0f);
242 const int frames = 10;
250 frames,
252 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
253 buffer->ReadFrames(frames, 0, 0, bus.get());
254 VerifyBus(bus.get(), frames, 1.0f / kint16max, 1.0f / kint16max);
258 for (int i = 0; i < frames; ++i)
260 VerifyBus(bus.get(), frames, 1.0f / kint16max, 1.0f / kint16max);
266 const int frames = 20;
274 frames,
276 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
277 buffer->ReadFrames(frames, 0, 0, bus.get());
278 VerifyBus(bus.get(), frames, 1.0f / kint32max, 1.0f / kint32max);
280 // Read second 10 frames.
289 const int frames = 20;
297 frames,
299 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
303 // Read second 10 frames.
312 const int frames = 20;
321 frames,
323 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
327 // Read all the frames backwards, one by one. ch[0] should be 20, 19, ...
329 for (int i = frames - 1; i >= 0; --i)
331 VerifyBus(bus.get(), frames, 1.0f / kint16max, 1.0f / kint16max);
333 // Read 0 frames with different offsets. Existing data in AudioBus should be
336 VerifyBus(bus.get(), frames, 1.0f / kint16max, 1.0f / kint16max);
338 VerifyBus(bus.get(), frames, 1.0f / kint16max, 1.0f / kint16max);
340 VerifyBus(bus.get(), frames, 1.0f / kint16max, 1.0f / kint16max);
346 const int frames = 100;
355 frames,
358 // Read all 100 frames from the buffer. F32 is planar, so ch[0] should be 1,
362 buffer->ReadFrames(frames, 0, 0, bus.get());
363 VerifyBus(bus.get(), frames, 1, 1);
365 // Now read 20 frames from the middle of the buffer.
374 const int frames = kSampleRate / 100;
377 channel_layout, channels, kSampleRate, frames, start_time);
378 EXPECT_EQ(frames, buffer->frame_count());
383 // Read all 100 frames from the buffer. All data should be 0.
384 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
385 buffer->ReadFrames(frames, 0, 0, bus.get());
386 VerifyBus(bus.get(), frames, 0, 0);
392 const int frames = kSampleRate / 10;
402 frames,
404 EXPECT_EQ(frames, buffer->frame_count());
411 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
415 // Trim off 10ms of frames from the start.
418 EXPECT_EQ(frames - ten_ms_of_frames, buffer->frame_count());
423 // Trim off 10ms of frames from the end.
426 EXPECT_EQ(frames - 2 * ten_ms_of_frames, buffer->frame_count());
434 EXPECT_EQ(frames - 6 * ten_ms_of_frames, buffer->frame_count());