Giter Site home page Giter Site logo

larpon / miniaudio Goto Github PK

View Code? Open in Web Editor NEW
45.0 8.0 6.0 6.82 MB

VVrap of the excellent miniaudio C audio library

License: MIT License

C 92.85% V 7.15% AMPL 0.01%
v vlang audio wrapper c vvrap miniaudio audio-library vlang-library vlang-module

miniaudio's Introduction

miniaudio

V module exposing the excellent miniaudio C audio library.

Current version of miniaudio is v0.11.9 (4d813cf)

Notes

The wrapper is mostly auto generated.

miniaudio's People

Contributors

christopher-kleine avatar kjlaw89 avatar larpon avatar spytheman avatar wertzui123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

miniaudio's Issues

simultaneous recording and playback

Hello.

Could you please tell, if it is possible to record from microphone and play to speakers simultaneously?

if yes, could you give me a hint?

Thanks.

miniaudio module broken, C structs apparently interfere with V's stdlib

Thanks a lot for the module @Larpon!

At some point in the recent past It must have broken.
E.g., I was using it in an app. Now I can't successfully compile it anymore due to an error from miniaudio.

Trying to compile it results in:

/opt/hostedtoolcache/v/0.4.2/x64/vlib/sync/sync_default.c.v:52:8: error: struct `C.pthread_mutex_t` was declared as private to module `miniaudio`, so it can not be used inside module `sync`
   50 | [heap]
   51 | pub struct Mutex {
   52 |     mutex C.pthread_mutex_t
      |           ~~~~~~~~~~~~~~~~~
   53 | }
   54 |
Error: Process completed with exit code 1.

Ref.: https://github.com/ttytm/emoji-mart-desktop/actions/runs/6599637443/job/17928908286

Looks like the C struct clashes with the struct in sync, though I'm not actively importing or using sync in the app.

Build errors when using miniaudio auto generated wrapper

Background

  • Added as submodule on project root
  • imported with import miniaudio
  • Fixed by explicit typing sound_source_channel_count with u32

Build error after import miniaudio

miniaudio/miniaudio.auto.c.v:10405:40: error: overflow in implicit type `int`, use explicit type casting instead
10403 | }
10404 | 
10405 | pub const sound_source_channel_count = 0xFFFFFFFF
      |                                        ~~~~~~~~~~
10406 | 
10407 | [typedef]

Environment

  • V 0.3.2 a60f34e
  • Arch Linux 6.1.1

Really long build time

Hey there,
the wrapper works just fine, but the module adds A LOT (like, 5-10 seconds) to compile time (Windows, tried gcc because tcc didn't work). Do you think this might be resolved in any way or is it just miniaudio being huge?

Does not install, compiler error

% v install v-miniaudio
failed cmd: "/Users/brandon/v/v" -skip-unused "/Users/brandon/v/cmd/tools/vpm.v"
failed code: 1
==================
^~~~~~~
/tmp/v/vpm.13283713496981284215.tmp.c:12884:3: error: implicit declaration of function 'OPENSSL_init_ssl' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, 0);
^
/tmp/v/vpm.13283713496981284215.tmp.c:12884:3: note: did you mean 'OPENSSL_init'?
/opt/local/include/openssl/crypto.h:600:6: note: 'OPENSSL_init' declared here
void OPENSSL_init(void);
^
/tmp/v/vpm.13283713496981284215.tmp.c:12884:20: error: use of undeclared identifier 'OPENSSL_INIT_LOAD_SSL_STRINGS'
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, 0);
^
/tmp/v/vpm.13283713496981284215.tmp.c:12985:4: warning: expression result unused [-Wunused-value]
...
==================
(Use v -cg to print the entire error message)
`builder error:` `==================` `C error. This should never happen.`
This is a compiler bug, please report it using v bug file.v.

miniaudio unfortunately doesn't work anymore on windows

I just came to work with it since the recent fixes. Thank for addressing the issue.

Unfortunately, it is not yet possible to use it on Windows again.

C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c:3037:9: error: unknown type name 'pthread_mutex_t'
 3037 | typedef pthread_mutex_t C__ma_pthread_mutex_t;
      |         ^~~~~~~~~~~~~~~
C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c:3038:9: error: unknown type name 'pthread_cond_t'
 3038 | typedef pthread_cond_t C__ma_pthread_cond_t;
      |         ^~~~~~~~~~~~~~
C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c:3039:9: error: unknown type name 'pthread_mutex_t'
 3039 | typedef pthread_mutex_t C__ma_mutex;
      |         ^~~~~~~~~~~~~~~
C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c: In function 'miniaudio__version_string':
C:\Users\vboxuser\AppData\Local\Temp\v_0\emoji-mart.12795274010299158009.tmp.c:68729:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
...
==================
(Use `v -cg` to print the entire error message)

builder error:
==================
C error. This should never happen.

Segmentation fault on Linux (ParrotOS)

Hey, it's me, XenialDan from Discord.
i tried my example code under linux, and it crashes via segmentation fault

code: https://github.com/thebigsmileXD/v-pong/blob/master/sound.v

warning: miniaudio/miniaudio.v:53:15: `frames_read` declared and not used

Loading wav
[miniaudio] Endian:  LE
[miniaudio] SSE2:    YES
[miniaudio] AVX2:    NO
[miniaudio] AVX512F: NO
[miniaudio] NEON:    NO
[PulseAudio] Playback attr: maxlength=5280, tlength=1760, prebuf=-1, minreq=-1, fragsize=1760; internalBufferSizeInFrames=1320
[PulseAudio] Playback actual attr: maxlength=5280, tlength=1760, prebuf=1324, minreq=440, fragsize=1760; internalBufferSizeInFrames=1320
[PulseAudio]
  Built-in Audio Analog Stereo (Playback)
    Format:      16-bit Signed Integer -> 16-bit Signed Integer
    Channels:    2 -> 2
    Sample Rate: 44100 -> 44100
    Buffer Size: 1320/3 (440)
    Conversion:
      Pre Format Conversion:    NO
      Post Format Conversion:   NO
      Channel Routing:          NO
      SRC:                      NO
      Channel Routing at Start: NO
      Passthrough:              YES
Playing wav 0
Seeking frame 0
Segmentation fault

What is weird is that the length seems to be 0 on linux. On windows it is the actual length.

On windows the program silently exits, which is also a segfault i guess:

C compiler=gcc
warning: miniaudio\miniaudio.v:53:15: `frames_read` declared and not used
Loading wav
Playing wav 1593
Seeking frame 0

X module

Hello
Compiling using the normal miniaudio module works fine, but once add import miniaudio.x, it errors on compile.
Because the error is so big, I have uploaded it onto pastebin instead.
https://pastebin.com/USqTrcP1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.