GithubHelp home page GithubHelp logo

Comments (17)

melanchall avatar melanchall commented on August 24, 2024

Hi,

Unfortunately, I don't understand you :-( Can you please write your question in English?

Thanks,
Max

from drywetmidi.

melanchall avatar melanchall commented on August 24, 2024

@ZengRunMing Am I correct you have a feature suggestion to introduce a new Read method which accepts an offset from the start of a stream? Something like

MidiFile.Read(stream, offset);

I don't think we need the size parameter because it's not required to detect the end of a file.

from drywetmidi.

melanchall avatar melanchall commented on August 24, 2024

Well, if I understood you correctly, I think we don't need a new method. Just move to the desired position in the stream first

stream.Seek(count, from);

and then call

MidiFile.Read(stream);

from drywetmidi.

ZengRunMing avatar ZengRunMing commented on August 24, 2024

It has been resolved, thank you

from drywetmidi.

ZengRunMing avatar ZengRunMing commented on August 24, 2024

Next time, I will use a translator to send English because I am not very good at speaking English.
This is written using a translator

from drywetmidi.

melanchall avatar melanchall commented on August 24, 2024

Well, I've just checked the way suggested by me and it doesn't work... So I need to handle your issue properly. I think I'll add

ExtraTrackChunkPolicy.StopReading

which can be specified in ReadingSettings which will tell DryWetMIDI to stop reading a file when required track chunks are read.

Thanks for the issue! I'll implement new policy as soon as I get back to my computer next week.

from drywetmidi.

melanchall avatar melanchall commented on August 24, 2024

@ZengRunMing Hi,

I've added StopReadingOnExpectedTrackChunksCountReached property to the ReadingSettings, so you can use this code:

MidiFile.Read(stream, new ReadingSettings
{
    StopReadingOnExpectedTrackChunksCountReached = true
});

This will force DryWetMIDI to stop when a file is read even if the input stream's end is not reached. So you can make the same call again and read following file from the stream.

New API is in prerelease NuGet-package – 7.0.0-prerelease1.

Thanks,
Max

from drywetmidi.

ZengRunMing avatar ZengRunMing commented on August 24, 2024

midi.zip
By the way, I also discovered an issue where errors may occur when playing Midi files similar to those in compressed packages, as follows
Error

from drywetmidi.

melanchall avatar melanchall commented on August 24, 2024

@ZengRunMing Please show the code you use to get this error. In the archive I see 4 files, but I suppose you get the error on one specific file, right?

from drywetmidi.

ZengRunMing avatar ZengRunMing commented on August 24, 2024

Are these?
Error
ErrorCode

from drywetmidi.

ZengRunMing avatar ZengRunMing commented on August 24, 2024

This problem arose before I changed the API, when I read Midi files directly from Read (string Path)

from drywetmidi.

melanchall avatar melanchall commented on August 24, 2024

What is ReadOnBytes? Where usage of the new API I've provided you via prerelease package? What is in MemoryStream? How your archive is related with this code? You didn't provide any details so I can't help you unfortunately.

from drywetmidi.

ZengRunMing avatar ZengRunMing commented on August 24, 2024

This is the API version 6.4.1. There is currently no newly released API being used. The above code is used to call the method I added in the API after I changed it. The following figure shows the code added in the API. The Midi file in the ZIP file is imported through Cubase and then re exported. Only in this way can it run normally. I'm not sure if it's a coding issue. This issue also occurs when reading using file names.
CODE

from drywetmidi.

melanchall avatar melanchall commented on August 24, 2024

Please send me the entire solution with all your code and hardcode usage of some file within it so I can just run solution and reproduce the error.

from drywetmidi.

ZengRunMing avatar ZengRunMing commented on August 24, 2024

The file was too big to be sent out

from drywetmidi.

melanchall avatar melanchall commented on August 24, 2024

Unfortunately you didn't provide me details and I am forced to pull information from you. Sorry, but I have no time for this. So I recommend you to use new API I've prepared for you. If you have any other questions or problems, feel free to open new issues. And please read the Support article to learn how to get help quickly.

from drywetmidi.

melanchall avatar melanchall commented on August 24, 2024

🚀 7.0.0 version is released now!

Prerelease NuGet packages will be unlisted soon, so please update the package references to the new version.

from drywetmidi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.