Sound Programming Problem

Hi friends
I am trying to make sound recorder in C at first I only want to sample bytes but the the problem is that when I give command 20h to dsp the bit 7 of port Eh does not set please tell me how to solve this problem?

Comments

  • : Hi friends
    : I am trying to make sound recorder in C at first I only want to
    : sample bytes but the the problem is that when I give command 20h to
    : dsp the bit 7 of port Eh does not set please tell me how to solve
    : this problem?
    :

    [color=Green]ige> You need to provide more details. What dsp etc..[/color]
  • : I'm using SB16 compatible sound card and TurboC
  • : : I'm using SB16 compatible sound card and TurboC
    :
    [color=Green]ige> On what OS are you running it? If a driver for sound card is already loaded, then you might be just interfering with it (is OS would be allowing that to happen at all).

    Also you have to first initialize the chip properly, I hope you have done that.

    Try playing some sound before recording, this will make sure you are going th right direction.[/color]
  • :At first I tried it on XP then on win 98 and bit 7 could be set in win98 but when I speak into microphone the value does not change.Can you please tell me about initializing DSP
    This is the code I used

    # include
    # include
    # include
    # include
    int resetdsp(unsigned int);
    unsigned int base;
    void writedsp(unsigned char);
    void main()
    {

    unsigned int c;
    clrscr();
    if(resetdsp(0x220))
    {
    base=0x220;
    printf("SB FOUND at %X",base);
    }
    else
    {
    printf("SB not found");
    exit(0);
    }
    writedsp(0xD1);
    delay(230);

    while(!kbhit())
    {
    writedsp(0x20);
    delay(1);
    if((inportb(0x220+0xE)&0x80)==0x80)
    {
    c=inportb(base+0xA);
    printf("%X ",c);

    }
    delay(1);
    }

    }
    int resetdsp(unsigned int test)
    {
    int c;
    outportb(test+0x6,1);
    delay(10);
    outportb(test+0x6,0);
    delay(10);
    if(((inportb(test+0xE)&0x80)==0x80)&&(inportb(test+0xA)==0xAA))
    return 1;
    else
    return 0 ;
    }
    void writedsp(unsigned char data)
    {
    while(((inportb(base+0xC)&0x80)==0x80));
    outportb(base+0xC,data);
    }


  • main() is of return type int. Check any FAQ.
    bilderbikkel
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories