MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / getBytesPerSample

Function getBytesPerSample

src/audio_data.ts:350–365  ·  view source on GitHub ↗
(format: AudioSampleFormat)

Source from the content-addressed store, hash-verified

348}
349
350const getBytesPerSample = (format: AudioSampleFormat): number => {
351 switch (format) {
352 case 'u8':
353 case 'u8-planar':
354 return 1;
355 case 's16':
356 case 's16-planar':
357 return 2;
358 case 's32':
359 case 's32-planar':
360 return 4;
361 case 'f32':
362 case 'f32-planar':
363 return 4;
364 }
365};
366
367const formatIsPlanar = (format: AudioSampleFormat): boolean => {
368 switch (format) {

Callers 3

constructorMethod · 0.85
allocationSizeMethod · 0.85
copyToMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected