diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-07-07 20:04:22 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-07-07 20:04:22 +0200 |
commit | 4deca01c3a7edaf66374bd35e6fb50d4d9564b17 (patch) | |
tree | 77d39924751f032747fbfec6acbd9f0df3c08916 | |
parent | 0358e19702ca5a39b5609b7af126111a846df235 (diff) |
deleted some legacy files
-rw-r--r-- | cmod.c | 154 | ||||
-rw-r--r-- | cmod.h | 23 | ||||
-rw-r--r-- | cwav.c | 97 | ||||
-rw-r--r-- | cwav.h | 24 | ||||
-rw-r--r-- | psdl.c | 132 | ||||
-rw-r--r-- | psdl.h | 48 |
6 files changed, 0 insertions, 478 deletions
diff --git a/cmod.c b/cmod.c deleted file mode 100644 index 82296d0f..00000000 --- a/cmod.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net> - - 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 2 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 <http://www.gnu.org/licenses/>. -*/ -#include <mikmod.h> -#include <string.h> -#include "codec.h" -#include "cmod.h" - -static char *mikmod_writepointer; -static int mikmod_writesize; -static MODULE *module; - -// mikmod fe driver -static BOOL cmod_IsThere(void) -{ - return 1; -} - -static BOOL cmod_Init(void) -{ - return VC_Init(); -} - -static void cmod_Exit(void) -{ - VC_Exit(); -} - -static void cmod_Update(void) -{ - for (;;) { - ULONG ret = VC_WriteBytes((SBYTE*)mikmod_writepointer,(ULONG)mikmod_writesize); - if (ret < mikmod_writesize) - { - if (ret <= 0) { - printf ("WARNING: mikmod VC_WriteBytes returned %d, trying rewind\n", ret); - Player_SetPosition (0); - break; - } - else { - mikmod_writesize -= ret; - mikmod_writepointer += ret; - } - } - else if (ret > mikmod_writesize) { - printf ("WARNING: mikmod VC_WriteBytes returned %d, trying rewind\n", ret); - Player_SetPosition (0); - } - break; - } -} - -static void cmod_PlayStop(void) -{ - fprintf (stderr, "mikmod called PlayStop\n"); - VC_PlayStop(); -} - -static MDRIVER cmoddrv={ - NULL, - (char*)"raboof", - (char*)"raboof mikmod audio driver v0.1", - 0,255, - (char*)"cmoddrv", - - NULL, - cmod_IsThere, - VC_SampleLoad, - VC_SampleUnload, - VC_SampleSpace, - VC_SampleLength, - cmod_Init, - cmod_Exit, - NULL, - VC_SetNumVoices, - VC_PlayStart, - cmod_PlayStop, - cmod_Update, - NULL, - VC_VoiceSetVolume, - VC_VoiceGetVolume, - VC_VoiceSetFrequency, - VC_VoiceGetFrequency, - VC_VoiceSetPanning, - VC_VoiceGetPanning, - VC_VoicePlay, - VC_VoiceStop, - VC_VoiceStopped, - VC_VoiceGetPosition, - VC_VoiceRealVolume -}; - -int -cmod_init (const char *fname, int track, float start, float end) { -// MikMod_RegisterAllDrivers(); - memset (&cmod.info, 0, sizeof (fileinfo_t)); - MikMod_RegisterAllLoaders(); - MikMod_RegisterDriver (&cmoddrv); - int drv = MikMod_DriverFromAlias ((char*)"cmoddrv"); - md_device = drv; - md_mode |= DMODE_HQMIXER; - MikMod_Init((char*)""); - module = Player_Load ((char*)fname, 64, 0); - module->wrap = 1; - module->loop = 0; - Player_Start(module); - Player_SetTempo (1200); - printf ("module info: songname %s\nmodtype %s\ncomment %s\nnumchannels %d\nnumsamples %d\nsongtime %d\n", module->songname, module->modtype, module->comment, module->numchn, module->numsmp, module->sngtime); - printf ("driver info: device %d\nmixfreq: %d\n16bit %d\nhqmixer %d\nstereo %d\n", md_device, md_mixfreq, (md_mode&DMODE_16BITS)?1:0, (md_mode&DMODE_HQMIXER)?1:0, (md_mode&DMODE_STEREO)?1:0); - cmod.info.bitsPerSample = (md_mode&DMODE_16BITS)? 16 : 8; - cmod.info.channels = (md_mode&DMODE_STEREO)?2:1; - cmod.info.samplesPerSecond = md_mixfreq; - return 0; -} - -void -cmod_free (void) { - Player_SetPosition (0); - Player_Free(module); - module = NULL; - MikMod_Exit(); -} - -int -cmod_read (char *bytes, int size) -{ - mikmod_writepointer = bytes; - mikmod_writesize = size; - if (Player_Active()) { - MikMod_Update(); - } - return 0; -} - -codec_t cmod = { - .init = cmod_init, - .free = cmod_free, - .read = cmod_read -}; - diff --git a/cmod.h b/cmod.h deleted file mode 100644 index 16a219b8..00000000 --- a/cmod.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net> - - 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 2 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 <http://www.gnu.org/licenses/>. -*/ -#ifndef __CMOD_H -#define __CMOD_H - -extern codec_t cmod; - -#endif // __CMOD_H diff --git a/cwav.c b/cwav.c deleted file mode 100644 index 7c1d9505..00000000 --- a/cwav.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net> - - 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 2 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 <http://www.gnu.org/licenses/>. -*/ -#include <string.h> -#include <stdio.h> -#include "codec.h" -#include "cwav.h" - -typedef struct { - uint32_t riffMagic; - uint32_t size; - uint32_t waveMagic; - uint32_t fmtMagic; - uint32_t chunkSize; - uint16_t formatTag; - uint16_t channels; - uint32_t samplesPerSecond; - uint32_t bytesPerSecond; - uint16_t blockAlignment; - uint16_t bitsPerSample; - uint32_t dataMagic; - uint32_t dataSize; -} wavHeader_t; - -static FILE *file; - -int cwav_init (const char *fname, int track, float start, float end) { - - file = fopen (fname, "rb"); - if (!file) { - return -1; - } - - wavHeader_t header; - - // read WAV header - if (fread (&header, sizeof (header), 1, file) != 1) - { - printf ("WARNING: WAV header not found in %s\n", fname); - fclose (file); - file = NULL; - return -1; - } - cwav.info.bitsPerSample = header.bitsPerSample; - cwav.info.channels = header.channels; - //cwav.info.dataSize = header.dataSize; - cwav.info.samplesPerSecond = header.samplesPerSecond; - - return 0; -} - -void -cwav_free (void) -{ - if (file) - { - fclose (file); - file = NULL; - } -} - -int -cwav_read (char *bytes, int size) { - int bytesread = 0; - int first = 1; - for (;;) { - int bytesread = fread (bytes, 1, size, file); - if (bytesread == size) { - break; - } - size -= bytesread; - bytes += bytesread; - fseek (file, sizeof (wavHeader_t), SEEK_SET); - } - return 0; -} - -codec_t cwav = { - .init = cwav_init, - .free = cwav_free, - .read = cwav_read -}; - diff --git a/cwav.h b/cwav.h deleted file mode 100644 index b219ddbd..00000000 --- a/cwav.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net> - - 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 2 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 <http://www.gnu.org/licenses/>. -*/ -#ifndef __CWAV_H -#define __CWAV_H - -extern codec_t cwav; - -#endif // __CWAV_H - diff --git a/psdl.c b/psdl.c deleted file mode 100644 index b8fcc279..00000000 --- a/psdl.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net> - - 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 2 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 <http://www.gnu.org/licenses/>. -*/ -#include <SDL/SDL.h> -#include "psdl.h" -#include "streamer.h" -#include "common.h" - -static int sdl_player_numsamples = 4096; -static int sdl_player_freq; -static SDL_AudioSpec spec; -static void psdl_callback (void *userdata, Uint8 *stream, int len); -static float sdl_volume = 1; - -static inline void -le_int16 (int16_t in, char *out) { - char *pin = (char *)∈ -#if !BIGENDIAN - out[0] = pin[0]; - out[1] = pin[1]; -#else - out[1] = pin[0]; - out[0] = pin[1]; -#endif -} - -int -psdl_init (void) { - SDL_AudioSpec obt; - int formats[] = { AUDIO_S16, -1 }; - int freqs[] = { 48000, 44100, 96000, 22050, -1 }; - const char *fmtnames[] = { "16 bit signed integer" }; - int fmt, frq; - int success = 0; - fprintf (stderr, "sdl_player_init\n"); - for (fmt = 0; formats[fmt] != -1; fmt++) { - for (frq = 0; freqs[frq] != -1; frq++) { - fprintf(stderr, "SDL: trying %s @ %dHz\n", fmtnames[fmt], freqs[frq]); - spec.freq = freqs[frq]; - spec.format = formats[fmt]; - spec.channels = 2; - spec.samples = sdl_player_numsamples; - spec.callback = psdl_callback; - if (SDL_OpenAudio(&spec, &obt) < 0) { - fprintf(stderr, "SDL: couldn't open audio: %s\n", SDL_GetError()); - } - else { - success = 1; - break; - } - } - } - if (!success) { - return -1; - } - sdl_player_numsamples = obt.samples; //numsamples; - sdl_player_freq = obt.freq; - fprintf (stderr, "SDL: got %d frame size (requested %d), %dHz\n", obt.samples, sdl_player_numsamples, sdl_player_freq); - - return 0; -} - -void -psdl_free (void) { - SDL_CloseAudio (); -} - -int -psdl_play (void) { - SDL_PauseAudio (0); - return 0; -} - -int -psdl_stop (void) { - SDL_PauseAudio (1); -} - -int -psdl_ispaused (void) { - return (SDL_GetAudioStatus () == SDL_AUDIO_PAUSED); -} - -int -psdl_pause (void) { - SDL_PauseAudio (1); - return 0; -} - -int -psdl_unpause (void) { - SDL_PauseAudio (0); - return 0; -} - -void -psdl_set_volume (float vol) { - sdl_volume = vol; -} - -int -psdl_get_rate (void) { - return sdl_player_freq; -} - -static void -psdl_callback (void* userdata, Uint8 *stream, int len) { - int bytesread = streamer_read (stream, len); - int ivolume = sdl_volume * 1000; - for (int i = 0; i < bytesread/2; i++) { - int16_t sample = (int16_t)(((int32_t)(((int16_t*)stream)[i])) * ivolume / 1000); - le_int16 (sample, (char*)&(((int16_t*)stream)[i])); - } - if (bytesread < len) { - memset (stream + bytesread, 0, len-bytesread); - } -} - diff --git a/psdl.h b/psdl.h deleted file mode 100644 index f52da31b..00000000 --- a/psdl.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net> - - 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 2 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 <http://www.gnu.org/licenses/>. -*/ -#ifndef __PSDL_H -#define __PSDL_H - -int -psdl_init (void); - -void -psdl_free (void); - -int -psdl_play (void); - -int -psdl_stop (void); - -int -psdl_ispaused (void); - -int -psdl_pause (void); - -int -psdl_unpause (void); - -void -psdl_set_volume (float vol); - -int -psdl_get_rate (void); - -#endif // __PSDL_H |