The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
# Audio::LADSPA perl modules for interfacing with LADSPA plugins
# Copyright (C) 2003  Joost Diepenmaat.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# See the COPYING file for more information.

TYPEMAP

LADSPA_Data LADSPA_Data_T

#
# T_PTROBJ_SPECIAL translates _ to ::
#

Audio_LADSPA_Buffer T_PTROBJ_SPECIAL

#
# T_PTROBJ_SPECIAL_RO is like T_PTROBJ_SPECIAL, but has no OUTPUT map
#
# these are used for creating objects that are derived from a base
# but who's package names are unknown at compile time (they are
# composed from the plugins loaded at runtime)
#

Audio_LADSPA_Plugin T_PTROBJ_SPECIAL_RO
Audio_LADSPA_Port   T_PTROBJ_SPECIAL_RO


INPUT
T_PTROBJ_SPECIAL
    if (sv_derived_from($arg, \"${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")) {
	IV tmp = SvIV((SV*)SvRV($arg));
        $var = ($type) tmp;
    }
    else
	croak(\"$var is not of type ${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")

T_PTROBJ_SPECIAL_RO
    if (sv_derived_from($arg, \"${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")) {
	IV tmp = SvIV((SV*)SvRV($arg));
        $var = ($type) tmp;
    }
    else
	croak(\"$var is not of type ${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")

LADSPA_Data_T
	$var = (LADSPA_Data)SvNV($arg)



OUTPUT
T_PTROBJ_SPECIAL
    sv_setref_pv($arg, \"${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\",
    (void*)$var);

LADSPA_Data_T
	sv_setnv($arg, (NV)$var);