Comments (11)
Thanks, I'll look into it!
from nico.
Hi, looks like it works, however volume is between 0 and 255.
Here's your example code updated to allow you to adjust the volume with left and right buttons, you should be able to hear the volume change as you adjust the volume.
import nico
proc init() =
music(0,2,0)
musicVol(255)
masterVol(255)
proc update(dt : Pfloat) =
if btnpr(pcLeft):
# adjust volume down
var vol = musicVol()
vol -= 10
musicVol(vol)
if btnpr(pcRight):
# adjust volume up
var vol = musicVol()
vol += 10
musicVol(vol)
proc draw() =
cls()
setColor(7)
# draw music volume
rectfill(1,1,(screenWidth-1).float32 * musicVol().float32 / 255.0f,4)
nico.init("BeefGame","Random Game")
nico.createWindow("nico",128,128,4,false)
loadMusic(0,"music.ogg")
nico.run(init,update,draw)
from nico.
That example doesnt run properly either. Volume is at a constant 100%. I tried both system libraries, building sdl2 from source, and also using the Steam Runtime libraries. All have the same volume at 100% unless musicVol is 0, which then it mutes. Video of what happens(Very loud so rip ears)
from nico.
@beef331 can you confirm which version of nim and nico you're using when this doesn't work?
the above example is working correctly for me with nim 1.2.0 and nico 0.2.1.
from nico.
Those versions match the ones I'm running. Worth noting my entire system audio gets distorted when launching nico. The issue is not present with your game Moving In.
from nico.
@beef331 Very strange, which platform are you running this on? I've been testing on Windows 10.
Moving In is made with a very old version of Nico, so it's not directly comparable.
from nico.
I've had this issue on Ubuntu and Regolith Linux 64bit.
from nico.
@beef331 ok, i'll do some testing on linux soon, thanks.
from nico.
I'm also having audio issues, audio is completely distorted and very loud on the platformer and paint examples.
Ubuntu 18.04
Using sdl2 from the apt repos and sdl2 built from scratch
using libsndfile from apt repos and libsndfile built from scratch
Compiling and running a demo program included with the libsndfile source code does not have the same issue
from nico.
this should be fixed now! I was using the wrong sample format when opening the audio device. I dont know why it worked on windows.
from nico.
Latest update fixed the audio for me π
from nico.
Related Issues (20)
- `task deps, "Downloads dependencies"` does not work with new nim
- 24x24 sprite sheet only draws some sprites HOT 5
- How to draw text "δΈζ cn zh font" (Hei.ttf:43KB) in nico HOT 5
- Nico uses one core to the max? HOT 2
- How to run compiled WASM example? HOT 2
- Official Nico logo? HOT 2
- Error compiling 'webrtc' example HOT 1
- Single file build
- loadSurfaceFromPNG not support all png modes HOT 1
- On macOS m1: could not load: libSDL2.dylib HOT 1
- Current font png format calculation limitations
- NICO Font Tool - Converting fonts to NICO format
- `nico.nim(2227, 19) Error: type mismatch: got '(int, int, int32, int32)' for '(int(x), int(y), src.w * scale, src.h * scale)' but expected 'Rect = tuple[x: int, y: int, w: int, h: int]'` HOT 7
- how resolve error could not load: libSDL2.dylib on osx with m1 cpu? HOT 3
- does it have any api to communicate with js HOT 1
- LCT_RGB .png files never loaded. HOT 1
- `assets` folder is missing from `examples` folder HOT 1
- Illegal storage access (Mac osx Version 12.3.1) HOT 3
- Add gui api
- Uncaught (in promise) TypeError: eventHandler.target is null HOT 4
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 nico.