From f47eb69a354188154731846dde8b384c2c2f39f6 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 28 Jun 2014 18:46:16 -0400 Subject: Rename guile-2d to Sly! Massive find/replace job. --- 2d/audio.scm | 128 ----------------------------------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 2d/audio.scm (limited to '2d/audio.scm') diff --git a/2d/audio.scm b/2d/audio.scm deleted file mode 100644 index 3accb8b..0000000 --- a/2d/audio.scm +++ /dev/null @@ -1,128 +0,0 @@ -;;; guile-2d -;;; Copyright (C) 2013, 2014 David Thompson -;;; -;;; This program is free software: you can redistribute it and/or -;;; modify it under the terms of the GNU General Public License as -;;; published by the Free Software Foundation, either version 3 of the -;;; License, or (at your option) any later version. -;;; -;;; This program is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with this program. If not, see -;;; . - -;;; Commentary: -;; -;; Wrappers over SDL mixer. -;; -;;; Code: - -(define-module (2d audio) - #:use-module (srfi srfi-9) - #:use-module (srfi srfi-2) - #:use-module ((sdl mixer) #:prefix SDL:) - #:export (enable-audio - load-sample - sample? - sample-audio - sample-volume - set-sample-volume - play-sample - load-music - music? - music-audio - music-volume - play-music - set-music-volume - pause-music - resume-music - rewind-music - stop-music - music-paused? - music-playing?)) - -(define (enable-audio) - (SDL:open-audio)) - -;; Used to wrap SDL audio functions whose return values should be -;; ignored. -(define-syntax-rule (ignore-value body ...) - (begin - body ... - *unspecified*)) - -;; Wrapper over SDL audio objects. -(define-record-type - (make-sample audio) - sample? - (audio sample-audio)) - -(define (load-sample filename) - "Load audio sample from FILENAME or return #f if the file cannot be -loaded" - (let ((audio (SDL:load-wave filename))) - (if audio (make-sample audio) #f))) - -(define (sample-volume) - "Return the volume that all samples are played at." - (SDL:volume)) - -(define (set-sample-volume volume) - "Set the volume that all samples are played at to VOLUME." - (ignore-value (SDL:volume volume))) - -(define (play-sample sample) - "Play the given audio SAMPLE." - (ignore-value (SDL:play-channel (sample-audio sample)))) - -;; Wrapper over SDL music objects. -(define-record-type - (make-music audio) - music? - (audio music-audio)) - -(define (load-music filename) - "Load music from FILENAME or return #f if the file cannot be -loaded." - (let ((audio (SDL:load-music filename))) - (if audio (make-music audio) #f))) - -(define (music-volume) - "Return the volume that music is played at." - (SDL:music-volume)) - -(define (set-music-volume volume) - "Set the volume that music is played at to VOLUME." - (ignore-value (SDL:volume volume))) - -(define (play-music music) - "Play the given MUSIC." - (ignore-value (SDL:play-music (music-audio music)))) - -(define (pause-music) - "Pause the current music track." - (ignore-value (SDL:pause-music))) - -(define (resume-music) - "Resume the current music track." - (ignore-value (SDL:resume-music))) - -(define (rewind-music) - "Restart the current music track." - (ignore-value (SDL:rewind-music))) - -(define (stop-music) - "Stop playing the current music track." - (ignore-value (SDL:halt-music))) - -(define (music-playing?) - "Return #t if music is currently playing, otherwise return #f." - (SDL:playing-music?)) - -(define (music-paused?) - "Return #t if music is currently paused, otherwise return #f." - (SDL:paused-music?)) -- cgit v1.2.3