packages feed

HGamer3D-API-0.1.6: HGamer3D/APIs/Two/Audio.hs

-- This source file is part of HGamer3D
-- (A project to enable 3D game development in Haskell)
-- For the latest info, see http://www.althainz.de/HGamer3D.html
--
-- (c) 2011 Peter Althainz
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
--     http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.

-- InputSystem.hs

-- |This module is one sub module of the second attempt, to provide an 
-- abstracted interface to the HGamer3D API Bindings. It is named 'Two',
-- submodule Audio and handles Music and Sound.

module HGamer3D.APIs.Two.Audio

(
	-- Enums
	--
	module HGamer3D.Bindings.SFML.EnumSoundSourceStatus,
	
	
	-- Low Level Interface
	--
	
	-- Listener Functions
	setAudioVolume,
	getAudioVolume,
	setAudioPosition,
	setAudioDirection,

	-- Music Functions
	newMusic,
	deleteMusic,
	openMusicFromFile,
	
	-- Sound Functions
	newSound,
	deleteSound,
	setSoundBuffer,

	playSound,
	pauseSound,
	stopSound,

	setSoundLoop,
	getSoundLoop,
	resetSoundBuffer,
	
	-- SoundBuffer Functions
	newBuffer, 
	deleteBuffer, 
	loadBufferFromFile, 

	-- SoundSource Functions
	setSourcePitch,
	setSourceVolume,
	setSourcePosition,
	setSourceAttenuation,

	getSourcePitch,
	getSourceVolume,
	getSourceMinDistance,
	getSourceAttenuation,

	attachSourceToListener,
	isSourceAttachedToListener,

	-- SoundStream Functions
	playStream,
	pauseStream,
	stopStream,

	setStreamLoop,
	getStreamLoop,

	
)

where

import GHC.Ptr

import HGamer3D.Bindings.SFML.ClassPtr
import HGamer3D.Bindings.SFML.Utils

import qualified HGamer3D.Bindings.SFML.ClassListener as Listener
import qualified HGamer3D.Bindings.SFML.ClassMusic as Music 
import qualified HGamer3D.Bindings.SFML.ClassSound as Sound
import qualified HGamer3D.Bindings.SFML.ClassSoundBuffer as SoundBuffer
import qualified HGamer3D.Bindings.SFML.ClassSoundSource as SoundSource
import qualified HGamer3D.Bindings.SFML.ClassSoundStream as SoundStream
import HGamer3D.Bindings.SFML.EnumSoundSourceStatus


-- Low Level Interface
--

-- Listener Functions

setAudioVolume = Listener.setGlobalVolume
getAudioVolume = Listener.getGlobalVolume
setAudioPosition = Listener.setPosition
setAudioDirection = Listener.setDirection


-- Music Functions
--

newMusic = Music.new
deleteMusic = Music.delete
openMusicFromFile = Music.openFromFile

-- Sound Functions
--

newSound = Sound.new
deleteSound = Sound.delete

playSound = Sound.play
pauseSound = Sound.pause
stopSound = Sound.stop

setSoundBuffer = Sound.setBuffer
setSoundLoop = Sound.setLoop
getSoundLoop = Sound.getLoop
resetSoundBuffer = Sound.resetBuffer

-- Sound Buffer Functions
--

newBuffer = SoundBuffer.new
deleteBuffer = SoundBuffer.delete
loadBufferFromFile = SoundBuffer.loadFromFile

-- Sound Source Functions
--

setSourcePitch = SoundSource.setPitch
setSourceVolume = SoundSource.setVolume
setSourcePosition = SoundSource.setPosition
setSourceAttenuation = SoundSource.setAttenuation

getSourcePitch = SoundSource.getPitch
getSourceVolume = SoundSource.getVolume
getSourceMinDistance = SoundSource.getMinDistance
getSourceAttenuation = SoundSource.getAttenuation

attachSourceToListener = SoundSource.setRelativeToListener
isSourceAttachedToListener = SoundSource.isRelativeToListener


-- Sound Stream Functions
--

playStream = SoundStream.play
pauseStream = SoundStream.pause
stopStream = SoundStream.stop

setStreamLoop = SoundStream.setLoop
getStreamLoop = SoundStream.getLoop