0
0

Hi, I’m new to the forum, but I’ve been fmodding for 3.5 months now in C and porting to Rebol. I’ve come across a possible bug shown nicely by the code below. Can anyone confirm this as a bug, or point out anything I might have missed ?

Regards,
Anton.

[code:2jmmmrqh]
/*
Title: "Init Record Bug"
File: %main.c
Date: 28-Apr-2005
Author: "Anton Rolls"
Purpose: {Show a bug in FMOD 3.74, error on second record (init, record, close, init, record <-}
Notes: {
It looks like FSOUND_Close or FSOUND_Record_Stop doesn’t cleanup the recording
functionality fully.. ?

    I'm on WinXP, soundcard is &quot;Creative SB Live! Value&quot; with &quot;EMU10K1 audio processor&quot;.
    The output I get from this program is:

        FMOD 3.74
        -------------------
        Recording Attempt 0
        Output: Direct Sound  Driver: Primary Sound Driver
        Started recording OK
        Stopped recording OK
        -------------------
        Recording Attempt 1
        Output: Direct Sound  Driver: Primary Sound Driver
        FMOD Error 17, Recording not supported on this device.

    (I have written a program which *does* successfully make a recording to
    a sample, I just noticed I couldn't FSOUND_Close and Init again in between
    recordings.)
}

*/

include <stdio.h>

include <fmod.h> // http://www.fmod.org/

include <fmod_errors.h>

if defined(WIN32) || defined(_WIN64) || defined(WATCOMC)

#include &lt;windows.h&gt;
#include &lt;conio.h&gt;

else

#include &quot;../../api/inc/wincompat.h&quot;

endif

void print_driver_info(){
char *output="";
switch (FSOUND_GetOutput())
{
case FSOUND_OUTPUT_NOSOUND: output="NoSound"; break;
case FSOUND_OUTPUT_WINMM: output="Windows Multimedia Waveout"; break;
case FSOUND_OUTPUT_DSOUND: output="Direct Sound"; break;
case FSOUND_OUTPUT_OSS: output="Open Sound System"; break;
case FSOUND_OUTPUT_ESD: output="Enlightment Sound Daemon"; break;
case FSOUND_OUTPUT_ALSA: output="ALSA"; break;
};
printf("Output: %s Driver: %s\n", output, FSOUND_GetDriverName(FSOUND_GetDriver()));
}

void print_last_FMOD_error(){
int fmod_err = 0;
fmod_err = FSOUND_GetError();
printf("FMOD Error %i, %s.\n", fmod_err, FMOD_ErrorString(fmod_err));
}

void record(){
FSOUND_SAMPLE *sample = FSOUND_Sample_Alloc(
FSOUND_UNMANAGED, 2 * 44100, // 2 seconds
FSOUND_NORMAL, 44100, 255, 128, 255
);

if (!sample){
    puts(&quot;Couldn't allocate sample.&quot;);
    print_last_FMOD_error();
    return;
}

if (!FSOUND_Record_StartSample(sample, 0)){ // &lt;--- returns fail the 2nd time
    print_last_FMOD_error();
    return;
};
puts(&quot;Started recording OK&quot;);

FSOUND_Record_Stop();
puts(&quot;Stopped recording OK&quot;);

FSOUND_Sample_Free(sample);

}

int main(int argc, char *argv[])
{
printf("FMOD %.02f\n", FMOD_VERSION);

int i;
for (i=0; i&lt;2; i++){
    printf(&quot;-------------------\nRecording Attempt %d\n&quot;, i);
    FSOUND_Init(44100, 32, 0);
    print_driver_info();
    record(); // &lt;----------------- bug happens here second time
    FSOUND_Close();
}  

puts(&quot;&quot;); system(&quot;PAUSE&quot;);
return 0;

}
[/code:2jmmmrqh]

  • You must to post comments
0
0

I had the same problem with recording with VB (my source [url=http://www.vbfrance.com/code.aspx?ID=22988:2t4quryb]here[/url:2t4quryb]). Maybe it is because using FSOUND_UNMANAGED the FSOUND_CLOSE function DO NOT close the recording sample, and so residual data are remaining. Use FSOUND_SAMPLE_FREE to close the recoding sample before closing fmod.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.