July 20, 2011 Re: DPortAudio | ||||
---|---|---|---|---|
| ||||
I've just added a brand new GUI example! This time it's a wave player that draws the waveforms of the left and right channels of the wave file, and also draws the playback position as a typical sequencer would do. It also allows you to change the playback position, just point and click! Here's a screenshot (poor jpeg to save bandwidth): http://i.imgur.com/Wv5Lx.jpg The drawing routine is a little bit expensive, this is due to drawing a lot of lines with cairo in a single call. I'll have to investigate how to make drawing faster. |
July 20, 2011 Re: DPortAudio | ||||
---|---|---|---|---|
| ||||
Btw, I've noticed something very interesting. I've pushed a 2.2 megabyte DLL in less than 2 seconds to the repo. That's impossible with my limited ~20Kb upload speed. I wonder if github does some kind of caching, if it does it probably did a hash check on my file, got a match, and just copied an existing file from its servers instead of downloading it from me. If that's the case that's pretty freakin cool. |
July 20, 2011 Re: DPortAudio | ||||
---|---|---|---|---|
| ||||
Before you ask, it was a new DLL. I never had it in my repo before, not even in an earlier changeset, or in any of my other repos. |
July 20, 2011 Re: DPortAudio | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | Andrej Mitrovic wrote: >Someone mentioned that Linux doesn't need import libs. But I'm having linker errors when trying to compile a test file on Linux. I've built PortAudio as a shared lib, and installed via make install, and also exported an environment variable: > >LD_LIBRARY_PATH=/usr/local/lib >export LD_LIBRARY_PATH > >I've also tried manually copying the two (I don't know why there's two) shared libraries to the local folder, the libportaudio.so and libportaudio.so.2 files. > >Command was: >andrej@andrej-VirtualBox:~/Desktop/dev/DPortAudio/tests$ dmd pa_devs.d >../portaudio/portaudio.a -I.. > >portaudio.a is the static lib of DPortAudio which has the converted header file that lists all extern(C) function prototypes. > >Errors: >http://codepad.org/AIhYkqiZ > >Any ideas? You have to compile like this: dmd pa_devs.d ../portaudio/portaudio.a -I.. -L-L/usr/local/lib -L-lportaudio The -L-L/usr/local/lib is maybe not necessary, depends on if /usr/local/lib is in your standard link path. If you then run the program and it complains about shared library not found or something like that, you have to run it with LD_LIBRARY_PATH set: LD_LIBRARY_PATH=/usr/local/lib ./pa_devs -- Johannes Pfau |
July 20, 2011 Re: DPortAudio | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | On 7/20/11, Johannes Pfau <spam@example.com> wrote:
> You have to compile like this:
> dmd pa_devs.d ../portaudio/portaudio.a -I.. -L-L/usr/local/lib
> -L-lportaudio
>
> The -L-L/usr/local/lib is maybe not necessary, depends on
> if /usr/local/lib is in your standard link path.
> If you then run the program and it complains about shared library not
> found or something like that, you have to run it with LD_LIBRARY_PATH
> set:
> LD_LIBRARY_PATH=/usr/local/lib ./pa_devs
>
> --
> Johannes Pfau
>
>
Now it's saying it can't find libportaudio.a. The compilation documents say that libportaudio.a should be generated in the portaudio lib/.libs/ folder, but there's not a single .a file generated after running ./configure and make.. only the shared lib, and some .la, .lai, .ver, .exp files.
I'll take this to the portaudio newsgroup.
|
July 20, 2011 Re: DPortAudio | ||||
---|---|---|---|---|
| ||||
I've fixed the performance issue with the wave player example. Instead of constantly redrawing a large amount of data (it would max out my single core), I've employed a caching technique. Basically, the waveform only needs to be redrawn when the window size changes. So I hold two buffers, one for the waveform, the other for the playback indicator. The first one is rarely updated, while for the second one I first do a /blit/ of the cached bitmap from buffer 1 to buffer 2, and then draw the playback indicator over buffer 2. I can't directly draw the indicator over buffer 1 because that would overwrite the cached image. This is all described in the source code btw. Now the CPU usage is a clean 0%, and the GUI is much more responsive! :) |
July 22, 2011 Re: DPortAudio | ||||
---|---|---|---|---|
| ||||
Oh I completely neglected that libsndfile automatically loads any filetype it supports. You can open FLAC's as well as wave's and other filetypes in the waveplayer example. But it loads the file all at once and doesn't use any buffering, so you can't load really big files because the memory allocation will fail. |
Copyright © 1999-2021 by the D Language Foundation