To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 516
515  |  517
Subject: 
legOS 0.2.2 dsound_play ?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Thu, 25 Nov 1999 04:15:37 GMT
Viewed: 
1203 times
  
hello again,
has anybody got anything else than noise from legOS 0.2.2 dsound_play ?

i'm able to compile and dll this little application:

#include <dsound.h>
#include "sample.h"

int main(int argc, char *argv[])
{
   dsound_play(sample,sizeof(sample));
   return 0;
}

( sample.h was produced by running : sample-convert fuenfte.wav )

However, everything i hear when i press RUN is a short burst of noise.

What i'm wondering about: as far as i understand currently, dsound_play
works as follows:
8-Bit-Timer0 (whose output is wired to the speaker ?) is programmed to
output 1 on compare A match, and 0 on compare B match. IRQ is enabled on
A match, and the IRQ handler puts a new sample into compare B register
on every 4.th interrupt. The level of A match is fixed to 0xff-20 = 235
( maybe the speaker needs some DC ??).
Timer base frequency is set to system/2 making 8 Mhz, what results in
8000000/256 = 31250 IRQ frequency. Because only every 4.th interrupt
gets a new sample, actual playback frequency is 31250/4 = 7812.5,
approximately 8000.
Thus, the average voltage that is output to the speaker will be
following the samples, as long as the value of the samples won't exceed
235. However, the converted sample.h contains many values larger than
235, so i think this can't work.
Thanks for any hints (or a .wav file that plays nicely), Martin



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR