forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with open_wav_file_write@

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
ursuselasticus



Joined: 26 Mar 2005
Posts: 71

PostPosted: Sat Jan 05, 2008 10:36 pm    Post subject: Problem with open_wav_file_write@ Reply with quote

Hi,

whenever I try like given in the docs


integer n_channels,sample_rate

file='one_blow.wav'
n_channels = 1
sample_rate = 41000

handle = open_wav_file_write@(file,n_channels,sample_rate)

I reveive the errormessage

'number of channels must be 1 or 2'.

I tried to rearrange the arguments - there might be a misprint in the docs. Only placing n_channels first in line avoids

this error, but I get 'unable to open waf_file' instead.

The arguments were derived from an existing wav-file by open_wav_file_read@, so I am pretty sure that they are in range.

What might be wrong ?

Norbert
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sun Jan 06, 2008 5:02 pm    Post subject: Reply with quote

It looks like the interface that is provided in the standard include files and modules is wrong. It should be:

C_EXTERNAL OPEN_WAV_FILE_WRITE@ '__open_wav_file_write' (INSTRING,VAL,VAL) : INTEGER*4

In other words the integer arguments are coded as VAL rather than REF.

Please confirm that this fixes the problem.
Back to top
View user's profile Send private message AIM Address
ursuselasticus



Joined: 26 Mar 2005
Posts: 71

PostPosted: Mon Jan 07, 2008 8:33 pm    Post subject: Reply with quote

HHmmm, nice to hear.

But ...

... how do I proceed to find out ? This way ??

Code:

   Program Sound

    implicit none
    include <windows.ins>
   C_EXTERNAL OPEN_WAV_FILE_WRITE@ '__open_wav_file_write' (INSTRING,VAL,VAL) : INTEGER*4

   integer::handle,n_channels,n_samples,sample_rate,left(100000),right(100000)
    integer*4 newhandle
   
   handle = open_wav_file_read@ ('one_turn.wav',n_channels,n_samples,sample_rate)

    print*,'n_channles = ',n_channels
    print*,'n_samples = ',n_samples
    print*,'Sample_rate = ',sample_rate

    call wav_file_read@(handle,left,right,n_samples)

    call close_wav_file@(handle)

    newhandle = open_wav_file_write@('one_blow.wav',n_channels,sample_rate)

    call wav_file_write@(newhandle,left,right,n_samples/4)

    call close_wav_file@(newhandle)

    stop
    end


This way I receive the following error-messages:

D:\TrainzEngine\Sound\Main.F95(5) : error 904 - Return type is expected.
Found (INSTRING,VAL,VAL):INTEGER*4
D:\TrainzEngine\Sound\Main.F95(20) : error 645 - OPEN_WAV_FILE_WRITE@ is a SUBROUTINE so cannot be used as a FUNCTION




(sorry for my limited knowledge base)

Norbert[/code]
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Jan 07, 2008 9:00 pm    Post subject: Reply with quote

You need to find open_wav_file_write@ in clearwin.ins which is accessed via windows.ins in your program and change the interface there. At the moment you will have two interfaces for this routine and they are conflicting.
Back to top
View user's profile Send private message AIM Address
ursuselasticus



Joined: 26 Mar 2005
Posts: 71

PostPosted: Wed Jan 09, 2008 10:30 pm    Post subject: Reply with quote

Thanks Paul, works fine.

Norbert
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group