Exemplo n.º 1
0
        // internal update helper
        void update_internal(std.vector <write_stream_view> outputs, int output_shift = 0)
        {
            // local buffer to hold samples
            int MAX_SAMPLES = 256;

            fm_engine_base <ChipClass_Registers, ChipClass_Registers_OPS> .output_data [] output = new fm_engine_base <ChipClass_Registers, ChipClass_Registers_OPS> .output_data[MAX_SAMPLES];  //typename ChipClass::output_data output[MAX_SAMPLES];

            // parameters
            int outcount   = (int)std.min(outputs.size(), std.size(output[0].data));
            int numsamples = (int)outputs[0].samples();

            // generate the FM/ADPCM stream
            for (int sampindex = 0; sampindex < numsamples; sampindex += MAX_SAMPLES)
            {
                int cursamples = std.min(numsamples - sampindex, MAX_SAMPLES);
                m_chip.generate(output, (uint32_t)cursamples);
                for (int outnum = 0; outnum < outcount; outnum++)
                {
                    int eff_outnum = (outnum + output_shift) % OUTPUTS;
                    for (int index = 0; index < cursamples; index++)
                    {
                        outputs[eff_outnum].put_int(sampindex + index, output[index].data[outnum], 32768);
                    }
                }
            }
        }
Exemplo n.º 2
0
        void device(string dev_type)
        {
            std.vector <string> params_ = new std.vector <string>();

            require_token(m_tok_paren_left);
            string devname = get_identifier();

            m_setup.log().debug.op("Parser: IC: {0}\n", devname);

            var tok = get_token();

            while (tok.is_(m_tok_comma))
            {
                tok = get_token();
                if (/*tok.is_type(token_type::IDENTIFIER) ||*/ tok.is_type(parser_t_token_type.STRING))
                {
                    params_.push_back(tok.str());
                    tok = get_token();
                }
                else
                {
                    var value = stringify_expression(ref tok);
                    params_.push_back(value);
                }
            }

            require_token(tok, m_tok_paren_right);

            std.vector <string> params_temp = new std.vector <string>();
            params_temp.Add(devname);
            params_temp.AddRange(params_);
            m_setup.register_dev(dev_type, params_temp.ToArray());  //m_setup.register_dev(dev_type, devname, params);
        }
Exemplo n.º 3
0
        //-------------------------------------------------
        //  split
        //-------------------------------------------------
        static std.vector <string> split(string text, char sep)
        {
            std.vector <string> tokens = new std.vector <string>();
            size_t start = 0;
            size_t end   = 0;

            while ((end = text.find(sep, start)) != npos)
            {
                string temp = text.substr(start, end - start);
                if (temp != "")
                {
                    tokens.push_back(temp);
                }
                start = end + 1;
            }

            {
                string temp = text.substr(start);
                if (temp != "")
                {
                    tokens.push_back(temp);
                }
            }

            return(tokens);
        }
Exemplo n.º 4
0
Arquivo: text.cs Projeto: kwanboy/mcs
        //bool hit_test(float x, float y, size_t &start, size_t &span) const;
        //void restyle(size_t start, size_t span, rgb_t *fgcolor, rgb_t *bgcolor);


        //-------------------------------------------------
        //  get_wrap_info
        //-------------------------------------------------
        public int get_wrap_info(out std.vector <int> xstart, out std.vector <int> xend)
        {
            xstart = new std.vector <int>();
            xend   = new std.vector <int>();

            // this is a hacky method (tailored to the need to implement
            // mame_ui_manager::wrap_text) but so be it
            int line_count = 0;

            foreach (var line in m_lines)
            {
                int start_pos = 0;
                int end_pos   = 0;

                var line_character_count = line.character_count();
                if (line_character_count > 0)
                {
                    start_pos = (int)line.character(0).source.start;
                    end_pos   = (int)(line.character(line_character_count - 1).source.start
                                      + line.character(line_character_count - 1).source.span);
                }

                line_count++;
                xstart.push_back(start_pos);
                xend.push_back(end_pos);
            }

            return(line_count);
        }
Exemplo n.º 5
0
        std.vector <T> m_v;  //T * __restrict m_v;

        //allocator_type m_a;


        public pmatrix2d()
        {
            m_N      = 0;
            m_M      = 0;
            m_stride = 8;
            m_v      = null;
        }
Exemplo n.º 6
0
 //void set_pen_colors(pen_t color_base, const rgb_t *colors, int color_count) { while (color_count--) set_pen_color(color_base++, *colors++); }
 //template <size_t N> void set_pen_colors(pen_t color_base, const rgb_t (&colors)[N]) { set_pen_colors(color_base, colors, N); }
 public void set_pen_colors(pen_t color_base, std.vector <rgb_t> colors)
 {
     for (int i = 0; i != colors.size(); i++)
     {
         set_pen_color(color_base + (pen_t)i, colors[i]);
     }
 }
Exemplo n.º 7
0
        //template <typename M>
        public std.pair <size_t, size_t> gaussian_extend_fill_mat(std.vector <std.vector <unsigned> > fill)  //std::pair<std::size_t, std::size_t> gaussian_extend_fill_mat(M &fill)
        {
            size_t ops      = 0;
            size_t fill_max = 0;

            for (size_t k = 0; k < fill.size(); k++)
            {
                ops++; // 1/A(k,k)
                for (size_t row = k + 1; row < fill.size(); row++)
                {
                    if (fill[row][k] < (size_t)pmatrix_cr <B, B_OPS, int_N> .constants_e.FILL_INFINITY)
                    {
                        ops++;
                        for (size_t col = k + 1; col < fill[row].size(); col++)
                        //if (fill[k][col] < FILL_INFINITY)
                        {
                            var f = std.min(fill[row][col], 1 + fill[row][k] + fill[k][col]);
                            if (f < (size_t)pmatrix_cr <B, B_OPS, int_N> .constants_e.FILL_INFINITY)
                            {
                                if (f > fill_max)
                                {
                                    fill_max = f;
                                }
                                ops += 2;
                            }
                            fill[row][col] = f;
                        }
                    }
                }
            }

            build_parallel_gaussian_execution_scheme(fill);

            return(new std.pair <size_t, size_t>(fill_max, ops));
        }
Exemplo n.º 8
0
        std.vector <KeyValuePair <string, categoryindex> > m_ini_index;  //std::vector<std::pair<std::string, categoryindex> > m_ini_index;


        // construction/destruction
        //-------------------------------------------------
        //  ctor
        //-------------------------------------------------
        public inifile_manager(ui_options moptions)
        {
            m_options   = moptions;
            m_ini_index = new std.vector <KeyValuePair <string, categoryindex> >();


            // scan directories and create index
            file_enumerator path = new file_enumerator(m_options.categoryini_path());

            for (osd.directory.entry dir = path.next(); dir != null; dir = path.next())
            {
                string name = dir.name;
                if (core_filename_ends_with(name, ".ini"))
                {
                    emu_file file = new emu_file(m_options.categoryini_path(), OPEN_FLAG_READ);
                    if (file.open(name) == osd_file.error.NONE)
                    {
                        init_category(name, file);
                        file.close();
                    }
                }
            }

            //std::stable_sort(m_ini_index.begin(), m_ini_index.end());//, [] (auto const &x, auto const &y) { return 0 > core_stricmp(x.first.c_str(), y.first.c_str()); });
            m_ini_index.Sort((x, y) => { return(core_stricmp(x.Key.c_str(), y.Key.c_str())); });
        }
Exemplo n.º 9
0
        // toolbar
        protected override void inkey_export()
        {
            std.vector <game_driver> list = new std.vector <game_driver>();
            if (m_populated_favorites)
            {
                // iterate over favorites
                mame_machine_manager.instance().favorite().apply((info) =>
                {
                    assert(info.driver != null);
                    if (info.startempty != 0)
                    {
                        list.push_back(info.driver);
                    }
                });
            }
            else
            {
                list.reserve(m_displaylist.size());
                foreach (ui_system_info info in m_displaylist)
                {
                    list.emplace_back(info.driver);
                }
            }

            throw new emu_unimplemented();
#if false
#endif
        }
Exemplo n.º 10
0
        // device_sound_interface overrides
        //-------------------------------------------------
        //  sound_stream_update - update a sound stream
        //-------------------------------------------------
        void device_sound_interface_sound_stream_update(sound_stream stream, std.vector <read_stream_view> inputs, std.vector <write_stream_view> outputs)  //virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
        {
            // find the channel with this stream
            stream_buffer_sample_t sample_scale = (stream_buffer_sample_t)(1.0 / 32768.0);

            for (int channel = 0; channel < m_channels; channel++)
            {
                if (stream == m_channel[channel].stream)
                {
                    channel_t chan   = m_channel[channel];
                    var       buffer = outputs[0];

                    // process if we still have a source and we're not paused
                    if (chan.source != null && !chan.paused)
                    {
                        // load some info locally
                        double            step   = (double)chan.curfreq / (double)buffer.sample_rate();
                        double            endpos = chan.source_len;
                        Pointer <int16_t> sample = new Pointer <int16_t>(chan.source);  //const int16_t *sample = chan.source;

                        for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
                        {
                            // do a linear interp on the sample
                            double  pos_floor = std.floor(chan.pos);
                            double  frac      = chan.pos - pos_floor;
                            int32_t ipos      = (int32_t)pos_floor;

                            stream_buffer_sample_t sample1 = (stream_buffer_sample_t)sample[ipos++];
                            stream_buffer_sample_t sample2 = (stream_buffer_sample_t)sample[(ipos + 1) % (int)chan.source_len];
                            buffer.put(sampindex, (stream_buffer_sample_t)(sample_scale * ((1.0 - frac) * sample1 + frac * sample2)));

                            // advance
                            chan.pos += step;

                            // handle looping/ending
                            if (chan.pos >= endpos)
                            {
                                if (chan.loop)
                                {
                                    chan.pos -= endpos;
                                }
                                else
                                {
                                    chan.source     = null;
                                    chan.source_num = -1;
                                    buffer.fill(0, sampindex);
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        buffer.fill(0);
                    }
                    break;
                }
            }
        }
Exemplo n.º 11
0
        //std::unique_ptr<driver_enumerator> m_drivlist;


        //-------------------------------------------------
        //  ctor
        //-------------------------------------------------
        simple_menu_select_game(mame_ui_manager mui, render_container container, string gamename)
            : base(mui, container)
        {
            m_driverlist = new std.vector <game_driver>(driver_list.total() + 1);


            throw new emu_unimplemented();
        }
Exemplo n.º 12
0
        /*-------------------------------------------------
        *   menu_sliders_populate - populate the sliders
        *   menu
        *  -------------------------------------------------*/
        protected override void populate(ref float customtop, ref float custombottom)
        {
            string tempstring;

            /* add UI sliders */
            std.vector <menu_item> ui_sliders = ui().get_slider_list();
            foreach (menu_item item in ui_sliders)
            {
                if (item.type == menu_item_type.SLIDER)
                {
                    slider_state slider = (slider_state)item.ref_;
                    int32_t      curval = slider.update(machine(), slider.arg, slider.id, out tempstring, slider_state.SLIDER_NOCHANGE);
                    uint32_t     flags  = 0;
                    if (curval > slider.minval)
                    {
                        flags |= FLAG_LEFT_ARROW;
                    }
                    if (curval < slider.maxval)
                    {
                        flags |= FLAG_RIGHT_ARROW;
                    }
                    item_append(slider.description, tempstring, flags, slider, menu_item_type.SLIDER);
                }
                else
                {
                    item_append(item);
                }
            }

            item_append(menu_item_type.SEPARATOR);

            /* add OSD sliders */
            std.vector <menu_item> osd_sliders = machine().osd().get_slider_list();
            foreach (menu_item item in osd_sliders)
            {
                if (item.type == menu_item_type.SLIDER)
                {
                    slider_state slider = (slider_state)item.ref_;
                    int32_t      curval = slider.update(machine(), slider.arg, slider.id, out tempstring, slider_state.SLIDER_NOCHANGE);
                    uint32_t     flags  = 0;
                    if (curval > slider.minval)
                    {
                        flags |= FLAG_LEFT_ARROW;
                    }
                    if (curval < slider.maxval)
                    {
                        flags |= FLAG_RIGHT_ARROW;
                    }
                    item_append(slider.description, tempstring, flags, slider);
                }
                else
                {
                    item_append(item);
                }
            }

            custombottom = 2.0f * ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER;
        }
Exemplo n.º 13
0
        //-------------------------------------------------
        //  populate_hashpath_from_args_and_inis
        //-------------------------------------------------
        public static void populate_hashpath_from_args_and_inis(emu_options options, std.vector <string> args)
        {
            // The existence of this function comes from the fact that for softlist options to be properly
            // evaluated, we need to have the hashpath variable set.  The problem is that the hashpath may
            // be set anywhere on the command line, but also in any of the myriad INI files that we parse, some
            // of which may be system specific (e.g. - nes.ini) or otherwise influenced by the system (e.g. - vector.ini)
            //
            // I think that it is terrible that we have to do a completely independent pass on the command line and every
            // argument simply because any one of these things might be setting - hashpath.Unless we invest the effort in
            // building some sort of "late binding" apparatus for options(e.g. - delay evaluation of softlist options until
            // we've scoured all INIs for hashpath) that can completely straddle the command line and the INI worlds, doing
            // this is the best that we can do IMO.

            // parse the command line
            emu_options temp_options = new emu_options(emu_options.option_support.GENERAL_AND_SYSTEM);

            // pick up whatever changes the osd did to the default inipath
            temp_options.set_default_value(emu_options.OPTION_INIPATH, options.ini_path());

            try
            {
                temp_options.parse_command_line(args, emu_options.OPTION_PRIORITY_CMDLINE, true);
            }
            catch (options_exception)
            {
                // Something is very long; we have bigger problems than -hashpath possibly
                // being in never-never land.  Punt and let the main code fail
                return;
            }

            // if we have an auxillary verb, hashpath is irrelevant
            if (!temp_options.command().empty())
            {
                return;
            }

            // read INI files
            if (temp_options.read_config())
            {
                string error_stream;  //std::ostringstream error_stream;
                parse_standard_inis(temp_options, out error_stream);
            }

            // and fish out hashpath
            var entry = temp_options.get_entry(emu_options.OPTION_HASHPATH);

            if (entry != null)
            {
                try
                {
                    options.set_value(emu_options.OPTION_HASHPATH, entry.value(), entry.priority());
                }
                catch (options_exception)
                {
                }
            }
        }
Exemplo n.º 14
0
        public std.vector <detail.core_terminal_t> core_terms(detail.net_t net)  //std::vector<detail::core_terminal_t *> &core_terms(const detail::net_t &net) noexcept
        {
            if (m_core_terms[net] == default)
            {
                m_core_terms[net] = new std.vector <detail.core_terminal_t>();
            }

            return(m_core_terms[net]);
        }
Exemplo n.º 15
0
            Func <size_t, O> m_obj_by_id; //obj_delegate m_obj_by_id;


            public queue_base(size_t size, Func <O, size_t> get_id, Func <size_t, O> get_obj)
                : base(size)  //: timed_queue<plib::pqentry_t<netlist_time_ext, O *>, false>(size)
            {
                m_qsize     = 0;
                m_times     = new std.vector <Int64>(size);
                m_net_ids   = new std.vector <size_t>(size);
                m_get_id    = get_id;
                m_obj_by_id = get_obj;
            }
Exemplo n.º 16
0
            Action <string> m_value_changed_handler;  //std::function<void(const char *)>           m_value_changed_handler;


            // construction/destruction
            protected entry(std.vector <string> names, option_type type = option_type.STRING, string description = null)
            {
                m_names       = names;
                m_priority    = OPTION_PRIORITY_DEFAULT;
                m_type        = type;
                m_description = description;


                assert(m_names.empty() == (m_type == option_type.HEADER));
            }
Exemplo n.º 17
0
            string m_maximum;          // maximum value


            // construction/destruction
            public simple_entry(std.vector <string> names, string description, option_type type, string defdata, string minimum, string maximum)
                : base(names, type, description)
            {
                m_defdata = defdata;
                m_minimum = minimum;
                m_maximum = maximum;


                m_data = m_defdata;
            }
Exemplo n.º 18
0
        void fill(memory_units_descriptor <int_Width, int_AddrShift> descriptor, std.vector <memory_units_descriptor <int_Width, int_AddrShift> .entry> entries)
        {
            handler_entry handler = descriptor.get_subunit_handler();

            handler.ref_((int)entries.size());
            foreach (var e in entries)
            {
                m_subunit_infos[m_subunits++] = new subunit_info(handler, e.m_amask, e.m_dmask, e.m_ashift, e.m_offset, e.m_dshift, descriptor.get_subunit_width());
            }
        }
Exemplo n.º 19
0
        std.vector <pqentry_t <detail.net_t, netlist_time> > m_list; //std::vector<T> m_list;


        // profiling
        //nperfcount_t<KEEPSTAT> m_prof_sortmove;
        //nperfcount_t<KEEPSTAT> m_prof_call;


        public timed_queue_linear(bool TS, UInt32 list_size)
        {
            this.TS = TS;


            m_list = new std.vector <pqentry_t <detail.net_t, netlist_time> >(list_size);


            clear();
        }
Exemplo n.º 20
0
        // construction
        public ymfm_saved_state(std.vector <uint8_t> buffer, bool saving)
        {
            m_buffer = buffer;
            m_offset = saving ? -1 : 0;


            if (saving)
            {
                buffer.resize(0);
            }
        }
Exemplo n.º 21
0
        // register a list of logs
        public void register_dynamic_log_devices(std.vector <string> loglist)
        {
            log().debug.op("Creating dynamic logs ...");
            foreach (string ll in loglist)
            {
                string name = "log_" + ll;

                register_dev("LOG", name);
                register_link(name + ".I", ll);
            }
        }
Exemplo n.º 22
0
        machine_config_cache m_config;  //mutable machine_config_cache m_config;


        // construction/destruction
        //-------------------------------------------------
        //  driver_enumerator - constructor
        //-------------------------------------------------
        public driver_enumerator(emu_options options)
            : base()
        {
            m_current        = -1;
            m_filtered_count = 0;
            m_options        = options;
            m_included       = new std.vector <bool>();
            m_included.resize(drivlist_global.s_driver_count);
            m_config = new util.lru_cache_map <int, machine_config>(CONFIG_CACHE_COUNT);


            include_all();
        }
Exemplo n.º 23
0
        /// \brief Get vector of devices
        ///
        /// \tparam C Device class for which devices will be returned
        ///
        /// \return vector with pointers to devices

        //template<class C>
        public std.vector <C> get_device_list <C>() where C : core_device_t
        {
            std.vector <C> tmp = new std.vector <C>();
            foreach (var d in m_devices)
            {
                var dev = d.second is C ? (C)d.second : null;  //auto dev = dynamic_cast<C *>(d.second.get());
                if (dev != null)
                {
                    tmp.push_back(dev);
                }
            }
            return(tmp);
        }
Exemplo n.º 24
0
        machine_config_cache m_config;  //mutable machine_config_cache m_config;


        // construction/destruction
        //-------------------------------------------------
        //  driver_enumerator - constructor
        //-------------------------------------------------
        public driver_enumerator(emu_options options)
            : base()
        {
            m_current        = -1;
            m_filtered_count = 0;
            m_options        = options;
            m_included       = new std.vector <bool>();
            m_included.resize(s_driver_count);
            m_config = new machine_config_cache(CONFIG_CACHE_COUNT);


            include_all();
        }
Exemplo n.º 25
0
        //-------------------------------------------------
        //  add_entry
        //-------------------------------------------------
        void add_entry(std.vector <string> names, string description, option_type type, string default_value = "", string minimum = "", string maximum = "")
        {
            // create the entry
            entry new_entry = new simple_entry(
                names,
                description,
                type,
                default_value,
                minimum,
                maximum);

            // and add it
            add_entry(new_entry);
        }
Exemplo n.º 26
0
        static string catremainder(std.vector <string> elems, size_t start, string sep)
        {
            throw new emu_unimplemented();
#if false
            pstring ret("");

            for (std::size_t i = start; i < elems.size(); i++)
            {
                ret += elems[i];
                ret += sep;
            }
            return(ret);
#endif
        }
Exemplo n.º 27
0
        // construction/destruction
        //-------------------------------------------------
        //  palette_t - constructor
        //-------------------------------------------------
        palette_t(uint32_t numcolors, uint32_t numgroups = 1)
        {
            m_refcount       = 1;
            m_numcolors      = numcolors;
            m_numgroups      = numgroups;
            m_brightness     = 0.0f;
            m_contrast       = 1.0f;
            m_gamma          = 1.0f;
            m_entry_color    = new std.vector <rgb_t>((int)numcolors);
            m_entry_contrast = new std.vector <float>((int)numcolors);
            m_adjusted_color = new std.vector <rgb_t>((int)(numcolors * numgroups + 2));
            m_adjusted_rgb15 = new std.vector <rgb15_t>((int)(numcolors * numgroups + 2));
            m_group_bright   = new std.vector <float>((int)numgroups);
            m_group_contrast = new std.vector <float>((int)numgroups);
            m_client_list    = null;


            // initialize gamma map
            for (uint32_t index = 0; index < 256; index++)
            {
                m_gamma_map[index] = (uint8_t)index;
            }

            // initialize the per-entry data
            for (uint32_t index = 0; index < numcolors; index++)
            {
                m_entry_color[index]    = rgb_t.black();
                m_entry_contrast[index] = 1.0f;
            }

            // initialize the per-group data
            for (uint32_t index = 0; index < numgroups; index++)
            {
                m_group_bright[index]   = 0.0f;
                m_group_contrast[index] = 1.0f;
            }

            // initialize the expanded data
            for (uint32_t index = 0; index < numcolors * numgroups; index++)
            {
                m_adjusted_color[index] = rgb_t.black();
                m_adjusted_rgb15[index] = rgb_t.black().as_rgb15();
            }

            // add black and white as the last two colors
            m_adjusted_color[numcolors * numgroups + 0] = rgb_t.black();
            m_adjusted_rgb15[numcolors * numgroups + 0] = rgb_t.black().as_rgb15();
            m_adjusted_color[numcolors * numgroups + 1] = rgb_t.white();
            m_adjusted_rgb15[numcolors * numgroups + 1] = rgb_t.white().as_rgb15();
        }
Exemplo n.º 28
0
        attotime m_last_update;                                                    // last update time


        // construction/destruction

        //-------------------------------------------------
        //  sound_manager - constructor
        //-------------------------------------------------
        public sound_manager(running_machine machine)
        {
            m_machine            = machine;
            m_update_timer       = null;
            m_finalmix_leftover  = 0;
            m_finalmix           = new std.vector <s16>(machine.sample_rate());
            m_leftmix            = new std.vector <s32>(machine.sample_rate());
            m_rightmix           = new std.vector <s32>(machine.sample_rate());
            m_nosound_mode       = machine.osd().no_sound() ? 1 : 0;
            m_wavfile            = null;
            m_update_attoseconds = STREAMS_UPDATE_ATTOTIME.attoseconds();
            m_last_update        = attotime.zero;


            // get filename for WAV file or AVI file if specified
            string wavfile = machine.options().wav_write();
            string avifile = machine.options().avi_write();

            // handle -nosound and lower sample rate if not recording WAV or AVI
            if (m_nosound_mode != 0 && string.IsNullOrEmpty(wavfile) && string.IsNullOrEmpty(avifile))
            {
                machine.sample_rate_set(11025);
            }

            // count the mixers
            if (sound_global.VERBOSE)
            {
                mixer_interface_iterator iter = new mixer_interface_iterator(machine.root_device());
                sound_global.VPRINTF("total mixers = {0}\n", iter.count());
            }

            // register callbacks
            machine.configuration().config_register("mixer", config_load, config_save);
            machine.add_notifier(machine_notification.MACHINE_NOTIFY_PAUSE, pause);
            machine.add_notifier(machine_notification.MACHINE_NOTIFY_RESUME, resume);
            machine.add_notifier(machine_notification.MACHINE_NOTIFY_RESET, reset);
            machine.add_notifier(machine_notification.MACHINE_NOTIFY_EXIT, stop_recording);

            // register global states
            machine.save().save_item(m_last_update, "m_last_update");

            // set the starting attenuation
            set_attenuation(machine.options().volume());

            // start the periodic update flushing timer
            m_update_timer = machine.scheduler().timer_alloc(update, this);
            m_update_timer.adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME);
        }
Exemplo n.º 29
0
        // constructor
        public dac_device_base(machine_config mconfig, device_type type, string tag, device_t owner, uint32_t clock, u8 bits, dac_mapper_callback mapper, stream_buffer_sample_t gain)
            : base(mconfig, type, tag, owner, clock)
        {
            m_class_interfaces.Add(new device_sound_interface_dac_device_base(mconfig, this));  //device_sound_interface(mconfig, *this);
            m_disound = GetClassInterface <device_sound_interface_dac_device_base>();


            m_stream    = null;
            m_curval    = 0;
            m_value_map = new std.vector <stream_buffer_sample_t>(1 << bits);
            m_bits      = bits;
            m_mapper    = mapper;
            m_gain      = gain;
            m_range_min = (bits == 1) ? (stream_buffer_sample_t)0.0 : (stream_buffer_sample_t)(-1.0);
            m_range_max = (stream_buffer_sample_t)1.0;
        }
Exemplo n.º 30
0
        public pmatrix2d(pmatrix2d_size_type N, pmatrix2d_size_type M)
        {
            m_N = N;
            m_M = M;
            m_v = new std.vector <T>();


            //gsl_Expects(N>0);
            //gsl_Expects(M>0);
            m_stride = ((M + stride_size - 1) / stride_size) * stride_size;
            m_v      = new std.vector <T>(N * m_stride); //m_v = m_a.allocate(N * m_stride);
            for (size_t i = 0; i < N * m_stride; i++)
            {
                m_v[i] = default;  //::new(&m_v[i]) T();
            }
        }
Exemplo n.º 31
0
        public void CheckDefaultTestCaseLocals()
        {
            StackFrame frame = GetFrame($"{DefaultModuleName}!DefaultTestCase");
            VariableCollection locals = frame.Locals;
            dynamic p = locals["p"];
            std.wstring string1 = new std.wstring(p.string1);
            Assert.AreEqual("qwerty", string1.Text);
            std.list<std.wstring> strings = new std.list<std.wstring>(p.strings);
            std.vector<std.@string> ansiStrings = new std.vector<std.@string>(p.ansiStrings);
            std.map<std.wstring, std.@string> stringMap = new std.map<std.wstring, std.@string>(p.stringMap);
            std.unordered_map<std.wstring, std.@string> stringUMap = new std.unordered_map<std.wstring, std.@string>(p.stringUMap);

            string[] stringsConverted = strings.Select(s => s.Text).ToArray();
            string[] ansiStringsConverted = ansiStrings.Select(s => s.Text).ToArray();

            CompareArrays(new[] { "Foo", "Bar" }, stringsConverted);
            CompareArrays(new[] { "AnsiFoo", "AnsiBar" }, ansiStringsConverted);

            foreach (std.wstring s in strings)
                Assert.IsTrue(s.Length <= s.Reserved);
            for (int i = 0; i < ansiStrings.Count; i++)
                Assert.IsTrue(ansiStrings[i].Length <= ansiStrings[i].Reserved);

            VerifyMap(stringMap);
            VerifyMap(stringUMap);

            // Verify enum value
            dynamic e = locals["e"];

            Assert.AreEqual("enumEntry3", e.ToString());
            Assert.AreEqual(3, (int)e);

            // Verify shared/weak pointers
            std.shared_ptr<int> sptr1 = new std.shared_ptr<int>(locals["sptr1"]);
            std.shared_ptr<int> esptr1 = new std.shared_ptr<int>(locals["esptr1"]);
            std.shared_ptr<int> esptr2 = new std.shared_ptr<int>(locals["esptr2"]);
            std.weak_ptr<int> wptr1 = new std.weak_ptr<int>(locals["wptr1"]);
            std.weak_ptr<int> ewptr1 = new std.weak_ptr<int>(locals["ewptr1"]);
            std.weak_ptr<int> ewptr2 = new std.weak_ptr<int>(locals["ewptr2"]);

            Assert.IsFalse(sptr1.IsEmpty);
            Assert.AreEqual(1, sptr1.SharedCount);
            Assert.AreEqual(2, sptr1.WeakCount);
            Assert.AreEqual(5, sptr1.Element);
            Assert.IsTrue(sptr1.IsCreatedWithMakeShared);

            Assert.IsFalse(wptr1.IsEmpty);
            Assert.AreEqual(1, wptr1.SharedCount);
            Assert.AreEqual(2, wptr1.WeakCount);
            Assert.AreEqual(5, wptr1.Element);
            Assert.IsTrue(wptr1.IsCreatedWithMakeShared);

            Assert.IsTrue(esptr1.IsEmpty);

            Assert.IsTrue(ewptr1.IsEmpty);
            Assert.AreEqual(0, ewptr1.SharedCount);
            Assert.AreEqual(1, ewptr1.WeakCount);
            Assert.AreEqual(42, ewptr1.UnsafeElement);
            Assert.IsTrue(ewptr1.IsCreatedWithMakeShared);

            Assert.IsTrue(esptr2.IsEmpty);

            Assert.IsTrue(ewptr2.IsEmpty);
            Assert.AreEqual(0, ewptr2.SharedCount);
            Assert.AreEqual(1, ewptr2.WeakCount);
            Assert.IsFalse(ewptr2.IsCreatedWithMakeShared);
        }