Uses 1634K of libraries. Click here for Pure Java version (11137L/60K).
!7 set flag OpusFromStream_debug. set flag OggStreamPage_debug. cm TestOpusFromStream > DynPrintLog { S oggSnippetID = #1400517; transient SimulatedPartialInputStream in; transient OpusFromStream opusReader; transient L<short[]> samples; // We simulate bytes trickling in with these variables switchable int firstChunk = 0; switchable int chunkSize = 512; start-thread { File f = loadLibrary(#1400517); printFileInfo(f); in = new SimulatedPartialInputStream(bufferedFileInputStream(f, OpusFromStream.bufferSizeNeeded())); in.cutOffPoint = firstChunk; samples = new L; temp opusReader = new OpusFromStream(in, 1); int safety = 0; while true { if (safety++ >= 1000) fail("SAFETY"); var samples = opusReader.nextSamples(); if (samples == null && in.streamEnded()) { print("Stream ended: " + in); break; } if (samples == null) in.cutOffPoint += chunkSize; print("samples", samples); addIfNotNull(TestOpusFromStream.this.samples, samples); } print("Iterations: " + safety); File wavFile = programFile("output.wav"); multiShortArraysToWAVE(samples, wavFile, format := javaSound_opusMono()); printFileInfo(wavFile); assertEqualsVerbose(355244L, fileSize(wavFile)); showGraph(); } void showGraph { var pcm = random(samples); if (empty(pcm)) ret; print("Chose PCM: " + l(pcm)); dm_showImageAs("Decoded Audio Sample", shortArrayToGraph(pcm)); } }
Began life as a copy of #1032899
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): bhatertpkbcr, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032909 |
Snippet name: | Test OpusFromStream (pure java Opus decoder for streaming audio, OK!) |
Eternal ID of this version: | #1032909/23 |
Text MD5: | 7e7ebf919e05615850df65dc79dc5935 |
Transpilation MD5: | abcd14772ad6eed134091e16cf83ce0c |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-10 21:57:25 |
Source code size: | 1578 bytes / 54 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 253 / 599 |
Version history: | 22 change(s) |
Referenced in: | [show references] |