diff options
| author | Teddy Wing | 2014-11-09 00:28:05 -0500 | 
|---|---|---|
| committer | Teddy Wing | 2014-11-09 00:31:44 -0500 | 
| commit | 5768e2443de12bceee94e007a7e4997b06bf9ef9 (patch) | |
| tree | 4664895288f1901e50a708c91d01397fd0caf072 | |
| parent | 0e87a822c1e60b22726188e8c8948ea6ea640c58 (diff) | |
| download | auditory.vim-5768e2443de12bceee94e007a7e4997b06bf9ef9.tar.bz2 | |
plugin/auditory.vim: Ensure PlayScale() doesn't play the last note
The random note chosen should not be the same as the last note played in
insert mode.
| -rw-r--r-- | plugin/auditory.vim | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/plugin/auditory.vim b/plugin/auditory.vim index 5d694af..f8b1bac 100644 --- a/plugin/auditory.vim +++ b/plugin/auditory.vim @@ -27,6 +27,8 @@ function! s:PlayInsertLeave()  endfunction  function! s:PlayScale() +	let play_scale_previous_note = -1 +	let note = -1  	let scale = [  		\ '1_C#.wav',  		\ '2_D#.wav', @@ -37,7 +39,11 @@ function! s:PlayScale()  		\ '7_B#.wav'  	\ ] -	let note = system("echo $RANDOM % " . len(scale) . " | bc") +	while play_scale_previous_note ==# note +		let note = system("echo $RANDOM % " . len(scale) . " | bc") +	endwhile +	 +	let play_scale_previous_note = note  	call auditory#Play('./Resources/Scale_C#/' . scale[note])  endfunction | 
