diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-04-23 20:43:59 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-04-23 20:43:59 +0200 |
commit | eafdef4a5e7bb6cbed75b17a38a9b0e30c6e51a6 (patch) | |
tree | 61e74113c3b38df8aff60a764d36a884da1a597a /dgedit/canvastoollisten.cc | |
parent | 75ca97372cdcf9b42ada94bfdd13589d677cba91 (diff) |
Add some sliders to control internal parameters of the editor.
Diffstat (limited to 'dgedit/canvastoollisten.cc')
-rw-r--r-- | dgedit/canvastoollisten.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/dgedit/canvastoollisten.cc b/dgedit/canvastoollisten.cc index 4254137..f638f93 100644 --- a/dgedit/canvastoollisten.cc +++ b/dgedit/canvastoollisten.cc @@ -43,6 +43,8 @@ Player::Player(Canvas *c) sf.byte_format = AO_FMT_NATIVE; dev = ao_open_live(ao_default_driver_id(), &sf, 0); + + volume = 1000; } Player::~Player() @@ -57,7 +59,7 @@ void Player::run() if(playing) { short s[BUFSZ]; for(size_t i = 0; i < BUFSZ; i++) { - if(i + pos < canvas->size) s[i] = canvas->data[pos + i] * ((2<<16) - 1); + if(i + pos < canvas->size) s[i] = canvas->data[pos + i] * volume; else { s[i] = 0; playing = false; @@ -75,6 +77,11 @@ void Player::run() } } +void Player::setVolume(double v) +{ + volume = v; +} + CanvasToolListen::CanvasToolListen(Canvas *c) : player(c) { @@ -128,3 +135,8 @@ void CanvasToolListen::update() canvas->update(r); lastpos = pos; } + +void CanvasToolListen::setVolume(int v) +{ + player.setVolume(v); +} |