Comments (6)
This doesn't look like proper use of the file IO factory. Each given filename needs to return a unique file/istream handle for the named file, rather than one membuf for all files. Your custom istream handle type also needs to implement seeking, or else the decoders will have problems.
from alure.
I think OP's final goal is to have an istream
created from the factory from each ID, which is analogous to file handling. @lain3d: Here is a quite informative article on properly deriving std::streambuf
.
from alure.
@McSinyx I'm now using the std::streambuf for that example + this seekoff:
membuf::pos_type membuf::seekoff(off_type off,
std::ios_base::seekdir dir,
std::ios_base::openmode which = std::ios_base::in) {
if (dir == std::ios_base::cur)
gbump(off);
else if (dir == std::ios_base::end)
setg(eback(), egptr() + off, egptr());
else if (dir == std::ios_base::beg)
setg(eback(), eback() + off, egptr());
return gptr() - eback();
}
Unfortunately when I'm creating the object it looks like the underlying std::basic_streambuf is not updated..? So I'm still having the same problem as before.
from alure.
After I implemented membuf::seekpos it's getting further but for some reason not decoding the frame properly..
But if I instead use the file the audio plays fine.
from alure.
FWIW, this is what I use to create a std::istream
that reads from a memory buffer instead of a file on disk:
https://github.com/kcat/openal-soft/blob/openal-soft-1.20.1/alc/hrtf.cpp#L111...L178
Your factory's openFile
method would just need to create an idstream
using the appropriate start and end data pointers.
from alure.
Hell yeah, got it working thanks to that.. I needed to have
this->setg(const_cast<char_type*>(begin_), const_cast<char_type*>(begin_),
const_cast<char_type*>(end_));
in my constructor (I took it out earlier because the example from the above link did not have setg).. Thanks. :)
from alure.
Related Issues (20)
- Clicks when decoding files (at the end of playback) HOT 6
- Setting the number of channels for a Buffer HOT 2
- Sample offset should be set only after attaching source to buffer? HOT 1
- Capture and real-time support HOT 7
- How to fill buffers with data not from files HOT 14
- Golang port/interface? HOT 6
- feature request: direct modification of spatial locations HOT 4
- Invalid Source ID (getSampleOffsetLatency) HOT 7
- Why did the implementation of alure::AttributePair changed from std::pair to struct? HOT 3
- Why couldn't (or shouldn't) buffers clean themselves? HOT 4
- Please add 3D sound example HOT 5
- I am having troubles with include path for OpenAL headers HOT 4
- Is std::out_of_range suitable for out of range floating points? HOT 2
- How to safely use Context::precacheBuffersAsync? HOT 2
- Alure libraries can't be linked dynamically on Windows HOT 8
- Questions about the project state HOT 2
- Why does Alure have different include files and which files should we use? HOT 2
- set3DSpatialize HOT 10
- kcat.strangesoft.net site is gone HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alure.