-- Interactive Audio Manipulation Processor -- -- file: audio.vhd -- status: not compiled -- -- author: Stephen Tang -- -- A wrapper entity for the audio functionality. Currently, this entity -- only converts the onscreen X and Y coordinates of the sound source to -- a coarser-grained set of coordinates. library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; library work; use work.Constants_Pkg.all; entity audio is port ( clock: in std_logic; screenX: in std_logic_vector(DISPLAY_X-1 downto 0); screenY: in std_logic_vector(DISPLAY_Y-1 downto 0); locationX: out std_logic_vector(SOURCE_WIDTH-1 downto 0); locationY: out std_logic_vector(SOURCE_WIDTH-1 downto 0) ); end audio; architecture wrapper of audio is begin ConvertCoordinates: process(clock) begin if rising_edge(clock) then -- convert X value; see end of file for more info if (screenX >= "0000000000") and (screenX < "0000101010") then locationX <= X"1"; elsif (screenX >= "0000101010") and (screenX < "0001010101") then locationX <= X"2"; elsif (screenX >= "0001010101") and (screenX < "0010000000") then locationX <= X"3"; elsif (screenX >= "0010000000") and (screenX < "0010101010") then locationX <= X"4"; elsif (screenX >= "0010101010") and (screenX < "0011010101") then locationX <= X"5"; elsif (screenX >= "0011010101") and (screenX < "0100000000") then locationX <= X"6"; elsif (screenX > "0011111111") and (screenX < "0100101011") then locationX <= X"7"; elsif (screenX > "0100101010") and (screenX < "0101010101") then locationX <= X"8"; elsif (screenX >= "0101010101") and (screenX < "0110000000") then locationX <= X"9"; elsif (screenX >= "0110000000") and (screenX < "0110101010") then locationX <= X"A"; elsif (screenX >= "0110101010") and (screenX < "0111010101") then locationX <= X"B"; elsif (screenX >= "0111010101") and (screenX < "1000000000") then locationX <= X"C"; elsif (screenX >= "1000000000") and (screenX < "1000101010") then locationX <= X"D"; elsif (screenX >= "1000101010") and (screenX < "1001010101") then locationX <= X"E"; elsif (screenX >= "1001010101") and (screenX < "1010000000") then locationX <= X"F"; end if; -- convert Y value if (screenY >= "0000000000") and (screenY < "0000100000") then locationY <= X"1"; elsif (screenY >= "000010000") and (screenY < "0001000000") then locationY <= X"2"; elsif (screenY >= "0001000000") and (screenY < "0001100000") then locationY <= X"3"; elsif (screenY >= "0001100000") and (screenY < "0010000000") then locationY <= X"4"; elsif (screenY >= "0010000000") and (screenY < "0010100000") then locationY <= X"5"; elsif (screenY >= "0010100000") and (screenY < "0011000000") then locationY <= X"6"; elsif (screenY >= "0011000000") and (screenY < "0011100000") then locationY <= X"7"; elsif (screenY >= "0011100000") and (screenY < "0100000000") then locationY <= X"8"; elsif (screenY >= "0010000000") and (screenY < "0100100000") then locationY <= X"9"; elsif (screenY >= "0100100000") and (screenY < "0101000000") then locationY <= X"A"; elsif (screenY >= "0101000000") and (screenY < "0101100000") then locationY <= X"B"; elsif (screenY >= "0101100000") and (screenY < "0110000000") then locationY <= X"C"; elsif (screenY >= "0110000000") and (screenY < "0110100000") then locationY <= X"D"; elsif (screenY >= "0110100000") and (screenY < "0111000000") then locationY <= X"E"; elsif (screenY >= "0111000000") and (screenY < "0111100000") then locationY <= X"F"; end if; end if; end process ConvertCoordinates; end; -- The ranges of X values make use of the following values, which -- were manually found by taking 640/15*n, where 0