diff options
author | Björn Stenberg <bjorn@haxx.se> | 2008-11-10 15:54:43 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2008-11-10 15:54:43 +0000 |
commit | dd226ea7355f7fe4c4c0f8b52a2f776470ed9829 (patch) | |
tree | bf780254bfd27f22b453b9c0f3885eec7b843190 /apps | |
parent | 889b8c96da5ed39d249f7b59c77316f63b7178f7 (diff) |
Removing deprecated code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19068 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/midi2wav.c | 235 |
1 files changed, 0 insertions, 235 deletions
diff --git a/apps/plugins/midi2wav.c b/apps/plugins/midi2wav.c deleted file mode 100644 index cee9d28b20..0000000000 --- a/apps/plugins/midi2wav.c +++ /dev/null @@ -1,235 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2005 Stepan Moskovchenko - * - * 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#define SAMPLE_RATE 22050 -#define MAX_VOICES 100 - - -/* Only define LOCAL_DSP on Simulator or else we're asking for trouble */ -#if defined(SIMULATOR) - /*Enable this to write to the soundcard via a /dsv/dsp symlink in */ - /*#define LOCAL_DSP */ -#endif - - -#if defined(LOCAL_DSP) -/* This is for writing to the DSP directly from the Simulator */ -#include <stdio.h> -#include <stdlib.h> -#include <linux/soundcard.h> -#include <sys/ioctl.h> -#endif - -#include "../../firmware/export/system.h" - -#include "../../plugin.h" - -/*#include "../codecs/lib/xxx2wav.h" */ - -PLUGIN_HEADER - -int numberOfSamples IDATA_ATTR; -long bpm; - -#include "midi/midiutil.c" -#include "midi/guspat.h" -#include "midi/guspat.c" -#include "midi/sequencer.c" -#include "midi/midifile.c" -#include "midi/synth.c" - - -int fd=-1; /* File descriptor where the output is written */ - -extern long tempo; /* The sequencer keeps track of this */ - -const struct plugin_api * rb; - - -enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) -{ - (void)parameter; - rb = api; - - if(parameter == NULL) - { - rb->splash(HZ*2, "Play .MID file"); - return PLUGIN_OK; - } - - rb->splash(HZ, parameter); - if(midimain(parameter) == -1) - { - return PLUGIN_ERROR; - } - rb->splash(HZ*3, "FINISHED PLAYING"); - /* Return PLUGIN_USB_CONNECTED to force a file-tree refresh */ - return PLUGIN_USB_CONNECTED; -} - -signed char outputBuffer[3000] IDATA_ATTR; /* signed char.. gonna run out of iram ... ! */ - - -int currentSample IDATA_ATTR; -int outputBufferPosition IDATA_ATTR; -int outputSampleOne IDATA_ATTR; -int outputSampleTwo IDATA_ATTR; - - -int midimain(void * filename) -{ - - printf("\nHello.\n"); - - rb->splash(HZ/5, "LOADING MIDI"); - - struct MIDIfile * mf = loadFile(filename); - - rb->splash(HZ/5, "LOADING PATCHES"); - if (initSynth(mf, ROCKBOX_DIR "/patchset/patchset.cfg", - ROCKBOX_DIR "/patchset/drums.cfg") == -1) - { - return -1; - } - -/* - * This lets you hear the music through the sound card if you are on Simulator - * Make a symlink, archos/dsp.raw and make it point to /dev/dsp or whatever - * your sound device is. - */ - -#if defined(LOCAL_DSP) - fd=rb->open("/dsp.raw", O_WRONLY); - int arg, status; - int bit, samp, ch; - - arg = 16; /* sample size */ - status = ioctl(fd, SOUND_PCM_WRITE_BITS, &arg); - status = ioctl(fd, SOUND_PCM_READ_BITS, &arg); - bit=arg; - - - arg = 2; /* Number of channels, 1=mono */ - status = ioctl(fd, SOUND_PCM_WRITE_CHANNELS, &arg); - status = ioctl(fd, SOUND_PCM_READ_CHANNELS, &arg); - ch=arg; - - arg = SAMPLE_RATE; /* Yeah. sampling rate */ - status = ioctl(fd, SOUND_PCM_WRITE_RATE, &arg); - status = ioctl(fd, SOUND_PCM_READ_RATE, &arg); - samp=arg; -#else - -/* xxx2wav stuff, removed for now, will move to the real way of outputting sound soon */ -/* - file_info_struct file_info; - file_info.samplerate = SAMPLE_RATE; - file_info.infile = fd; - file_info.channels = 2; - file_info.bitspersample = 16; - local_init("/miditest.tmp", "/miditest.wav", &file_info, rb); - fd = file_info.outfile; -*/ -#endif - - - rb->splash(HZ/5, "I hope this works..."); - - - - - /* - * tick() will do one MIDI clock tick. Then, there's a loop here that - * will generate the right number of samples per MIDI tick. The whole - * MIDI playback is timed in terms of this value.. there are no forced - * delays or anything. It just produces enough samples for each tick, and - * the playback of these samples is what makes the timings right. - * - * This seems to work quite well. - */ - - printf("\nOkay, starting sequencing"); - - - currentSample=0; /* Sample counting variable */ - outputBufferPosition = 0; - - - bpm=mf->div*1000000/tempo; - numberOfSamples=SAMPLE_RATE/bpm; - - - - /* Tick() will return 0 if there are no more events left to play */ - while(tick(mf)) - { - /* - * Tempo recalculation moved to sequencer.c to be done on a tempo event only - * - */ - for(currentSample=0; currentSample<numberOfSamples; currentSample++) - { - - synthSample(&outputSampleOne, &outputSampleTwo); - - - /* - * 16-bit audio because, well, it's better - * But really because ALSA's OSS emulation sounds extremely - * noisy and distorted when in 8-bit mode. I still do not know - * why this happens. - */ - - outputBuffer[outputBufferPosition]=outputSampleOne&0XFF; /* Low byte first */ - outputBufferPosition++; - outputBuffer[outputBufferPosition]=outputSampleOne>>8; /*High byte second */ - outputBufferPosition++; - - outputBuffer[outputBufferPosition]=outputSampleTwo&0XFF; /* Low byte first */ - outputBufferPosition++; - outputBuffer[outputBufferPosition]=outputSampleTwo>>8; /*High byte second */ - outputBufferPosition++; - - - /* - * As soon as we produce 2000 bytes of sound, - * write it to the sound card. Why 2000? I have - * no idea. It's 1 AM and I am dead tired. - */ - if(outputBufferPosition>=2000) - { - rb->write(fd, outputBuffer, 2000); - outputBufferPosition=0; - } - } - } - - printf("\n"); - -#if !defined(LOCAL_DSP) - -/* again, xxx2wav stuff, removed for now */ - - /* close_wav(&file_info); */ -#else - rb->close(fd); -#endif - return 0; -} |