comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@home.com>
Subject: Re: Streams Quandry in Ada95 (SOLVED)
Date: Thu, 14 Dec 2000 02:35:09 GMT
Date: 2000-12-14T02:35:09+00:00	[thread overview]
Message-ID: <3A383164.27001C5E@home.com> (raw)
In-Reply-To: 3A37D5BC.982E3BDF@home.com

"Warren W. Gay VE3WWG" wrote:

> I just got an email from  Sergey Koshcheyev <serko84@hotmail.com> who I think
> has solved this riddle (to be confirmed tonight).  He says: "it looks that the problem
> is you're using Audio_Stream as both the package name and the type name, so the
> compiler is getting confused..."  I think he may be right.

He was right. When I renamed the package to Audio_Streams (plural), this removed
the confusion with the type:

type Audio_Stream is access all Audio_Stream_Type'Class;

With the original name conflict in place, the things I thought were legal to do, were not.
Being relatively new to Ada, I assumed that I was doing something that I shouldn't
be able to do. Once I renamed the package, as per Sergey's advice, I was then able
to do the things I thought you could do.  I defined :

    procedure Pump(In_Str, Out_Str: Audio_Stream)

as required.  To access derived primitives on Au_Stream, all I now need
to do is:

    Chans := Channels(In_Str.All);  -- Determine the # of input audio channels

To set the # of channels on the Out_Str, (for DSP_Stream) then:

    Set_Channels(Out_Str.All,Chans);  -- Configure DSP to use n channel output

The Read/Write on the stream now works as expected:

    Audio_I32'Read(In_Str,I);    -- Read 32 bit int

Life is good!  Thanks everybody.  Sergey wins the prize ;-)

This is the 2nd time I was burnt by the package name.  This time, I'll remember
the lesson.

--
Warren W. Gay VE3WWG
http://members.home.net/ve3wwg




  reply	other threads:[~2000-12-14  2:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3A370548.B8AF2579@home.com>
2000-12-13 16:27 ` Streams Quandry in Ada95 Stephen Leake
2000-12-13 17:39   ` Warren W. Gay VE3WWG
2000-12-13 18:49     ` tmoran
2000-12-13 20:04       ` Warren W. Gay VE3WWG
2000-12-14  2:35         ` Warren W. Gay VE3WWG [this message]
2000-12-14 12:08         ` Robert Dewar
2000-12-14 14:19           ` Warren W. Gay VE3WWG
2000-12-14 21:43           ` Sergey Koshcheyev
2000-12-13 18:58     ` Anders Gidenstam
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox