summaryrefslogtreecommitdiff
path: root/apps/plugins/midi2wav.c
diff options
context:
space:
mode:
authorStepan Moskovchenko <stevenm@rockbox.org>2005-04-16 03:35:20 +0000
committerStepan Moskovchenko <stevenm@rockbox.org>2005-04-16 03:35:20 +0000
commit4b773c0c4c1f6c8c003038161fa44292b501e55a (patch)
tree8bb3852df206f2edfdd68ccf79e50fc56798dd25 /apps/plugins/midi2wav.c
parentcdd35ba22062301a7c94ef0968a8b7ea842eca5f (diff)
downloadrockbox-4b773c0c4c1f6c8c003038161fa44292b501e55a.tar.gz
rockbox-4b773c0c4c1f6c8c003038161fa44292b501e55a.zip
Added xxx2wav support, an icon, and some optimizations
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6306 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/midi2wav.c')
-rw-r--r--apps/plugins/midi2wav.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/apps/plugins/midi2wav.c b/apps/plugins/midi2wav.c
index 0b1659b1dd..3cf2866a12 100644
--- a/apps/plugins/midi2wav.c
+++ b/apps/plugins/midi2wav.c
@@ -19,15 +19,21 @@
19#define SAMPLE_RATE 48000 19#define SAMPLE_RATE 48000
20#define MAX_VOICES 100 20#define MAX_VOICES 100
21 21
22/* 22
23//Only define LOCAL_DSP on Simulator or else we're asking for trouble
23#if defined(SIMULATOR) 24#if defined(SIMULATOR)
25 //Enable this to write to the soundcard via a /dsv/dsp symlink in /
26// #define LOCAL_DSP
27#endif
28
29
30#if defined(LOCAL_DSP)
24// This is for writing to the DSP directly from the Simulator 31// This is for writing to the DSP directly from the Simulator
25#include <stdio.h> 32#include <stdio.h>
26#include <stdlib.h> 33#include <stdlib.h>
27#include <linux/soundcard.h> 34#include <linux/soundcard.h>
28#include <sys/ioctl.h> 35#include <sys/ioctl.h>
29#endif 36#endif
30*/
31 37
32 38
33#include "../../plugin.h" 39#include "../../plugin.h"
@@ -40,9 +46,9 @@
40 46
41 47
42 48
43//#include "lib/xxx2wav.h" 49#include "lib/xxx2wav.h"
44 50
45int fd=-1; //File descriptor, for opening /dev/dsp and writing to it 51int fd=-1; //File descriptor where the output is written
46 52
47extern long tempo; //The sequencer keeps track of this 53extern long tempo; //The sequencer keeps track of this
48 54
@@ -93,14 +99,12 @@ int midimain(void * filename)
93 return -1; 99 return -1;
94 } 100 }
95 101
96 fd=rb->open("/dsp.raw", O_WRONLY|O_CREAT);
97
98/*
99//This lets you hear the music through the sound card if you are on Simulator 102//This lets you hear the music through the sound card if you are on Simulator
100//Make a symlink, archos/dsp.raw and make it point to /dev/dsp or whatever 103//Make a symlink, archos/dsp.raw and make it point to /dev/dsp or whatever
101//your sound device is. 104//your sound device is.
102 105
103#if defined(SIMULATOR) 106#if defined(LOCAL_DSP)
107 fd=rb->open("/dsp.raw", O_WRONLY);
104 int arg, status; 108 int arg, status;
105 int bit, samp, ch; 109 int bit, samp, ch;
106 110
@@ -119,8 +123,15 @@ int midimain(void * filename)
119 status = ioctl(fd, SOUND_PCM_WRITE_RATE, &arg); 123 status = ioctl(fd, SOUND_PCM_WRITE_RATE, &arg);
120 status = ioctl(fd, SOUND_PCM_READ_RATE, &arg); 124 status = ioctl(fd, SOUND_PCM_READ_RATE, &arg);
121 samp=arg; 125 samp=arg;
126#else
127 file_info_struct file_info;
128 file_info.samplerate = 48000;
129 file_info.infile = fd;
130 file_info.channels = 2;
131 file_info.bitspersample = 16;
132 local_init("/miditest.tmp", "/miditest.wav", &file_info, rb);
133 fd = file_info.outfile;
122#endif 134#endif
123*/
124 135
125 136
126 rb->splash(HZ/5, true, " START PLAYING "); 137 rb->splash(HZ/5, true, " START PLAYING ");
@@ -190,6 +201,12 @@ int midimain(void * filename)
190 201
191// unloadFile(mf); 202// unloadFile(mf);
192 printf("\n"); 203 printf("\n");
193 rb->close(fd); 204
205#if !defined(LOCAL_DSP)
206
207 close_wav(&file_info);
208#else
209 rb->close(fd);
210#endif
194 return 0; 211 return 0;
195} 212}